mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
script optimization Voice parameters: AddObject/DeleteObject Voice parameters: Vendor specific parameter Concerning what we did in the optimization task: 1) The main script (freecwmp) is loaded only 1 time during the session. the load is done just before the start of the session. the function scripts are loaded within the load of the main script (freecwmp) only one time. The old behaviour consist to load the main script (freecwmp) and the function scripts for each parameter treatment. Core code (C) and Scripts are changed 2) Optimize the preparing of inform message. old script take ~30s and now it takes ~2s. Core code (C) and Scripts are changed 3) Execute only the function related to the parameter. For example if the requested parameter is "InternetGatewayDevice.ManagementServer.URL" then the main script freecwmp will execute only the related function of this parameter which is get_management_server(). The old behaviour consist to execute all get functions: get_wan_device(), get_lan_device(), get_device_info()... 4) Minimize the size of the script files: Replace some blocks o othe source code by a functions
3675 lines
135 KiB
Bash
3675 lines
135 KiB
Bash
#!/bin/sh
|
|
# Copyright (C) 2012 Luka Perkov <freecwmp@lukaperkov.net>
|
|
# Copyright (C) 2013 Inteno Broadband Technology AB
|
|
# Author Ahmed Zribi <ahmed.zribi@pivasoftware.com>
|
|
|
|
get_set_voice_service_parameter() {
|
|
local parameter="$1"
|
|
local function="$2"
|
|
local partial_parameter_name="$3"
|
|
local args="$4"
|
|
local value="$5"
|
|
|
|
freecwmp_parse_formated_parameter "$parameter" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.$partial_parameter_name" "rc" "num"
|
|
if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $args ]; then
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
$function $sip_id $value
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
}
|
|
|
|
get_set_line_parameter() {
|
|
local parameter="$1"
|
|
local function="$2"
|
|
local partial_parameter_name="$3"
|
|
local args="$4"
|
|
local value="$5"
|
|
|
|
freecwmp_parse_formated_parameter "$parameter" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.$partial_parameter_name" "rc" "num"
|
|
if [ $rc -eq 0 ]; then
|
|
local profile_num=`echo $num | awk '{ print $1 }'`
|
|
local line_number=`echo $num | awk '{ print $2 }'`
|
|
let sip_id=$profile_num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $profile_num`
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$line_number" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
|
|
if [ $profile_num -gt 0 ] && [ $profile_num -le $args ]; then
|
|
# Line
|
|
local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1`
|
|
let profile_num=$profile_num-1
|
|
if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then
|
|
local count=0
|
|
local found=0
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
let p_instance=$profile_num+1
|
|
count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -f$p_instance -d:`
|
|
if [ "$count" = "$line_number" ];then
|
|
found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$found" = "1" ];then
|
|
$function $profile_num $line_name $value
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
}
|
|
|
|
voice_service_save_instance_config() {
|
|
local i="$1" #line number
|
|
local j="$2" #line profile
|
|
local k="$3" #profile number
|
|
local line_name="$4"
|
|
local instances=""
|
|
t=1
|
|
while [ $t -lt $j ];do
|
|
if [ "$instances" != "" ];then
|
|
instances=$instances:"0"
|
|
else
|
|
instances="0"
|
|
fi
|
|
let t++
|
|
done
|
|
if [ "$instances" != "" ];then
|
|
instances=$instances:"$i"
|
|
else
|
|
instances="$i"
|
|
fi
|
|
while [ $t -lt $k ];do
|
|
instances=$instances:"0"
|
|
let t++
|
|
done
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line_name.instances="$instances"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit
|
|
}
|
|
|
|
load_voice() {
|
|
local max_profile_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sort -u|sed 's/sip//g'|tail -1`
|
|
let max_profile_number++
|
|
for sip in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sort -u`;do
|
|
sip_number=`echo $sip|sed 's/sip//g'`
|
|
let profile_number=$sip_number+1
|
|
# Line
|
|
local line_number="0"
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$sip_number|awk -F '.' '{print$2}'`;do
|
|
let line_number++
|
|
if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances`" = "" ];then
|
|
voice_service_save_instance_config "$line_number" "$profile_number" "$max_profile_number" "$line_name"
|
|
else
|
|
local instances=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances`
|
|
length=`echo $instances|tr -d -c [0-9] |wc -c`
|
|
new_length=`get_voice_profile_max_instance`
|
|
for r in `seq $length $new_length`;do
|
|
instances=$instances:0
|
|
done
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line_name.instances="$instances"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit
|
|
instances=""
|
|
fi
|
|
done
|
|
done
|
|
}
|
|
|
|
# under InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.
|
|
|
|
get_voice_profile_enable() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.enabled`
|
|
let num=$num+1
|
|
if [ "$val" = "0" ]; then
|
|
val="Disabled"
|
|
else
|
|
val="Enabled"
|
|
fi
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Enable" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Enable" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Enable"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Enable" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_voice_profile_enable() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
if [ "$val" = "Enabled" ]; then
|
|
val="1"
|
|
else
|
|
val="0"
|
|
fi
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.enabled="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Enable"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_voice_profile_reset() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:boolean"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val="0"
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Reset" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Reset" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Reset"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Reset" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_voice_profile_reset() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
if [ "$val" = "1" ];then
|
|
/etc/init.d/asterisk reload
|
|
fi
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Reset"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_voice_profile_name() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num._title`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Name" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="0"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Name" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Name"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Name" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_voice_profile_name() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num._title="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Name"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_voice_profile_signaling_protocol() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val="SIP"
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SignalingProtocol" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SignalingProtocol" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SignalingProtocol"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SignalingProtocol" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_voice_profile_signaling_protocol() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SignalingProtocol"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_voice_profile_max_sessions() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
number_line=`/usr/sbin/asterisk -rx "brcm show status"|grep "Subchannel:"|sort -u|wc -l`
|
|
sub_channel=`/usr/sbin/asterisk -rx "brcm show status"|grep -c "Default context : sip$num"`
|
|
let val=$number_line*$sub_channel
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.MaxSessions" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="0"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.MaxSessions" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.MaxSessions"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.MaxSessions" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_voice_profile_number_of_lines() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/usr/sbin/asterisk -rx "brcm show status"|grep -c "Default context : sip$num"`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.NumberOfLines" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="0"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.NumberOfLines" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.NumberOfLines"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.NumberOfLines" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
#under InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP.
|
|
|
|
get_sip_proxy_server() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.SIP.sip_proxy`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServer" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServer" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServer"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServer" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_proxy_server() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.SIP.sip_proxy="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServer"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_proxy_server_port() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=""
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerPort" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerPort" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerPort"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerPort" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_proxy_server_port() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerPort"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_proxy_server_transport() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/usr/sbin/asterisk -rx "sip show settings"|grep "Outbound transport"|awk -F' ' '{print $3}'`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerTransport" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerTransport" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerTransport"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerTransport" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_proxy_server_transport() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ProxyServerTransport"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_registrar_server() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.host`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServer" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServer" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServer"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServer" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_registrar_server() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.host="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServer"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_registrar_server_port() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.port`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerPort" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerPort" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerPort"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerPort" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_registrar_server_port() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.port="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerPort"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_registrar_server_transport() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/usr/sbin/asterisk -rx "sip show settings"|grep "Outbound transport"|awk -F' ' '{print $3}'`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerTransport" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerTransport" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerTransport"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerTransport" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_registrar_server_transport() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrarServerTransport"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_user_agent_domain() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.domain`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentDomain" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentDomain" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentDomain"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentDomain" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_user_agent_domain() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.domain="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentDomain"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_user_agent_port() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.SIP.bindport`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentPort" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentPort" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentPort"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentPort" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_user_agent_port() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.SIP.bindport="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentPort"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_user_agent_transport() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/usr/sbin/asterisk -rx "sip show settings"|grep "Allowed transports"|awk -F' ' '{print $3}'`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentTransport" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentTransport" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentTransport"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentTransport" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_user_agent_transport() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.UserAgentTransport"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_outbound_proxy() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.outboundproxy`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxy" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxy" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxy"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxy" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_outbound_proxy() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.outboundproxy="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxy"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_outbound_proxy_port() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.outboundport`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxyPort" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxyPort" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxyPort"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxyPort" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_outbound_proxy_port() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.outboundport="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.OutboundProxyPort"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_organization() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=""
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.Organization" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.Organization" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.Organization"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.Organization" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_organization() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.Organization"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_registration_period() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.SIP.registertimeout`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrationPeriod" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrationPeriod" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrationPeriod"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrationPeriod" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_registration_period() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.SIP.registertimeout="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistrationPeriod"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_invite_expires() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=""
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InviteExpires" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InviteExpires" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InviteExpires"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InviteExpires" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_invite_expires() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InviteExpires"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_re_invite_expires() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.SIP.registertimeout`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ReInviteExpires" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ReInviteExpires" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ReInviteExpires"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ReInviteExpires" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_re_invite_expires() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.SIP.registertimeout="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.ReInviteExpires"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_register_expires() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.SIP.registertimeout`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterExpires" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterExpires" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterExpires"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterExpires" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_register_expires() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.SIP.registertimeout="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterExpires"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_registers_min_expires() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=""
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistersMinExpires" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistersMinExpires" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistersMinExpires"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistersMinExpires" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_registers_min_expires() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegistersMinExpires"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_register_retry_interval() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.SIP.registertimeout`
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterRetryInterval" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterRetryInterval" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterRetryInterval"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterRetryInterval" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_register_retry_interval() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.SIP.registertimeout="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.RegisterRetryInterval"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_inbound_auth() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
# Digest
|
|
val="None"
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuth" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuth" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuth"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuth" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_inbound_auth() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuth"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_inbound_auth_username() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=""
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthUsername" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthUsername" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthUsername"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthUsername" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_inbound_auth_username() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthUsername"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_sip_inbound_auth_password() {
|
|
local num="$1"
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=""
|
|
let num=$num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthPassword" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthPassword" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthPassword"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthPassword" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_sip_inbound_auth_password() {
|
|
local num="$1"
|
|
local val="$2"
|
|
case $action in
|
|
set_value)
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.SIP.InboundAuthPassword"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
#under InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.
|
|
|
|
get_line_enable() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local line_num=""
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.enabled 2> /dev/null`
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
if [ "$val" = "0" ]; then
|
|
val="Disabled"
|
|
else
|
|
val="Enabled"
|
|
fi
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Enable" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Enable" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Enable"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Enable" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_line_enable() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local val="$3"
|
|
local line_num=""
|
|
case $action in
|
|
set_value)
|
|
if [ "$val" = "Enabled" ]; then
|
|
val="1"
|
|
else
|
|
val="0"
|
|
fi
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.enabled="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Enable"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_line_directory_number() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local line_num=""
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.extension`
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_line_directory_number() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local val="$3"
|
|
local line_num=""
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line_name.extension="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.DirectoryNumber"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_line_status() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local line_num=""
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val1="/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q -P /var/state get asterisk.sip$num.sip_registry_registered"
|
|
val2="/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q -P /var/state get asterisk.sip$num.sip_registry_request_sent"
|
|
if [ "$val1" = "yes" ];then
|
|
val="Up"
|
|
else
|
|
if [ "$val2" = "yes" ];then
|
|
val="Registering"
|
|
else
|
|
val="Disabled"
|
|
fi
|
|
fi
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Status" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
permissions="0"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Status" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Status"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.Status" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_line_call_state() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local line_num=""
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
state=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -P /var/state -q get chan_brcm.$line_name.subchannel_0`
|
|
if [ "$state" = "ONHOOK" ];then
|
|
val="Idle"
|
|
elif [ "$state" = "OFFHOOK" ];then
|
|
val="Disconnecting"
|
|
elif [ "$state" = "DIALING" ];then
|
|
val="Calling"
|
|
elif [ "$state" = "INCALL" ];then
|
|
val="InCall"
|
|
elif [ "$state" = "RINGING" ];then
|
|
val="Ringing"
|
|
fi
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallState" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
permissions="0"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallState" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallState"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallState" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_line_calling_features_caller_id_name() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local line_num=""
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.displayname`
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_line_calling_features_caller_id_name() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local val="$3"
|
|
local line_num=""
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.displayname="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.CallingFeatures.CallerIDName"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_line_x_002207_line_profile() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local line_num=""
|
|
local val=""
|
|
local type="xsd:unsignedInt"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
val=$num
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile" "$val" "$permissions"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_line_x_002207_line_profile() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local val="$3"
|
|
local line_num=""
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
delete_line $line_name
|
|
i=`echo $line_name|sed 's/brcm//g'`
|
|
let sip_id=$val-1
|
|
add_line "$i" "$sip_id"
|
|
instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -f $val -d :`
|
|
if [ "$instance" = "0" ];then
|
|
max_line_instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep instances|sort -u|cut -f $val -d :|grep -v 0|tail -1`
|
|
let instance=$max_line_instance+1
|
|
local j=0
|
|
for k in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|sed 's/:/ /g'`;do
|
|
let j++
|
|
if [ "$j" != "$val" ];then
|
|
if [ "$instances" = "" ];then
|
|
instances=$k
|
|
else
|
|
instances=$instances:$k
|
|
fi
|
|
else
|
|
if [ "$instances" = "" ];then
|
|
instances=$instance
|
|
else
|
|
instances=$instances:$instance
|
|
fi
|
|
fi
|
|
done
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line_name.instances="$instances"
|
|
fi
|
|
call_lines=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id.call_lines`
|
|
if [ "$call_lines" != "" ];then
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$call_lines $i"
|
|
else
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$i"
|
|
fi
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.X_002207_LineProfile"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
#under InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP.
|
|
|
|
get_line_sip_username() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local line_num=""
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.authuser 2> /dev/null`
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_line_sip_username() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local val="$3"
|
|
local line_num=""
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.authuser="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthUserName"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_line_sip_password() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local line_num=""
|
|
local val=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.secret 2> /dev/null`
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword" "$val" "$permissions" "$type"
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_line_sip_password() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local val="$3"
|
|
local line_num=""
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.secret="$val"
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.AuthPassword"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
get_line_sip_uri() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local line_num=""
|
|
local val=""
|
|
local domain=""
|
|
local username=""
|
|
local type="xsd:string"
|
|
local permissions=""
|
|
case "$action" in
|
|
get_value)
|
|
domain=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.domain 2> /dev/null`
|
|
username=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$num.user 2> /dev/null`
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
if [ "$domain" != "" -a "$username" != "" ];then
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI" "$username@$domain" "$permissions" "$type"
|
|
else
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI" "" "$permissions" "$type"
|
|
fi
|
|
;;
|
|
get_name)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
permissions="1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI" "$val" "$permissions" "$type"
|
|
;;
|
|
get_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_get_parameter_notification "val" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
set_line_sip_uri() {
|
|
local num="$1"
|
|
local line_name="$2"
|
|
local val="$3"
|
|
local line_num=""
|
|
case $action in
|
|
set_value)
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
local authuser=${val%@*}
|
|
local domain=${val#*@}
|
|
if [ "$authuser" != "" -a "$domain" != "" ]; then
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.user="$authuser"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$num.domain="$domain"
|
|
fi
|
|
;;
|
|
set_notification)
|
|
let num=$num+1
|
|
line_num=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
local parm="InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$num.Line.$line_num.SIP.URI"
|
|
freecwmp_set_parameter_notification "$parm" "$val"
|
|
;;
|
|
esac
|
|
}
|
|
|
|
# Global SET/GET functions
|
|
|
|
get_voice_service_max_profile() {
|
|
local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep -c sip_service_provider`
|
|
let val=$val-1
|
|
eval "export -- \"$1=$val\""
|
|
}
|
|
|
|
get_voice_service_max_line() {
|
|
local val=`/usr/sbin/asterisk -rx "brcm show status"|grep -c "Line id"`
|
|
let val=$val-1
|
|
eval "export -- \"$1=$val\""
|
|
}
|
|
|
|
get_voice_service_function() {
|
|
local max_profile
|
|
local max_line
|
|
local max_num
|
|
|
|
get_voice_service_max_profile max_profile
|
|
let max_num=$max_profile+1
|
|
|
|
get_voice_service_max_line max_line
|
|
|
|
case "$1" in
|
|
InternetGatewayDevice.|\
|
|
InternetGatewayDevice.Services.|\
|
|
InternetGatewayDevice.Services.VoiceService.|\
|
|
InternetGatewayDevice.Services.VoiceService.1.|\
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.)
|
|
for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do
|
|
get_voice_profile_enable $profile_num
|
|
get_voice_profile_reset $profile_num
|
|
get_voice_profile_name $profile_num
|
|
get_voice_profile_signaling_protocol $profile_num
|
|
get_voice_profile_max_sessions $profile_num
|
|
get_voice_profile_number_of_lines $profile_num
|
|
get_sip_proxy_server $profile_num
|
|
get_sip_proxy_server_port $profile_num
|
|
get_sip_proxy_server_transport $profile_num
|
|
get_sip_registrar_server $profile_num
|
|
get_sip_registrar_server_port $profile_num
|
|
get_sip_registrar_server_transport $profile_num
|
|
get_sip_user_agent_domain $profile_num
|
|
get_sip_user_agent_port $profile_num
|
|
get_sip_user_agent_transport $profile_num
|
|
get_sip_outbound_proxy $profile_num
|
|
get_sip_outbound_proxy_port $profile_num
|
|
# get_sip_organization $profile_num
|
|
get_sip_registration_period $profile_num
|
|
# get_sip_invite_expires $profile_num
|
|
get_sip_re_invite_expires $profile_num
|
|
get_sip_register_expires $profile_num
|
|
# get_sip_registers_min_expires $profile_num
|
|
get_sip_register_retry_interval $profile_num
|
|
# get_sip_inbound_auth $profile_num
|
|
# get_sip_inbound_auth_username $profile_num
|
|
# get_sip_inbound_auth_password $profile_num
|
|
# Line
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
done
|
|
done
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}." "rc" "num"
|
|
if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
let profile_num=$num-1
|
|
get_voice_profile_enable $profile_num
|
|
get_voice_profile_reset $profile_num
|
|
get_voice_profile_name $profile_num
|
|
get_voice_profile_signaling_protocol $profile_num
|
|
get_voice_profile_max_sessions $profile_num
|
|
get_voice_profile_number_of_lines $profile_num
|
|
get_sip_proxy_server $profile_num
|
|
get_sip_proxy_server_port $profile_num
|
|
get_sip_proxy_server_transport $profile_num
|
|
get_sip_registrar_server $profile_num
|
|
get_sip_registrar_server_port $profile_num
|
|
get_sip_registrar_server_transport $profile_num
|
|
get_sip_user_agent_domain $profile_num
|
|
get_sip_user_agent_port $profile_num
|
|
get_sip_user_agent_transport $profile_num
|
|
get_sip_outbound_proxy $profile_num
|
|
get_sip_outbound_proxy_port $profile_num
|
|
# get_sip_organization $profile_num
|
|
get_sip_registration_period $profile_num
|
|
# get_sip_invite_expires $profile_num
|
|
get_sip_re_invite_expires $profile_num
|
|
get_sip_register_expires $profile_num
|
|
# get_sip_registers_min_expires $profile_num
|
|
get_sip_register_retry_interval $profile_num
|
|
# get_sip_inbound_auth $profile_num
|
|
# get_sip_inbound_auth_username $profile_num
|
|
# get_sip_inbound_auth_password $profile_num
|
|
# Line
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
done
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP." "rc" "num"
|
|
if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
let profile_num=$num-1
|
|
get_sip_proxy_server $profile_num
|
|
get_sip_proxy_server_port $profile_num
|
|
get_sip_proxy_server_transport $profile_num
|
|
get_sip_registrar_server $profile_num
|
|
get_sip_registrar_server_port $profile_num
|
|
get_sip_registrar_server_transport $profile_num
|
|
get_sip_user_agent_domain $profile_num
|
|
get_sip_user_agent_port $profile_num
|
|
get_sip_user_agent_transport $profile_num
|
|
get_sip_outbound_proxy $profile_num
|
|
get_sip_outbound_proxy_port $profile_num
|
|
# get_sip_organization $profile_num
|
|
get_sip_registration_period $profile_num
|
|
# get_sip_invite_expires $profile_num
|
|
get_sip_re_invite_expires $profile_num
|
|
get_sip_register_expires $profile_num
|
|
# get_sip_registers_min_expires $profile_num
|
|
get_sip_register_retry_interval $profile_num
|
|
# get_sip_inbound_auth $profile_num
|
|
# get_sip_inbound_auth_username $profile_num
|
|
# get_sip_inbound_auth_password $profile_num
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Enable)
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_enable" "Enable" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Reset)
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_reset" "Reset" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Name)
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_name" "Name" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SignalingProtocol)
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_signaling_protocol" "SignalingProtocol" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.MaxSessions)
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_max_sessions" "MaxSessions" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.NumberOfLines)
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_number_of_lines" "NumberOfLines" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServer)
|
|
get_set_voice_service_parameter "$1" "get_sip_proxy_server" "SIP.ProxyServer" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerPort)
|
|
get_set_voice_service_parameter "$1" "get_sip_proxy_server_port" "SIP.ProxyServerPort" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerTransport)
|
|
get_set_voice_service_parameter "$1" "get_sip_proxy_server_transport" "SIP.ProxyServerTransport" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServer)
|
|
get_set_voice_service_parameter "$1" "get_sip_registrar_server" "SIP.RegistrarServer" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerPort)
|
|
get_set_voice_service_parameter "$1" "get_sip_registrar_server_port" "SIP.RegistrarServerPort" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerTransport)
|
|
get_set_voice_service_parameter "$1" "get_sip_registrar_server_transport" "SIP.RegistrarServerTransport" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentDomain)
|
|
get_set_voice_service_parameter "$1" "get_sip_user_agent_domain" "SIP.UserAgentDomain" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentPort)
|
|
get_set_voice_service_parameter "$1" "get_sip_user_agent_port" "SIP.UserAgentPort" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentTransport)
|
|
get_set_voice_service_parameter "$1" "get_sip_user_agent_transport" "SIP.UserAgentTransport" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxy)
|
|
get_set_voice_service_parameter "$1" "get_sip_outbound_proxy" "SIP.OutboundProxy" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxyPort)
|
|
get_set_voice_service_parameter "$1" "get_sip_outbound_proxy_port" "SIP.OutboundProxyPort" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.Organization)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "get_sip_organization" "SIP.Organization" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrationPeriod)
|
|
get_set_voice_service_parameter "$1" "get_sip_registration_period" "SIP.RegistrationPeriod" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InviteExpires)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "get_sip_invite_expires" "SIP.InviteExpires" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ReInviteExpires)
|
|
get_set_voice_service_parameter "$1" "get_sip_re_invite_expires" "SIP.ReInviteExpires" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterExpires)
|
|
get_set_voice_service_parameter "$1" "get_sip_register_expires" "SIP.RegisterExpires" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistersMinExpires)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "get_sip_registers_min_expires" "SIP.RegistersMinExpires" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterRetryInterval)
|
|
get_set_voice_service_parameter "$1" "get_sip_register_retry_interval" "SIP.RegisterRetryInterval" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuth)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "get_sip_inbound_auth" "SIP.InboundAuth" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthUsername)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "get_sip_inbound_auth_username" "SIP.InboundAuthUsername" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthPassword)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "get_sip_inbound_auth_password" "SIP.InboundAuthPassword" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num"
|
|
if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
let profile_num=$num-1
|
|
# Line
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
done
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num"
|
|
if [ $rc -eq 0 ]; then
|
|
local profile_num=`echo $num | awk '{ print $1 }'`
|
|
local line_number=`echo $num | awk '{ print $2 }'`
|
|
let sip_id=$profile_num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $profile_num`
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$line_number" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then
|
|
# Line
|
|
local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1`
|
|
let profile_num=$profile_num-1
|
|
if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then
|
|
local count=0
|
|
local found=0
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
let p_instance=$profile_num+1
|
|
count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:`
|
|
if [ "$count" = "$line_number" ];then
|
|
found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$found" = "1" ];then
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Enable)
|
|
get_set_line_parameter "$1" "get_line_enable" "Enable" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.DirectoryNumber)
|
|
get_set_line_parameter "$1" "get_line_directory_number" "DirectoryNumber" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Status)
|
|
get_set_line_parameter "$1" "get_line_status" "Status" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallState)
|
|
get_set_line_parameter "$1" "get_line_call_state" "CallState" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures." "rc" "num"
|
|
if [ $rc -eq 0 ]; then
|
|
local profile_num=`echo $num | awk '{ print $1 }'`
|
|
local line_number=`echo $num | awk '{ print $2 }'`
|
|
let sip_id=$profile_num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $profile_num`
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$line_number" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then
|
|
# Line
|
|
local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1`
|
|
let profile_num=$profile_num-1
|
|
if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then
|
|
local count=0
|
|
local found=0
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
let p_instance=$profile_num+1
|
|
count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:`
|
|
if [ "$count" = "$line_number" ];then
|
|
found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$found" = "1" ];then
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.CallerIDName)
|
|
get_set_line_parameter "$1" "get_line_calling_features_caller_id_name" "CallingFeatures.CallerIDName" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.X_002207_LineProfile)
|
|
get_set_line_parameter "$1" "get_line_x_002207_line_profile" "X_002207_LineProfile" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP." "rc" "num"
|
|
if [ $rc -eq 0 ]; then
|
|
let sip_id=$profile_num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $profile_num`
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$line_number" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
local profile_num=`echo $num | awk '{ print $1 }'`
|
|
local line_number=`echo $num | awk '{ print $2 }'`
|
|
if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then
|
|
# Line
|
|
local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1`
|
|
let profile_num=$profile_num-1
|
|
if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then
|
|
local count=0
|
|
local found=0
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
let p_instance=$profile_num+1
|
|
count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:`
|
|
if [ "$count" = "$line_number" ];then
|
|
found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$found" = "1" ];then
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthUserName)
|
|
get_set_line_parameter "$1" "get_line_sip_username" "SIP.AuthUserName" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthPassword)
|
|
get_set_line_parameter "$1" "get_line_sip_password" "SIP.AuthPassword" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.URI)
|
|
get_set_line_parameter "$1" "get_line_sip_uri" "SIP.URI" "$max_num"
|
|
return $?
|
|
;;
|
|
esac
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
}
|
|
|
|
get_voice_service() {
|
|
local fault_code=""
|
|
get_voice_service_function "$1"
|
|
fault_code="$?"
|
|
return $fault_code
|
|
}
|
|
|
|
get_voice_service_notification() {
|
|
local fault_code=""
|
|
get_voice_service_function "$1"
|
|
fault_code="$?"
|
|
return $fault_code
|
|
}
|
|
|
|
get_voice_service_name() {
|
|
local max_profile
|
|
local max_line
|
|
local max_num
|
|
|
|
get_voice_service_max_profile max_profile
|
|
let max_num=$max_profile+1
|
|
|
|
get_voice_service_max_line max_line
|
|
|
|
case "$1" in
|
|
InternetGatewayDevice.|\
|
|
InternetGatewayDevice.Services.)
|
|
freecwmp_output "InternetGatewayDevice.Services." "" "1"
|
|
if [ "$1" = "InternetGatewayDevice.Services." -a "$2" = "1" ];then
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1." "" "1"
|
|
fi
|
|
if [ "$2" = "0" ]; then
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService." "" "1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1." "" "1"
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile." "" "1"
|
|
for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do
|
|
get_voice_profile_enable $profile_num
|
|
get_voice_profile_reset $profile_num
|
|
get_voice_profile_name $profile_num
|
|
get_voice_profile_signaling_protocol $profile_num
|
|
get_voice_profile_max_sessions $profile_num
|
|
get_voice_profile_number_of_lines $profile_num
|
|
let i=$profile_num+1
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$i.SIP." "" "0"
|
|
get_sip_proxy_server $profile_num
|
|
get_sip_proxy_server_port $profile_num
|
|
get_sip_proxy_server_transport $profile_num
|
|
get_sip_registrar_server $profile_num
|
|
get_sip_registrar_server_port $profile_num
|
|
get_sip_registrar_server_transport $profile_num
|
|
get_sip_user_agent_domain $profile_num
|
|
get_sip_user_agent_port $profile_num
|
|
get_sip_user_agent_transport $profile_num
|
|
get_sip_outbound_proxy $profile_num
|
|
get_sip_outbound_proxy_port $profile_num
|
|
# get_sip_organization $profile_num
|
|
get_sip_registration_period $profile_num
|
|
# get_sip_invite_expires $profile_num
|
|
get_sip_re_invite_expires $profile_num
|
|
get_sip_register_expires $profile_num
|
|
# get_sip_registers_min_expires $profile_num
|
|
get_sip_register_retry_interval $profile_num
|
|
# get_sip_inbound_auth $profile_num
|
|
# get_sip_inbound_auth_username $profile_num
|
|
# get_sip_inbound_auth_password $profile_num
|
|
# Line
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$i.Line.$line_number." "" "1"
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$i.Line.$line_number.CallingFeatures." "" "0"
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
freecwmp_output "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.$i.Line.$line_number.SIP." "" "0"
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
done
|
|
done
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.)
|
|
freecwmp_output "$1" "" "1"
|
|
freecwmp_output "$1\1." "" "1"
|
|
if [ "$2" = "0" ]; then
|
|
freecwmp_output "$1\1.VoiceProfile." "" "1"
|
|
for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do
|
|
get_voice_profile_enable $profile_num
|
|
get_voice_profile_reset $profile_num
|
|
get_voice_profile_name $profile_num
|
|
get_voice_profile_signaling_protocol $profile_num
|
|
get_voice_profile_max_sessions $profile_num
|
|
get_voice_profile_number_of_lines $profile_num
|
|
let i=$profile_num+1
|
|
freecwmp_output "$1\1.VoiceProfile.$i.SIP." "" "0"
|
|
get_sip_proxy_server $profile_num
|
|
get_sip_proxy_server_port $profile_num
|
|
get_sip_proxy_server_transport $profile_num
|
|
get_sip_registrar_server $profile_num
|
|
get_sip_registrar_server_port $profile_num
|
|
get_sip_registrar_server_transport $profile_num
|
|
get_sip_user_agent_domain $profile_num
|
|
get_sip_user_agent_port $profile_num
|
|
get_sip_user_agent_transport $profile_num
|
|
get_sip_outbound_proxy $profile_num
|
|
get_sip_outbound_proxy_port $profile_num
|
|
# get_sip_organization $profile_num
|
|
get_sip_registration_period $profile_num
|
|
# get_sip_invite_expires $profile_num
|
|
get_sip_re_invite_expires $profile_num
|
|
get_sip_register_expires $profile_num
|
|
# get_sip_registers_min_expires $profile_num
|
|
get_sip_register_retry_interval $profile_num
|
|
# get_sip_inbound_auth $profile_num
|
|
# get_sip_inbound_auth_username $profile_num
|
|
# get_sip_inbound_auth_password $profile_num
|
|
# Line
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "$1\1.VoiceProfile.$i.Line.$line_number." "" "1"
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
freecwmp_output "$1\1.VoiceProfile.$i.Line.$line_number.CallingFeatures." "" "0"
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
freecwmp_output "$1\1.VoiceProfile.$i.Line.$line_number.SIP." "" "0"
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
done
|
|
done
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.)
|
|
freecwmp_output "$1" "" "1"
|
|
if [ "$2" = "0" ]; then
|
|
freecwmp_output "$1VoiceProfile." "" "1"
|
|
for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do
|
|
let i=$profile_num+1
|
|
freecwmp_output "$1VoiceProfile.$i." "" "1"
|
|
get_voice_profile_enable $profile_num
|
|
get_voice_profile_reset $profile_num
|
|
get_voice_profile_name $profile_num
|
|
get_voice_profile_signaling_protocol $profile_num
|
|
get_voice_profile_max_sessions $profile_num
|
|
get_voice_profile_number_of_lines $profile_num
|
|
let i=$profile_num+1
|
|
freecwmp_output "$1VoiceProfile.$i.SIP." "" "0"
|
|
get_sip_proxy_server $profile_num
|
|
get_sip_proxy_server_port $profile_num
|
|
get_sip_proxy_server_transport $profile_num
|
|
get_sip_registrar_server $profile_num
|
|
get_sip_registrar_server_port $profile_num
|
|
get_sip_registrar_server_transport $profile_num
|
|
get_sip_user_agent_domain $profile_num
|
|
get_sip_user_agent_port $profile_num
|
|
get_sip_user_agent_transport $profile_num
|
|
get_sip_outbound_proxy $profile_num
|
|
get_sip_outbound_proxy_port $profile_num
|
|
# get_sip_organization $profile_num
|
|
get_sip_registration_period $profile_num
|
|
# get_sip_invite_expires $profile_num
|
|
get_sip_re_invite_expires $profile_num
|
|
get_sip_register_expires $profile_num
|
|
# get_sip_registers_min_expires $profile_num
|
|
get_sip_register_retry_interval $profile_num
|
|
# get_sip_inbound_auth $profile_num
|
|
# get_sip_inbound_auth_username $profile_num
|
|
# get_sip_inbound_auth_password $profile_num
|
|
# Line
|
|
local line_number="0"
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
freecwmp_output "$1.VoiceProfile.$i.Line.$line_number." "" "1"
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
freecwmp_output "$1VoiceProfile.$i.Line.$line_number.CallingFeatures." "" "0"
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
freecwmp_output "$1VoiceProfile.$i.Line.$line_number.SIP." "" "0"
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
done
|
|
done
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.)
|
|
freecwmp_output "$1" "" "1"
|
|
for profile_num in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep "voice_client.sip"|grep -v sip_service_provider|awk -F '.' '{print $2}'|sed 's/sip//g'|sort -un`;do
|
|
let i=$profile_num+1
|
|
freecwmp_output "$1$i" "" "1"
|
|
if [ "$2" = "0" ]; then
|
|
get_voice_profile_enable $profile_num
|
|
get_voice_profile_reset $profile_num
|
|
get_voice_profile_name $profile_num
|
|
get_voice_profile_signaling_protocol $profile_num
|
|
get_voice_profile_max_sessions $profile_num
|
|
get_voice_profile_number_of_lines $profile_num
|
|
freecwmp_output "$1$i.SIP." "" "0"
|
|
get_sip_proxy_server $profile_num
|
|
get_sip_proxy_server_port $profile_num
|
|
get_sip_proxy_server_transport $profile_num
|
|
get_sip_registrar_server $profile_num
|
|
get_sip_registrar_server_port $profile_num
|
|
get_sip_registrar_server_transport $profile_num
|
|
get_sip_user_agent_domain $profile_num
|
|
get_sip_user_agent_port $profile_num
|
|
get_sip_user_agent_transport $profile_num
|
|
get_sip_outbound_proxy $profile_num
|
|
get_sip_outbound_proxy_port $profile_num
|
|
# get_sip_organization $profile_num
|
|
get_sip_registration_period $profile_num
|
|
# get_sip_invite_expires $profile_num
|
|
get_sip_re_invite_expires $profile_num
|
|
get_sip_register_expires $profile_num
|
|
# get_sip_registers_min_expires $profile_num
|
|
get_sip_register_retry_interval $profile_num
|
|
# get_sip_inbound_auth $profile_num
|
|
# get_sip_inbound_auth_username $profile_num
|
|
# get_sip_inbound_auth_password $profile_num
|
|
# Line
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "$1$i.Line.$line_number." "" "1"
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
freecwmp_output "$1$i.Line.$line_number.CallingFeatures." "" "0"
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
freecwmp_output "$1$i.Line.$line_number.SIP." "" "0"
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
done
|
|
fi
|
|
done
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}." "rc" "num"
|
|
if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
let profile_num=$num-1
|
|
get_voice_profile_enable $profile_num
|
|
get_voice_profile_reset $profile_num
|
|
get_voice_profile_name $profile_num
|
|
get_voice_profile_signaling_protocol $profile_num
|
|
get_voice_profile_max_sessions $profile_num
|
|
get_voice_profile_number_of_lines $profile_num
|
|
if [ "$2" = "0" ]; then
|
|
freecwmp_output "$1SIP." "" "0"
|
|
get_sip_proxy_server $profile_num
|
|
get_sip_proxy_server_port $profile_num
|
|
get_sip_proxy_server_transport $profile_num
|
|
get_sip_registrar_server $profile_num
|
|
get_sip_registrar_server_port $profile_num
|
|
get_sip_registrar_server_transport $profile_num
|
|
get_sip_user_agent_domain $profile_num
|
|
get_sip_user_agent_port $profile_num
|
|
get_sip_user_agent_transport $profile_num
|
|
get_sip_outbound_proxy $profile_num
|
|
get_sip_outbound_proxy_port $profile_num
|
|
# get_sip_organization $profile_num
|
|
get_sip_registration_period $profile_num
|
|
# get_sip_invite_expires $profile_num
|
|
get_sip_re_invite_expires $profile_num
|
|
get_sip_register_expires $profile_num
|
|
# get_sip_registers_min_expires $profile_num
|
|
get_sip_register_retry_interval $profile_num
|
|
# get_sip_inbound_auth $profile_num
|
|
# get_sip_inbound_auth_username $profile_num
|
|
# get_sip_inbound_auth_password $profile_num
|
|
# Line
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "$1Line.$line_number." "" "1"
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
freecwmp_output "$1Line.$line_number.CallingFeatures." "" "0"
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
freecwmp_output "$1Line.$line_number.SIP." "" "0"
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
done
|
|
fi
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP." "rc" "num"
|
|
if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
let profile_num=$num-1
|
|
freecwmp_output "$1" "" "0"
|
|
get_sip_proxy_server $profile_num
|
|
get_sip_proxy_server_port $profile_num
|
|
get_sip_proxy_server_transport $profile_num
|
|
get_sip_registrar_server $profile_num
|
|
get_sip_registrar_server_port $profile_num
|
|
get_sip_registrar_server_transport $profile_num
|
|
get_sip_user_agent_domain $profile_num
|
|
get_sip_user_agent_port $profile_num
|
|
get_sip_user_agent_transport $profile_num
|
|
get_sip_outbound_proxy $profile_num
|
|
get_sip_outbound_proxy_port $profile_num
|
|
# get_sip_organization $profile_num
|
|
get_sip_registration_period $profile_num
|
|
# get_sip_invite_expires $profile_num
|
|
get_sip_re_invite_expires $profile_num
|
|
get_sip_register_expires $profile_num
|
|
# get_sip_registers_min_expires $profile_num
|
|
get_sip_register_retry_interval $profile_num
|
|
# get_sip_inbound_auth $profile_num
|
|
# get_sip_inbound_auth_username $profile_num
|
|
# get_sip_inbound_auth_password $profile_num
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Enable)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_enable" "Enable" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Reset)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_reset" "Reset" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Name)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_name" "Name" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SignalingProtocol)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_signaling_protocol" "SignalingProtocol" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.MaxSessions)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_max_sessions" "MaxSessions" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.NumberOfLines)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_voice_profile_number_of_lines" "NumberOfLines" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServer)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_proxy_server" "SIP.ProxyServer" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerPort)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_proxy_server_port" "SIP.ProxyServerPort" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerTransport)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_proxy_server_transport" "SIP.ProxyServerTransport" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServer)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_registrar_server" "SIP.RegistrarServer" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerPort)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_registrar_server_port" "SIP.RegistrarServerPort" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerTransport)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_registrar_server_transport" "SIP.RegistrarServerTransport" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentDomain)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_user_agent_domain" "SIP.UserAgentDomain" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentPort)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_user_agent_port" "SIP.UserAgentPort" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentTransport)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_user_agent_transport" "SIP.UserAgentTransport" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxy)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_outbound_proxy" "SIP.OutboundProxy" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxyPort)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_outbound_proxy_port" "SIP.OutboundProxyPort" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.Organization)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_organization" "SIP.Organization" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrationPeriod)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_registration_period" "SIP.RegistrationPeriod" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InviteExpires)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_invite_expires" "SIP.InviteExpires" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ReInviteExpires)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_re_invite_expires" "SIP.ReInviteExpires" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterExpires)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_register_expires" "SIP.RegisterExpires" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistersMinExpires)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_registers_min_expires" "SIP.RegistersMinExpires" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterRetryInterval)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_register_retry_interval" "SIP.RegisterRetryInterval" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuth)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_inbound_auth" "SIP.InboundAuth" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthUsername)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_inbound_auth_username" "SIP.InboundAuthUsername" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthPassword)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_voice_service_parameter "$1" "get_sip_inbound_auth_password" "SIP.InboundAuthPassword" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num"
|
|
if [ $rc -eq 0 ] && [ $num -gt 0 ] && [ $num -le $max_num ]; then
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
let profile_num=$num-1
|
|
freecwmp_output "$1" "" "1"
|
|
# Line
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.instances|cut -d : -f$num`
|
|
freecwmp_output "$1$line_number." "" "1"
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
freecwmp_output "$1$line_number.CallingFeatures." "" "0"
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
freecwmp_output "$1$line_number.SIP." "" "0"
|
|
if [ "$2" = "0" ];then
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
fi
|
|
done
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num"
|
|
if [ $rc -eq 0 ]; then
|
|
local profile_num=`echo $num | awk '{ print $1 }'`
|
|
local line_number=`echo $num | awk '{ print $2 }'`
|
|
let sip_id=$profile_num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $profile_num`
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$line_number" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
|
|
if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then
|
|
# Line
|
|
local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1`
|
|
let profile_num=$profile_num-1
|
|
if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then
|
|
local count=0
|
|
local found=0
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
let p_instance=$profile_num+1
|
|
count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:`
|
|
if [ "$count" = "$line_number" ];then
|
|
found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$found" = "1" ];then
|
|
freecwmp_output "$1" "" "1"
|
|
get_line_enable $profile_num $line_name
|
|
get_line_directory_number $profile_num $line_name
|
|
get_line_status $profile_num $line_name
|
|
get_line_call_state $profile_num $line_name
|
|
get_line_x_002207_line_profile $profile_num $line_name
|
|
if [ "$2" = "0" ];then
|
|
freecwmp_output "$1CallingFeatures." "" "0"
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
freecwmp_output "$1SIP." "" "0"
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Enable)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_line_parameter "$1" "get_line_enable" "Enable" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.DirectoryNumber)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_line_parameter "$1" "get_line_directory_number" "DirectoryNumber" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Status)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_line_parameter "$1" "get_line_status" "Status" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallState)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_line_parameter "$1" "get_line_call_state" "CallState" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.CallingFeatures." "rc" "num"
|
|
if [ $rc -eq 0 ]; then
|
|
local profile_num=`echo $num | awk '{ print $1 }'`
|
|
local line_number=`echo $num | awk '{ print $2 }'`
|
|
let sip_id=$profile_num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $profile_num`
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$line_number" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then
|
|
# Line
|
|
local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1`
|
|
let profile_num=$profile_num-1
|
|
if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then
|
|
local count=0
|
|
local found=0
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
let p_instance=$profile_num+1
|
|
count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:`
|
|
if [ "$count" = "$line_number" ];then
|
|
found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$found" = "1" ];then
|
|
freecwmp_output "$1" "" "0"
|
|
if [ "$2" = "0" ];then
|
|
get_line_calling_features_caller_id_name $profile_num $line_name
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.CallerIDName)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_line_parameter "$1" "get_line_calling_features_caller_id_name" "CallingFeatures.CallerIDName" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.X_002207_LineProfile)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_line_parameter "$1" "get_line_x_002207_line_profile" "X_002207_LineProfile" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}.SIP." "rc" "num"
|
|
if [ $rc -eq 0 ]; then
|
|
local profile_num=`echo $num | awk '{ print $1 }'`
|
|
local line_number=`echo $num | awk '{ print $2 }'`
|
|
let sip_id=$profile_num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $profile_num`
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$line_number" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
|
|
if [ $profile_num -gt 0 ] && [ $profile_num -le $max_num ]; then
|
|
# Line
|
|
local max_line_number=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances|awk -F '=' '{print $2'}|cut -f$profile_num -d:|sort -u|tail -1`
|
|
let profile_num=$profile_num-1
|
|
if [ $line_number -gt 0 ] && [ $line_number -le $max_line_number ]; then
|
|
local count=0
|
|
local found=0
|
|
for line_name in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|grep sip$profile_num$|awk -F'.' '{print$2}'`;do
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
if [ $line_id -gt $max_line ];then
|
|
continue
|
|
fi
|
|
let p_instance=$profile_num+1
|
|
count=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client.$line_name.instances|cut -f$p_instance -d:`
|
|
if [ "$count" = "$line_number" ];then
|
|
found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$found" = "1" ];then
|
|
freecwmp_output "$1" "" "0"
|
|
if [ "$2" = "0" ];then
|
|
get_line_sip_username $profile_num $line_name
|
|
get_line_sip_password $profile_num $line_name
|
|
get_line_sip_uri $profile_num $line_name
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
else
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
fi
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthUserName)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_line_parameter "$1" "get_line_sip_username" "SIP.AuthUserName" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthPassword)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_line_parameter "$1" "get_line_sip_password" "SIP.AuthPassword" "$max_num"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.URI)
|
|
if [ "$2" = "1" ]; then
|
|
return $FAULT_CPE_INVALID_ARGUMENTS
|
|
fi
|
|
get_set_line_parameter "$1" "get_line_sip_uri" "SIP.URI" "$max_num"
|
|
return $?
|
|
;;
|
|
esac
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
}
|
|
|
|
|
|
set_voice_service() {
|
|
local max_profile
|
|
local max_line
|
|
local max_num
|
|
|
|
get_voice_service_max_profile max_profile
|
|
let max_num=$max_profile+1
|
|
|
|
get_voice_service_max_line max_line
|
|
|
|
case "$1" in
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Enable)
|
|
get_set_voice_service_parameter "$1" "set_voice_profile_enable" "Enable" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Reset)
|
|
get_set_voice_service_parameter "$1" "set_voice_profile_reset" "Reset" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Name)
|
|
return $FAULT_CPE_NON_WRITABLE_PARAMETER
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SignalingProtocol)
|
|
get_set_voice_service_parameter "$1" "set_voice_profile_signaling_protocol" "SignalingProtocol" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.MaxSessions)
|
|
return $FAULT_CPE_NON_WRITABLE_PARAMETER
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.NumberOfLines)
|
|
return $FAULT_CPE_NON_WRITABLE_PARAMETER
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServer)
|
|
get_set_voice_service_parameter "$1" "set_sip_proxy_server" "SIP.ProxyServer" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerPort)
|
|
get_set_voice_service_parameter "$1" "set_sip_proxy_server_port" "SIP.ProxyServerPort" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerTransport)
|
|
get_set_voice_service_parameter "$1" "set_sip_proxy_server_transport" "SIP.ProxyServerTransport" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServer)
|
|
get_set_voice_service_parameter "$1" "set_sip_registrar_server" "SIP.RegistrarServer" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerPort)
|
|
get_set_voice_service_parameter "$1" "set_sip_registrar_server_port" "SIP.RegistrarServerPort" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerTransport)
|
|
get_set_voice_service_parameter "$1" "set_sip_registrar_server_transport" "SIP.RegistrarServerTransport" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentDomain)
|
|
get_set_voice_service_parameter "$1" "set_sip_user_agent_domain" "SIP.UserAgentDomain" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentPort)
|
|
get_set_voice_service_parameter "$1" "set_sip_user_agent_port" "SIP.UserAgentPort" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentTransport)
|
|
get_set_voice_service_parameter "$1" "set_sip_user_agent_transport" "SIP.UserAgentTransport" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxy)
|
|
get_set_voice_service_parameter "$1" "set_sip_outbound_proxy" "SIP.OutboundProxy" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxyPort)
|
|
get_set_voice_service_parameter "$1" "set_sip_outbound_proxy_port" "SIP.OutboundProxyPort" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.Organization)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_organization" "SIP.Organization" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrationPeriod)
|
|
get_set_voice_service_parameter "$1" "set_sip_registration_period" "SIP.RegistrationPeriod" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InviteExpires)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_invite_expires" "SIP.InviteExpires" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ReInviteExpires)
|
|
get_set_voice_service_parameter "$1" "set_sip_re_invite_expires" "SIP.ReInviteExpires" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterExpires)
|
|
get_set_voice_service_parameter "$1" "set_sip_register_expires" "SIP.RegisterExpires" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistersMinExpires)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_registers_min_expires" "SIP.RegistersMinExpires" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterRetryInterval)
|
|
get_set_voice_service_parameter "$1" "set_sip_register_retry_interval" "SIP.RegisterRetryInterval" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuth)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_inbound_auth" "SIP.InboundAuth" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthUsername)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_inbound_auth_username" "SIP.InboundAuthUsername" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthPassword)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_inbound_auth_password" "SIP.InboundAuthPassword" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Enable)
|
|
get_set_line_parameter "$1" "set_line_enable" "Enable" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.DirectoryNumber)
|
|
get_set_line_parameter "$1" "set_line_directory_number" "DirectoryNumber" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Status)
|
|
return $FAULT_CPE_NON_WRITABLE_PARAMETER
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallState)
|
|
return $FAULT_CPE_NON_WRITABLE_PARAMETER
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.CallerIDName)
|
|
get_set_line_parameter "$1" "set_line_calling_features_caller_id_name" "CallingFeatures.CallerIDName" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.X_002207_LineProfile)
|
|
get_set_line_parameter "$1" "set_line_x_002207_line_profile" "X_002207_LineProfile" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthUserName)
|
|
get_set_line_parameter "$1" "set_line_sip_username" "SIP.AuthUserName" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthPassword)
|
|
get_set_line_parameter "$1" "set_line_sip_password" "SIP.AuthPassword" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.URI)
|
|
get_set_line_parameter "$1" "set_line_sip_uri" "SIP.URI" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
esac
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
}
|
|
|
|
set_voice_service_notification() {
|
|
local max_profile
|
|
local max_line
|
|
local max_num
|
|
|
|
get_voice_service_max_profile max_profile
|
|
let max_num=$max_profile+1
|
|
|
|
get_voice_service_max_line max_line
|
|
|
|
case "$1" in
|
|
InternetGatewayDevice.)
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.|\
|
|
InternetGatewayDevice.Services.VoiceService.|\
|
|
InternetGatewayDevice.Services.VoiceService.1.|\
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.)
|
|
freecwmp_set_parameter_notification "$1" "$2"
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}." "rc" "num"
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
freecwmp_set_parameter_notification "$1" "$2"
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.)
|
|
local profile_object=`echo $1|sed 's/SIP*.*//g'`
|
|
freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.SIP." "rc" "num"
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
freecwmp_set_parameter_notification "$1" "$2"
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.)
|
|
local profile_object=`echo $1|sed 's/Line*.*//g'`
|
|
freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num"
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
freecwmp_set_parameter_notification "$1" "$2"
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.|\
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.)
|
|
local profile_object=`echo $1|sed 's/Line*.*//g'`
|
|
freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num"
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $num`
|
|
object="$1"
|
|
local line_object=${object%\.[A-Z]*\.}.
|
|
freecwmp_parse_formated_parameter "$line_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num"
|
|
local num1=`echo $num | awk '{ print $1 }'`
|
|
local num2=`echo $num | awk '{ print $2 }'`
|
|
if [ $rc -eq 0 ];then
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$num2" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
fi
|
|
freecwmp_set_parameter_notification "$1" "$2"
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Enable)
|
|
get_set_voice_service_parameter "$1" "set_voice_profile_enable" "Enable" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Reset)
|
|
get_set_voice_service_parameter "$1" "set_voice_profile_reset" "Reset" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Name)
|
|
return $FAULT_CPE_NOTIFICATION_REJECTED
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SignalingProtocol)
|
|
get_set_voice_service_parameter "$1" "set_voice_profile_signaling_protocol" "SignalingProtocol" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.MaxSessions)
|
|
return $FAULT_CPE_NOTIFICATION_REJECTED
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.NumberOfLines)
|
|
return $FAULT_CPE_NOTIFICATION_REJECTED
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServer)
|
|
get_set_voice_service_parameter "$1" "set_sip_proxy_server" "SIP.ProxyServer" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerPort)
|
|
get_set_voice_service_parameter "$1" "set_sip_proxy_server_port" "SIP.ProxyServerPort" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ProxyServerTransport)
|
|
get_set_voice_service_parameter "$1" "set_sip_proxy_server_transport" "SIP.ProxyServerTransport" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServer)
|
|
get_set_voice_service_parameter "$1" "set_sip_registrar_server" "SIP.RegistrarServer" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerPort)
|
|
get_set_voice_service_parameter "$1" "set_sip_registrar_server_port" "SIP.RegistrarServerPort" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrarServerTransport)
|
|
get_set_voice_service_parameter "$1" "set_sip_registrar_server_transport" "SIP.RegistrarServerTransport" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentDomain)
|
|
get_set_voice_service_parameter "$1" "set_sip_user_agent_domain" "SIP.UserAgentDomain" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentPort)
|
|
get_set_voice_service_parameter "$1" "set_sip_user_agent_port" "SIP.UserAgentPort" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.UserAgentTransport)
|
|
get_set_voice_service_parameter "$1" "set_sip_user_agent_transport" "SIP.UserAgentTransport" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxy)
|
|
get_set_voice_service_parameter "$1" "set_sip_outbound_proxy" "SIP.OutboundProxy" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.OutboundProxyPort)
|
|
get_set_voice_service_parameter "$1" "set_sip_outbound_proxy_port" "SIP.OutboundProxyPort" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.Organization)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_organization" "SIP.Organization" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistrationPeriod)
|
|
get_set_voice_service_parameter "$1" "set_sip_registration_period" "SIP.RegistrationPeriod" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InviteExpires)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_invite_expires" "SIP.InviteExpires" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.ReInviteExpires)
|
|
get_set_voice_service_parameter "$1" "set_sip_re_invite_expires" "SIP.ReInviteExpires" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterExpires)
|
|
get_set_voice_service_parameter "$1" "set_sip_register_expires" "SIP.RegisterExpires" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegistersMinExpires)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_registers_min_expires" "SIP.RegistersMinExpires" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.RegisterRetryInterval)
|
|
get_set_voice_service_parameter "$1" "set_sip_register_retry_interval" "SIP.RegisterRetryInterval" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuth)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_inbound_auth" "SIP.InboundAuth" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthUsername)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_inbound_auth_username" "SIP.InboundAuthUsername" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.SIP.InboundAuthPassword)
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
get_set_voice_service_parameter "$1" "set_sip_inbound_auth_password" "SIP.InboundAuthPassword" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.)
|
|
freecwmp_parse_formated_parameter "$line_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num"
|
|
local profile_num=`echo $num | awk '{ print $1 }'`
|
|
local line_number=`echo $num | awk '{ print $2 }'`
|
|
if [ $rc -eq 0 ];then
|
|
let sip_id=$profile_num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $profile_num`
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$line_number" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
fi
|
|
freecwmp_set_parameter_notification "$1" "$2"
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Enable)
|
|
get_set_line_parameter "$1" "set_line_enable" "Enable" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.DirectoryNumber)
|
|
get_set_line_parameter "$1" "set_line_directory_number" "DirectoryNumber" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.Status)
|
|
return $FAULT_CPE_NOTIFICATION_REJECTED
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallState)
|
|
return $FAULT_CPE_NOTIFICATION_REJECTED
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.CallingFeatures.CallerIDName)
|
|
get_set_line_parameter "$1" "set_line_calling_features_caller_id_name" "CallingFeatures.CallerIDName" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.X_002207_LineProfile)
|
|
get_set_line_parameter "$1" "set_line_x_002207_line_profile" "X_002207_LineProfile" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthUserName)
|
|
get_set_line_parameter "$1" "set_line_sip_username" "SIP.AuthUserName" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.AuthPassword)
|
|
get_set_line_parameter "$1" "set_line_sip_password" "SIP.AuthPassword" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.SIP.URI)
|
|
get_set_line_parameter "$1" "set_line_sip_uri" "SIP.URI" "$max_num" "$2"
|
|
return $?
|
|
;;
|
|
esac
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME;
|
|
}
|
|
|
|
get_voice_profile_max_instance() {
|
|
local max=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_service_provider|awk -F '.' '{print $2}'|awk -F '=' '{print $1}'|sed 's/sip//g'|sort -n|tail -1`
|
|
for i in `seq 0 $max`;do
|
|
if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$i`" = "" ];then
|
|
let j=$i-1
|
|
echo $j
|
|
return 0
|
|
fi
|
|
done
|
|
if [ "$max" = "" ];then
|
|
echo -1
|
|
else
|
|
echo $max
|
|
fi
|
|
}
|
|
|
|
get_line_max_instance() {
|
|
local line_number=`/usr/sbin/asterisk -rx "brcm show status"|grep -c "Line id"`
|
|
for i in `seq 0 $line_number`;do
|
|
if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.brcm$i.sip_account`" = "-" ];then
|
|
echo $i
|
|
break
|
|
fi
|
|
done
|
|
}
|
|
|
|
add_voice_profile() {
|
|
local i="$1"
|
|
let j=$i+1
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q batch << EOF 2>&1 >/dev/null
|
|
set voice_client.sip$i=sip_service_provider
|
|
set voice_client.sip$i._title='Account $j'
|
|
set voice_client.sip$i.enabled='0'
|
|
set voice_client.sip$i.codec0='ulaw'
|
|
set voice_client.sip$i.codec1='alaw'
|
|
set voice_client.sip$i.codec2='g729'
|
|
set voice_client.sip$i.codec3='g726'
|
|
set voice_client.sip$i.cfim_on='*21*'
|
|
set voice_client.sip$i.cfim_off='#21#'
|
|
set voice_client.sip$i.cfbs_on='*61*'
|
|
set voice_client.sip$i.cfbs_off='#61#'
|
|
set voice_client.sip$i.call_return='*69'
|
|
set voice_client.sip$i.redial='*66'
|
|
set voice_client.sip$i.cbbs_key='5'
|
|
set voice_client.sip$i.cbbs_maxretry='5'
|
|
set voice_client.sip$i.cbbs_retrytime='300'
|
|
set voice_client.sip$i.cbbs_waittime='30'
|
|
EOF
|
|
}
|
|
|
|
delete_voice_profile() {
|
|
local i="$1"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q delete voice_client.sip$i
|
|
}
|
|
|
|
add_line() {
|
|
local i="$1"
|
|
local j="$2"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q batch << EOF 2>&1 >/dev/null
|
|
set voice_client.brcm$i.sip_account="sip$j"
|
|
EOF
|
|
}
|
|
|
|
delete_line() {
|
|
local line_name="$1"
|
|
sip_id=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line_name.sip_account|sed 's/sip//g''`
|
|
line_id=`echo $line_name|sed 's/brcm//g'`
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line_name.sip_account='-'
|
|
call_lines=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id.call_lines|sed "s/ *$line_id *//g"`
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$call_lines"
|
|
}
|
|
|
|
get_line_instances_list() {
|
|
local i=$1
|
|
local j=$1
|
|
local instances
|
|
let j--
|
|
for line in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|awk -F '.' '{print $2}'`;do
|
|
if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line.sip_account`" = "sip$j" ];then
|
|
local instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line.instances|cut -f $i -d:`
|
|
if [ "$instance" != "0" ];then
|
|
instances="$instances $instance"
|
|
fi
|
|
fi
|
|
done
|
|
echo $instances
|
|
}
|
|
|
|
delete_associated_line_instances() {
|
|
local i=$1
|
|
for line in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep sip_account|awk -F '.' '{print $2}'`;do
|
|
if [ "`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.$line.sip_account`" = "sip$i" ];then
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.$line.sip_account="-"
|
|
fi
|
|
done
|
|
}
|
|
|
|
add_voice_service() {
|
|
local profile_object=`echo $1|sed 's/Line*.*//g'`
|
|
freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}." "rc" "num"
|
|
if [ "$num" != "" ] && [ $rc -eq 0 ];then
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
fi
|
|
|
|
case $1 in
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num"
|
|
i=`get_line_max_instance`
|
|
if [ "$i" = "" ];then
|
|
return $FAULT_CPE_RESOURCES_EXCEEDED
|
|
fi
|
|
let sip_id=$num-1
|
|
add_line "$i" "$sip_id"
|
|
instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.brcm$i.instances|cut -f $num -d :`
|
|
if [ "$instance" = "0" ];then
|
|
max_line_instance=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep instances|sort -u|cut -f $num -d :|grep -v 0|tail -1`
|
|
let instance=$max_line_instance+1
|
|
local j=0
|
|
for k in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.brcm$i.instances|sed 's/:/ /g'`;do
|
|
let j++
|
|
if [ "$j" != "$num" ];then
|
|
if [ "$instances" = "" ];then
|
|
instances=$k
|
|
else
|
|
instances=$instances:$k
|
|
fi
|
|
else
|
|
if [ "$instances" = "" ];then
|
|
instances=$instance
|
|
else
|
|
instances=$instances:$instance
|
|
fi
|
|
fi
|
|
done
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.brcm$i.instances="$instances"
|
|
fi
|
|
call_lines=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id.call_lines`
|
|
if [ "$call_lines" != "" ];then
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$call_lines $i"
|
|
else
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q set voice_client.sip$sip_id.call_lines="$i"
|
|
fi
|
|
let i++
|
|
freecwmp_set_parameter_notification "$1$instance." "0"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit
|
|
freecwmp_output "" "" "" "" "" "1" "$instance"
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.)
|
|
i=`get_voice_profile_max_instance`
|
|
let i++
|
|
add_voice_profile "$i"
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit
|
|
let i++
|
|
freecwmp_output "" "" "" "" "" "1" "$i"
|
|
freecwmp_set_parameter_notification "$1$i." "0"
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.)
|
|
return $FAULT_CPE_RESOURCES_EXCEEDED
|
|
;;
|
|
esac
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
}
|
|
|
|
delete_voice_service() {
|
|
local profile_object=`echo $1|sed 's/Line*.*//g'`
|
|
freecwmp_parse_formated_parameter "$profile_object" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line." "rc" "num"
|
|
let sip_id=$num-1
|
|
exist=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q get voice_client.sip$sip_id`
|
|
if [ "$exist" = "" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
line_instances_list=`get_line_instances_list $num`
|
|
case $1 in
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.Line.*.)
|
|
freecwmp_parse_formated_parameter "$1" "InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.{i}.Line.{i}." "rc" "num"
|
|
local num1=`echo $num | awk '{ print $1 }'`
|
|
local num2=`echo $num | awk '{ print $2 }'`
|
|
if [ $rc -eq 0 ]; then
|
|
local l_inst_found=0
|
|
for line_instance in $line_instances_list;do
|
|
if [ "$line_instance" = "$num2" ];then
|
|
l_inst_found=1
|
|
break
|
|
fi
|
|
done
|
|
if [ "$l_inst_found" = "0" ];then
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
fi
|
|
for line in `/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q show voice_client|grep brcm|grep instances`;do
|
|
if [ "`echo $line|awk -F '=' '{print $2}'|cut -d: -f $num1`" = "$num2" ];then
|
|
line_name=`echo $line|awk -F '.' '{print $2}'`
|
|
break
|
|
fi
|
|
done
|
|
delete_line $line_name
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit
|
|
freecwmp_output "" "" "" "" "" "1"
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
fi
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
InternetGatewayDevice.Services.VoiceService.1.VoiceProfile.*.)
|
|
delete_voice_profile $sip_id
|
|
delete_associated_line_instances $sip_id
|
|
/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} -q commit
|
|
freecwmp_output "" "" "" "" "" "1"
|
|
delay_service_restart "voice_client" "5"
|
|
delay_service_restart "asterisk" "6"
|
|
return $FAULT_CPE_NO_FAULT
|
|
;;
|
|
esac
|
|
return $FAULT_CPE_INVALID_PARAMETER_NAME
|
|
}
|