From: <abe...@us...> - 2014-03-05 21:36:18
|
Revision: 6434 http://sourceforge.net/p/astlinux/code/6434 Author: abelbeck Date: 2014-03-05 21:36:15 +0000 (Wed, 05 Mar 2014) Log Message: ----------- add new package, 'phoneprov-tools' using only local files. A set of scripts and configuration templates designed to generate IP Phone provisioning files as well as Asterisk sip.conf and extensions.conf includes files. Special thanks to Michael Keuter. Modified Paths: -------------- branches/1.0/astlinux-ast11.config branches/1.0/astlinux18.config branches/1.0/package/Config.in branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf Added Paths: ----------- branches/1.0/package/phoneprov-tools/ branches/1.0/package/phoneprov-tools/Config.in branches/1.0/package/phoneprov-tools/massdeployment.conf branches/1.0/package/phoneprov-tools/phoneprov-build branches/1.0/package/phoneprov-tools/phoneprov-massdeployment branches/1.0/package/phoneprov-tools/phoneprov-tools.mk branches/1.0/package/phoneprov-tools/templates/ branches/1.0/package/phoneprov-tools/templates/snom320.conf branches/1.0/package/phoneprov-tools/templates/spa942.conf branches/1.0/package/phoneprov-tools/templates/yealink.conf Modified: branches/1.0/astlinux-ast11.config =================================================================== --- branches/1.0/astlinux-ast11.config 2014-02-27 14:10:19 UTC (rev 6433) +++ branches/1.0/astlinux-ast11.config 2014-03-05 21:36:15 UTC (rev 6434) @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Buildroot 2011.08-svn6405-dirty Configuration -# Fri Feb 7 15:08:32 2014 +# Buildroot 2011.08-svn6433-dirty Configuration +# Wed Mar 5 15:25:32 2014 # BR2_HAVE_DOT_CONFIG=y # BR2_arm is not set @@ -171,6 +171,7 @@ BR2_PACKAGE_ASTERISK_CODEC_SILK=y BR2_PACKAGE_ASTERISK_FOP2=y BR2_PACKAGE_ASTERISK_GUI=y +BR2_PACKAGE_PHONEPROV_TOOLS=y BR2_PACKAGE_DAHDI_LINUX=y BR2_PACKAGE_DAHDI_OSLEC=y BR2_PACKAGE_DAHDI_HFCS=y Modified: branches/1.0/astlinux18.config =================================================================== --- branches/1.0/astlinux18.config 2014-02-27 14:10:19 UTC (rev 6433) +++ branches/1.0/astlinux18.config 2014-03-05 21:36:15 UTC (rev 6434) @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Buildroot 2011.08-svn6405-dirty Configuration -# Fri Feb 7 15:08:28 2014 +# Buildroot 2011.08-svn6433-dirty Configuration +# Wed Mar 5 15:25:25 2014 # BR2_HAVE_DOT_CONFIG=y # BR2_arm is not set @@ -171,6 +171,7 @@ BR2_PACKAGE_ASTERISK_APP_NOTIFY=y BR2_PACKAGE_ASTERISK_FOP2=y BR2_PACKAGE_ASTERISK_GUI=y +BR2_PACKAGE_PHONEPROV_TOOLS=y BR2_PACKAGE_DAHDI_LINUX=y BR2_PACKAGE_DAHDI_OSLEC=y BR2_PACKAGE_DAHDI_HFCS=y Modified: branches/1.0/package/Config.in =================================================================== --- branches/1.0/package/Config.in 2014-02-27 14:10:19 UTC (rev 6433) +++ branches/1.0/package/Config.in 2014-03-05 21:36:15 UTC (rev 6434) @@ -9,6 +9,7 @@ source "package/asterisk-codec-silk/Config.in" source "package/asterisk-fop2/Config.in" source "package/asterisk-gui/Config.in" +source "package/phoneprov-tools/Config.in" source "package/dahdi-linux/Config.in" source "package/dahdi-tools/Config.in" source "package/fonulator/Config.in" Added: branches/1.0/package/phoneprov-tools/Config.in =================================================================== --- branches/1.0/package/phoneprov-tools/Config.in (rev 0) +++ branches/1.0/package/phoneprov-tools/Config.in 2014-03-05 21:36:15 UTC (rev 6434) @@ -0,0 +1,12 @@ +config BR2_PACKAGE_PHONEPROV_TOOLS + bool "phoneprov-tools" + depends on BR2_PACKAGE_ASTERISK + default n + help + A set of scripts and configuration templates designed to + generate IP Phone provisioning files as well as Asterisk + sip.conf and extensions.conf includes files. + + Lonnie Abelbeck and Michael Keuter + http://www.astlinux.org/ + Added: branches/1.0/package/phoneprov-tools/massdeployment.conf =================================================================== --- branches/1.0/package/phoneprov-tools/massdeployment.conf (rev 0) +++ branches/1.0/package/phoneprov-tools/massdeployment.conf 2014-03-05 21:36:15 UTC (rev 6434) @@ -0,0 +1,8 @@ +## +## Mass Deployment Data for IP Phones +## +## phone_model | mac_addr | extension[/CID_Name] | username | password +## +## Example: +## yealink 00:15:65:22:44:12 301/Front_Desk yealink_4412_301 supersecret +## Added: branches/1.0/package/phoneprov-tools/phoneprov-build =================================================================== --- branches/1.0/package/phoneprov-tools/phoneprov-build (rev 0) +++ branches/1.0/package/phoneprov-tools/phoneprov-build 2014-03-05 21:36:15 UTC (rev 6434) @@ -0,0 +1,277 @@ +#!/bin/sh + +. /etc/rc.conf + +usage() +{ + echo ' +Usage: phoneprov-build [options...] phone_model mac_addr extension[/CID_Name] username password + +Options: + -f, --force-overwrite Overwrite existing files + -h, --help Show this help text + -i, --if-name Interface Name: INTIF, INT2IF, INT3IF, EXTIF, defaults to INTIF +' + exit 1 +} + +find_ipv4_from_if() +{ + ip -o addr show dev "$1" \ + | awk '$3 == "inet" { split($4, field, "/"); print field[1]; nextfile; }' +} + +is_context() { + local context="$1" file="$2" + + grep -q "^\[${context}\]" "$file" +} + +extract_context() { + local context="$1" file="$2" match_ext + + # Properly match if '*' exists in the extension + match_ext="$(echo "$ext" | sed 's/*/\\*/g')" + + sed -n "/^\[${context}\]/,/^\[/ p" "$file" | sed -e 's/^\[.*//' -e "s/^#<${match_ext}>//" -e 's/^#.*//' -e '/^$/ d' +} + +extract_var() { + local var="$1" + + echo "$OPTIONS" | sed -n -r -e "s/^${var} *= *([^ ]*).*$/\1/p" +} + +exit_no_overwrite() { + local file="$1" + + if [ $force_overwrite -eq 0 -a -f "$file" ]; then + echo "phoneprov-build: File \"$file\" exists." >&2 + exit 2 + fi +} + +merge_variables() +{ + sed -e 's/^\\#/#/' \ + -e 's/^\\\[/\[/' \ + -e "s|@MODEL@|${model}|g" \ + -e "s|@VENDOR@|${vendor}|g" \ + -e "s|@MAC_ADDR@|${mac_addr}|g" \ + -e "s|@MAC@|${mac}|g" \ + -e "s|@EXT@|${ext}|g" \ + -e "s|@CID_NAME@|${cid_name}|g" \ + -e "s|@USERNAME@|${username}|g" \ + -e "s|@PASSWORD@|${password}|g" \ + -e "s|@SIP_SERVER_IPV4@|${sip_server_ipv4}|g" +} + +ARGS="$(getopt --name phoneprov-build \ + --long force-overwrite,help,if-name: \ + --options fhi: \ + -- "$@")" +if [ $? -ne 0 ]; then + usage +fi +eval set -- $ARGS + +force_overwrite=0 +if_name="INTIF" +while [ $# -gt 0 ]; do + case "$1" in + -f|--force-overwrite) force_overwrite=1 ;; + -h|--help) usage ;; + -i|--if-name) if_name="$2"; shift ;; + --) shift; break ;; + esac + shift +done + +model="$1" +mac_addr="$2" +ext="$(echo "$3" | cut -d'/' -f1)" +cid_name="$(echo "$3" | cut -s -d'/' -f2- | tr '_' ' ')" +username="$4" +password="$5" + +PHONEPROV_DIR="${PHONEPROV_BASE_DIR:-/mnt/kd/phoneprov}" +TEMPLATE_DIR="$PHONEPROV_DIR/templates" + +DIALPLAN_DIR="/mnt/kd/asterisk/includes" +SIP_DIR="/mnt/kd/asterisk/includes" + +case $if_name in + INTIF) + sip_server_if="$INTIF" + sip_server_ipv4="$INTIP" + ;; + INT2IF) + sip_server_if="$INT2IF" + sip_server_ipv4="$INT2IP" + ;; + INT3IF) + sip_server_if="$INT3IF" + sip_server_ipv4="$INT3IP" + ;; + EXTIF) + sip_server_if="$EXTIF" + sip_server_ipv4="$(find_ipv4_from_if $EXTIF)" + ;; + *) + usage + ;; +esac + +if [ -z "$mac_addr" -o -z "$ext" ]; then + usage +fi + +if [ -z "$cid_name" ]; then + cid_name="$ext" +fi + +case $mac_addr in + ??:??:??:??:??:??) + ;; + *) + echo "phoneprov-build: Invalid MAC address: $mac_addr" >&2 + exit 1 + ;; +esac +mac="$(echo "$mac_addr" | tr -d ':')" + +if [ ! -f "$TEMPLATE_DIR/$model.conf" ]; then + echo "phoneprov-build: Template file \"$TEMPLATE_DIR/$model.conf\" not found." >&2 + exit 1 +fi + +if ! is_context "general" "$TEMPLATE_DIR/$model.conf"; then + echo "phoneprov-build: No [general] context defined, invalid template file." >&2 + exit 1 +fi + +# Extract General Definitions +OPTIONS="$(extract_context "general" "$TEMPLATE_DIR/$model.conf")" + +macaddress_case="$(extract_var macaddress_case)" +case $macaddress_case in + upper) mac="$(echo "$mac" | tr '[:lower:]' '[:upper:]')" + ;; + lower) mac="$(echo "$mac" | tr '[:upper:]' '[:lower:]')" + ;; +esac +OPTIONS="$(echo "$OPTIONS" | merge_variables)" + +vendor="$(extract_var vendor)" +if [ -z "$vendor" ]; then + vendor="$model" +fi +prov_path="$(extract_var prov_path)" +if [ -z "$prov_path" ]; then + prov_path="$PHONEPROV_DIR/$vendor" +fi +prov_file="$(extract_var prov_file)" +if [ -z "$prov_file" ]; then + prov_file="$mac.cfg" +fi +dialplan_path="$(extract_var dialplan_path)" +if [ -z "$dialplan_path" ]; then + dialplan_path="$DIALPLAN_DIR" +fi +dialplan_file="$(extract_var dialplan_file)" +if [ -z "$dialplan_file" ]; then + dialplan_file="astlinux-phoneprov-exten.conf" +fi +dialplan_context="$(extract_var dialplan_context)" +sip_path="$(extract_var sip_path)" +if [ -z "$sip_path" ]; then + sip_path="$SIP_DIR" +fi +sip_file="$(extract_var sip_file)" +if [ -z "$sip_file" ]; then + sip_file="astlinux-phoneprov-sip.conf" +fi + +# Special case to initialize dialplan and sip output files +if [ "$ext" = "init" -o "$ext" = "init-dialplan" -o "$ext" = "init-sip" ]; then + if [ "$ext" = "init" -o "$ext" = "init-dialplan" ]; then + if is_context "dialplan" "$TEMPLATE_DIR/$model.conf"; then + exit_no_overwrite "$dialplan_path/$dialplan_file" + echo "; +; #################################################### +; ### AstLinux auto-provisioned IP-Phone dialplan #### +; #################################################### +; +; Include in your extensions.conf file by using: +; #include $dialplan_path/$dialplan_file +${dialplan_context:+ +[$dialplan_context]} +" > "$dialplan_path/$dialplan_file" + fi + fi + if [ "$ext" = "init" -o "$ext" = "init-sip" ]; then + if is_context "sip" "$TEMPLATE_DIR/$model.conf"; then + exit_no_overwrite "$sip_path/$sip_file" + echo "; +; ############################################################## +; ### AstLinux auto-provisioned IP-Phone SIP configurations #### +; ############################################################## +; +; Include in your sip.conf file by using: +; #include $sip_path/$sip_file + +" > "$sip_path/$sip_file" + fi + fi + exit 0 +fi + +if [ -z "$username" ]; then + echo "phoneprov-build: no username defined." >&2 + exit 3 +fi +if [ -z "$password" ]; then + echo "phoneprov-build: no password defined." >&2 + exit 3 +fi + +is_context_dialplan=0 +if is_context "dialplan" "$TEMPLATE_DIR/$model.conf"; then + is_context_dialplan=1 +fi +is_context_sip=0 +if is_context "sip" "$TEMPLATE_DIR/$model.conf"; then + is_context_sip=1 +fi +is_context_phoneprov=0 +if is_context "phoneprov" "$TEMPLATE_DIR/$model.conf"; then + exit_no_overwrite "$prov_path/$prov_file" + is_context_phoneprov=1 +fi + +if [ $is_context_dialplan -eq 1 ]; then + if [ ! -d "$dialplan_path" ]; then + mkdir -p "$dialplan_path" + fi + extract_context "dialplan" "$TEMPLATE_DIR/$model.conf" | \ + merge_variables >> "$dialplan_path/$dialplan_file" +fi + +if [ $is_context_sip -eq 1 ]; then + if [ ! -d "$sip_path" ]; then + mkdir -p "$sip_path" + fi + extract_context "sip" "$TEMPLATE_DIR/$model.conf" | \ + merge_variables >> "$sip_path/$sip_file" + # Add an empty line + echo "" >> "$sip_path/$sip_file" +fi + +if [ $is_context_phoneprov -eq 1 ]; then + if [ ! -d "$prov_path" ]; then + mkdir -p "$prov_path" + fi + extract_context "phoneprov" "$TEMPLATE_DIR/$model.conf" | \ + merge_variables > "$prov_path/$prov_file" +fi + Property changes on: branches/1.0/package/phoneprov-tools/phoneprov-build ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: branches/1.0/package/phoneprov-tools/phoneprov-massdeployment =================================================================== --- branches/1.0/package/phoneprov-tools/phoneprov-massdeployment (rev 0) +++ branches/1.0/package/phoneprov-tools/phoneprov-massdeployment 2014-03-05 21:36:15 UTC (rev 6434) @@ -0,0 +1,180 @@ +#!/bin/sh +## +## Mass Deployment of IP Phones +## + +usage() +{ + echo ' +Usage: phoneprov-massdeployment [options...] in_file + +Options: + -a, --auto-user-pass Automatically generate missing username/password(s) + -A, --only-user-pass Same as "-a, --auto-user-pass" without further processing + -f, --force-overwrite Overwrite existing files + -h, --help Show this help text + -i, --if-name Interface Name: INTIF, INT2IF, INT3IF, EXTIF, defaults to INTIF + -p, --partial Partial input, append "dialplan" and "sip" entries to existing +' + exit 1 +} + +error_info() { + local result="$1" + + if [ $result -eq 2 ]; then + echo "phoneprov-massdeployment: Use -f or --force-overwrite option to overwrite." + echo "Files left unchanged." + elif [ $result -eq 3 ]; then + echo "phoneprov-massdeployment: Use -a or --auto-user-pass option to automatically" + echo " generate any missing username/password(s)." + fi +} + +extract_file() { + local file="$1" + + cat "$file" | sed -e 's/[#;].*//' -e 's/ *$//' -e '/^$/d' +} + +init_args() { + local args="$1" model + + model="$(echo "$args" | awk -F' ' '{ print $1; }')" + + echo "$model 00:00:00:00:00:00 init" +} + +gen_user_pass() { + local data="$1" model mac_addr ext_cid ext user pass + + model="$(echo "$data" | awk -F' ' '{ print $1; }')" + mac_addr="$(echo "$data" | awk -F' ' '{ print $2; }')" + ext_cid="$(echo "$data" | awk -F' ' '{ print $3; }')" + user="$(echo "$data" | awk -F' ' '{ print $4; }')" + pass="$(echo "$data" | awk -F' ' '{ print $5; }')" + + ext="$(echo "$ext_cid" | cut -d'/' -f1)" + + if [ -n "$model" -a -n "$mac_addr" -a -n "$ext" ]; then + if [ -z "$user" -o -z "$pass" ]; then + if [ -z "$user" ]; then + user="${model}_$(echo "$mac_addr" | cut -d':' -f5)$(echo "$mac_addr" | cut -d':' -f6)_${ext}" + fi + if [ -z "$pass" ]; then + pass="$(openssl rand -base64 12)" + fi + # Properly match if '*' exists in the extension/cid + ext_cid="$(echo "$ext_cid" | sed 's/*/\\*/g')" + + sed -i -e "s|^${model} *${mac_addr} *${ext_cid}.*$|${model} ${mac_addr} ${ext_cid} ${user} ${pass}|" "$in_file" + fi + fi +} + +ARGS="$(getopt --name phoneprov-massdeployment \ + --long auto-user-pass,only-user-pass,force-overwrite,help,if-name:,partial \ + --options aAfhi:p \ + -- "$@")" +if [ $? -ne 0 ]; then + usage +fi +eval set -- $ARGS + +auto_user_pass=0 +only_user_pass=0 +force_overwrite=0 +partial=0 +if_name="INTIF" +while [ $# -gt 0 ]; do + case "$1" in + -a|--auto-user-pass) auto_user_pass=1 ;; + -A|--only-user-pass) auto_user_pass=1 ; only_user_pass=1 ;; + -f|--force-overwrite) force_overwrite=1 ;; + -h|--help) usage ;; + -i|--if-name) if_name="$2"; shift ;; + -p|--partial) partial=1 ;; + --) shift; break ;; + esac + shift +done +in_file="$1" + +if [ -z "$in_file" -o "$in_file" = "--" ]; then + usage +fi +if [ ! -f "$in_file" ]; then + echo "phoneprov-massdeployment: file not found: $in_file" >&2 + exit 1 +fi + +if [ $auto_user_pass -eq 1 ]; then + echo "Auto-generating username/password(s):" + + temp_file="$(mktemp "${in_file}.XXXXXX")" + cp "$in_file" "$temp_file" + + IFS=$'\n' + extract_file "$temp_file" | while read data; do + unset IFS + gen_user_pass "$data" + done + unset IFS + + if cmp -s "$temp_file" "$in_file"; then + echo "No missing username/password(s), input file left unchanged." + else + echo "Missing username/password(s) were added to input file." + fi + rm "$temp_file" + + if [ $only_user_pass -eq 1 ]; then + exit 0 + fi +fi + +options="" +if [ $force_overwrite -eq 1 ]; then + options="$options${options:+ }-f" +fi +if [ -n "$if_name" ]; then + options="$options${options:+ }-i $if_name" +fi + +echo "Generating Phone Provisioning files:" + +if [ $partial -eq 1 ]; then + first=0 +else + first=1 +fi +IFS=$'\n' +extract_file "$in_file" | while read data; do + unset IFS + if [ $first -eq 1 ]; then + phoneprov-build $options $(init_args $data) + result=$? + if [ $result -ne 0 ]; then + error_info $result + exit $result + fi + first=0 + fi + phoneprov-build $options $data + result=$? + if [ $result -ne 0 ]; then + error_info $result + exit $result + fi + printf "." +done +result=$? +unset IFS + +if [ $result -ne 0 ]; then + exit $result +fi + +echo "Done" +exit 0 + Property changes on: branches/1.0/package/phoneprov-tools/phoneprov-massdeployment ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: branches/1.0/package/phoneprov-tools/phoneprov-tools.mk =================================================================== --- branches/1.0/package/phoneprov-tools/phoneprov-tools.mk (rev 0) +++ branches/1.0/package/phoneprov-tools/phoneprov-tools.mk 2014-03-05 21:36:15 UTC (rev 6434) @@ -0,0 +1,27 @@ +############################################################# +# +# phoneprov-tools +# +############################################################# + +# source included in package +PHONEPROV_TOOLS_SOURCE = + +define PHONEPROV_TOOLS_BUILD_CMDS + # No build needed +endef + +define PHONEPROV_TOOLS_INSTALL_TARGET_CMDS + install -D -m 755 package/phoneprov-tools/phoneprov-build $(TARGET_DIR)/usr/sbin/ + install -D -m 755 package/phoneprov-tools/phoneprov-massdeployment $(TARGET_DIR)/usr/sbin/ + install -D -m 644 package/phoneprov-tools/massdeployment.conf $(TARGET_DIR)/stat/etc/phoneprov/massdeployment.conf + rsync -a --exclude=".svn" package/phoneprov-tools/templates/ $(TARGET_DIR)/stat/etc/phoneprov/templates/ +endef + +define PHONEPROV_TOOLS_UNINSTALL_TARGET_CMDS + rm -f $(TARGET_DIR)/usr/sbin/phoneprov-build + rm -f $(TARGET_DIR)/usr/sbin/phoneprov-massdeployment + rm -rf $(TARGET_DIR)/stat/etc/phoneprov +endef + +$(eval $(call GENTARGETS,package,phoneprov-tools)) Added: branches/1.0/package/phoneprov-tools/templates/snom320.conf =================================================================== --- branches/1.0/package/phoneprov-tools/templates/snom320.conf (rev 0) +++ branches/1.0/package/phoneprov-tools/templates/snom320.conf 2014-03-05 21:36:15 UTC (rev 6434) @@ -0,0 +1,56 @@ +# AstLinux provisioning template +# for snom 320 +menu_name=snom 320 + +# General Definitions +[general] +vendor=snom +#prov_path=/mnt/kd/phoneprov/snom +prov_file=@MODEL@-@MAC@.htm +macaddress_case=upper + +#dialplan_path=/mnt/kd/asterisk/includes +dialplan_file=astlinux-phoneprov-exten.conf +#dialplan_context=provisioned-phones + +#sip_path=/mnt/kd/asterisk/includes +sip_file=astlinux-phoneprov-sip.conf + +# Dialplan File entries +[dialplan] +exten => @EXT@,1,Dial(SIP/@USERNAME@) + +# SIP File entries +[sip] +; @EXT@ / @MAC_ADDR@ / @MODEL@ +\[@USERNAME@] +type=friend +host=dynamic +context=internal-phones +secret=@PASSWORD@ +defaultuser=@USERNAME@ +callerid="@CID_NAME@" <@EXT@> +mailbox=@EXT@@default +qualify=no +directmedia=no +dtmfmode=rfc2833 +disallow=all +allow=ulaw +;allow=g722 + +# Provision File entries +[phoneprov] +<?xml version="1.0" encoding="utf-8"?> +<settings> +<phone-settings> +<user_realname idx="1" perm="">@EXT@</user_realname> +<user_name idx="1" perm="">@USERNAME@</user_name> +<user_pname idx="1" perm="">@USERNAME@</user_pname> +<user_pass idx="1" perm="">@PASSWORD@</user_pass> +<user_host idx="1" perm="">@SIP_SERVER_IPV4@</user_host> +<user_outbound idx="1" perm="">@SIP_SERVER_IPV4@</user_outbound> +<user_server_type idx="1" perm="">asterisk</user_server_type> +<phone_name perm="">@VENDOR@-@EXT@</phone_name> +</phone-settings> +</settings> + Added: branches/1.0/package/phoneprov-tools/templates/spa942.conf =================================================================== --- branches/1.0/package/phoneprov-tools/templates/spa942.conf (rev 0) +++ branches/1.0/package/phoneprov-tools/templates/spa942.conf 2014-03-05 21:36:15 UTC (rev 6434) @@ -0,0 +1,197 @@ +# AstLinux provisioning template +# for Cisco/Linksys SPA942 +menu_name=Cisco/Linksys SPA942 + +# General Definitions +[general] +vendor=linksys +prov_path=/mnt/kd/tftpboot/linksys +prov_file=@EXT@.xml +macaddress_case=lower + +#dialplan_path=/mnt/kd/asterisk/includes +dialplan_file=astlinux-phoneprov-exten.conf +#dialplan_context=provisioned-phones + +#sip_path=/mnt/kd/asterisk/includes +sip_file=astlinux-phoneprov-sip.conf + +# Dialplan File entries +[dialplan] +exten => @EXT@,1,Dial(SIP/@USERNAME@) + +# SIP File entries +[sip] +; @EXT@ / @MAC_ADDR@ / @MODEL@ +\[@USERNAME@] +type=friend +#host=dynamic +#<1010>host=10.10.20.20 +#<1011>host=10.10.20.21 +#<1012>host=10.10.20.22 +#<1013>host=10.10.20.23 +#<1014>host=10.10.20.24 +#<1015>host=10.10.20.25 +#<1016>host=10.10.20.26 +#<1017>host=10.10.20.27 +#<1018>host=10.10.20.28 +#<1019>host=10.10.20.29 +context=internal-phones +secret=@PASSWORD@ +defaultuser=@USERNAME@ +callerid="@CID_NAME@" <@EXT@> +mailbox=@EXT@@default +qualify=0 +directmedia=no +dtmfmode=info +disallow=all +allow=ulaw + +# Phone Provision File entries +[phoneprov] +<flat-profile> + <Provision_Enable ua="na"> No + </Provision_Enable> + + <Primary_NTP_Server ua="na"> @SIP_SERVER_IPV4@ + </Primary_NTP_Server> + <Time_Zone ua="na"> GMT-06:00 + </Time_Zone> + <Daylight_Saving_Time_Rule ua="na"> start=3/8/7/2:0:0;end=11/1/7/2:0:0;save=1 + </Daylight_Saving_Time_Rule> + + <Enable_CDP ua="na"> No + </Enable_CDP> + + <RTP_Packet_Size ua="na"> 0.020 + </RTP_Packet_Size> + + <Symmetric_RTP ua="na"> No + </Symmetric_RTP> + + <Reorder_Delay ua="na"> 255 + </Reorder_Delay> + + <Handset_Input_Gain ua="na"> 0 + </Handset_Input_Gain> + <Headset_Input_Gain ua="na"> 0 + </Headset_Input_Gain> + + <Default_Ring__1__ ua="na"> 10 + </Default_Ring__1__> + <Default_Ring__2__ ua="na"> 10 + </Default_Ring__2__> + <Default_Ring__3__ ua="na"> 10 + </Default_Ring__3__> + <Default_Ring__4__ ua="na"> 10 + </Default_Ring__4__> + + <Line_Enable_1_ ua="na"> Yes + </Line_Enable_1_> + <SIP_Port_1_ ua="na"> 5060 + </SIP_Port_1_> + <Proxy_1_ ua="na"> @SIP_SERVER_IPV4@ + </Proxy_1_> + <Register_1_ ua="na"> No + </Register_1_> + <Make_Call_Without_Reg_1_ ua="na"> Yes + </Make_Call_Without_Reg_1_> + <Ans_Call_Without_Reg_1_ ua="na"> Yes + </Ans_Call_Without_Reg_1_> + <Preferred_Codec_1_ ua="na"> G711u + </Preferred_Codec_1_> + <Use_Pref_Codec_Only_1_ ua="na"> Yes + </Use_Pref_Codec_Only_1_> + <DTMF_Process_AVT_1_ ua="na"> No + </DTMF_Process_AVT_1_> + <Silence_Supp_Enable_1_ ua="na"> No + </Silence_Supp_Enable_1_> + <DTMF_Tx_Method_1_ ua="na"> INFO + </DTMF_Tx_Method_1_> + <Dial_Plan_1_ ua="na"> (00,xx.|911S0|[3-6]11S0|1[01]xxS0|[2-9]xxxxxxxxxS0|1[2-9]xxxxxxxxxS0|0[12][2-9]xxxxxxxxxS0) + </Dial_Plan_1_> + <Enable_IP_Dialing_1_ ua="na"> No + </Enable_IP_Dialing_1_> + + <Line_Enable_2_ ua="na"> No + </Line_Enable_2_> + <SIP_Port_2_ ua="na"> 5061 + </SIP_Port_2_> + <Proxy_2_ ua="na"> @SIP_SERVER_IPV4@ + </Proxy_2_> + <Register_2_ ua="na"> No + </Register_2_> + <Make_Call_Without_Reg_2_ ua="na"> Yes + </Make_Call_Without_Reg_2_> + <Ans_Call_Without_Reg_2_ ua="na"> Yes + </Ans_Call_Without_Reg_2_> + <Preferred_Codec_2_ ua="na"> G711u + </Preferred_Codec_2_> + <Use_Pref_Codec_Only_2_ ua="na"> Yes + </Use_Pref_Codec_Only_2_> + <DTMF_Process_AVT_2_ ua="na"> No + </DTMF_Process_AVT_2_> + <Silence_Supp_Enable_2_ ua="na"> No + </Silence_Supp_Enable_2_> + <DTMF_Tx_Method_2_ ua="na"> INFO + </DTMF_Tx_Method_2_> + <Dial_Plan_2_ ua="na"> (00,xx.|911S0|[3-6]11S0|1[01]xxS0|[2-9]xxxxxxxxxS0|1[2-9]xxxxxxxxxS0|0[12][2-9]xxxxxxxxxS0) + </Dial_Plan_2_> + <Enable_IP_Dialing_2_ ua="na"> No + </Enable_IP_Dialing_2_> + + <Line_Enable_3_ ua="na"> No + </Line_Enable_3_> + <SIP_Port_3_ ua="na"> 5062 + </SIP_Port_3_> + <Proxy_3_ ua="na"> @SIP_SERVER_IPV4@ + </Proxy_3_> + <Register_3_ ua="na"> No + </Register_3_> + + <Line_Enable_4_ ua="na"> No + </Line_Enable_4_> + <SIP_Port_4_ ua="na"> 5063 + </SIP_Port_4_> + <Proxy_4_ ua="na"> @SIP_SERVER_IPV4@ + </Proxy_4_> + <Register_4_ ua="na"> No + </Register_4_> + + <Speaker_Volume ua="na"> 10 + </Speaker_Volume> + + <Handset_Volume ua="na"> 10 + </Handset_Volume> + + <Headset_Volume ua="na"> 10 + </Headset_Volume> + + <Station_Name ua="na"> @CID_NAME@ + </Station_Name> + <Voice_Mail_Number ua="na"> @EXT@ + </Voice_Mail_Number> + <Text_Logo ua="na"> + </Text_Logo> + + <Display_Name_1_ ua="na"> @CID_NAME@ + </Display_Name_1_> + <User_ID_1_ ua="na"> @EXT@ + </User_ID_1_> + <Password_1_ ua="na"> @PASSWORD@ + </Password_1_> + + <Speakerphone_Input_Gain ua="na"> -6 + </Speakerphone_Input_Gain> + + <Ringer_Volume ua="na"> 6 + </Ringer_Volume> + + <Back_Light_Timer ua="na"> 30 s + </Back_Light_Timer> + <LCD_Contrast ua="na"> 4 + </LCD_Contrast> + + <Miss_Call_Shortcut ua="na"> Yes + </Miss_Call_Shortcut> +</flat-profile> Added: branches/1.0/package/phoneprov-tools/templates/yealink.conf =================================================================== --- branches/1.0/package/phoneprov-tools/templates/yealink.conf (rev 0) +++ branches/1.0/package/phoneprov-tools/templates/yealink.conf 2014-03-05 21:36:15 UTC (rev 6434) @@ -0,0 +1,55 @@ +# AstLinux provisioning template +# for Yealink T2x, T3x models (with firmware 70) +menu_name=Yealink T2x, T3x (FW 70) + +# General Definitions +[general] +vendor=yealink +#prov_path=/mnt/kd/phoneprov/yealink +prov_file=@MAC@.cfg +macaddress_case=lower + +#dialplan_path=/mnt/kd/asterisk/includes +dialplan_file=astlinux-phoneprov-exten.conf +#dialplan_context=provisioned-phones + +#sip_path=/mnt/kd/asterisk/includes +sip_file=astlinux-phoneprov-sip.conf + +# Dialplan File entries +[dialplan] +exten => @EXT@,1,Dial(SIP/@USERNAME@) + +# SIP File entries +[sip] +; @EXT@ / @MAC_ADDR@ / @MODEL@ +\[@USERNAME@] +type=friend +host=dynamic +context=internal-phones +secret=@PASSWORD@ +defaultuser=@USERNAME@ +callerid="@CID_NAME@" <@EXT@> +mailbox=@EXT@@default +qualify=0 +directmedia=no +dtmfmode=rfc2833 +disallow=all +allow=ulaw +;allow=g722 + +# Phone Provision File entries +[phoneprov] +\#!version:1.0.0.1 + +account.1.enable=1 +account.1.label=@EXT@ +account.1.auth_name=@USERNAME@ +account.1.user_name=@USERNAME@ +account.1.password=@PASSWORD@ +account.1.sip_server.1.address=@SIP_SERVER_IPV4@ +account.1.sip_server1.port=5060 + +security.trust_certificates=0 +network.dhcp_host_name=@VENDOR@-@EXT@ + Modified: branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf =================================================================== --- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2014-02-27 14:10:19 UTC (rev 6433) +++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2014-03-05 21:36:15 UTC (rev 6434) @@ -337,6 +337,9 @@ ## The default is to allow all IP's, PHONEPROV_ALLOW="*" ## Example: PHONEPROV_ALLOW="10.10.10.* 2001:db8:1:* 192.168.101.20" #PHONEPROV_ALLOW="*" +## +## Default base directory for phoneprov-tools scripts, default is "/mnt/kd/phoneprov" +#PHONEPROV_BASE_DIR="/mnt/kd/phoneprov" ## NTPd Server ## Note: also see NTPSERVS in the "General Configuration" section. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |