Commit 2d85eb3c authored by Wenpeng Song's avatar Wenpeng Song Committed by Yalu Zhang
Browse files

#5679 Handle feature codes by exception only

parent def3a808
......@@ -5,9 +5,9 @@
; Main context, handles all normal calls for this Provider
include => clir
include => local_extensions
include => |PROVIDER|-callforwarding
include => |PROVIDER|-callwaiting
include => |PROVIDER|-do_not_disturb
include => |PROVIDER|-direct
include => |PROVIDER|-outgoing
......@@ -36,4 +36,3 @@ exten => _[*#0-9].,n, Macro(endcall,PJSIP,|PROVIDER|,${DIAL_EXTEN},${CHANNEL(nam
exten => _[*#0-9].,n, Goto(hangup,h,2)
exten => _[*#0-9].,n, Hangup()
[|PROVIDER|-callforwarding]
......@@ -12,7 +12,6 @@ context_direct=|CONTEXT|-direct
dialtone_extension_hint_context=|LINE_NAME|_dialtone
dialtone_extension_hint=|DIALTONE_EXTENSION_HINT|
callwaiting=|CALLWAITING|
do_not_disturb=|DND|
clir=|CLIR|
dtmfrelay=|DTMFRELAY|
;|ALLOW|
......
......@@ -141,8 +141,9 @@ config advanced_features 'call_features'
option callforward_enabled '1'
option redial_enabled '1'
option callreturn_enabled '1'
option moh_passthrough '1'
option mwi_enabled '0'
option moh_passthrough '1'
option mwi_enabled '0'
option internal_service '0'
config log 'log_options'
option console 'notice,warning,error'
......
......@@ -772,6 +772,7 @@ configure_extensions() {
local test_echo_extension
local record_message_extension
local clir
local internal_service
config_get custom_incoming_enabled custom_dialplan custom_incoming_enabled
config_get custom_hangup_enabled custom_dialplan custom_hangup_enabled
......@@ -782,6 +783,7 @@ configure_extensions() {
config_get record_message_extension custom_dialplan record_message_extension
config_get callforward_enabled call_features callforward_enabled
config_get clir call_features clir
config_get internal_service call_features internal_service
if [ -z "$custom_incoming_enabled" -o "$custom_incoming_enabled" = "0" ] ; then
sed -i "s/|CUSTOM_INCOMING|/NoOp()/" $WORK_DIR/extensions.conf
......@@ -800,11 +802,12 @@ configure_extensions() {
else
sed -i "s/|HOWLER_TIMEOUT|/$howler_timeout/" $WORK_DIR/extensions.conf
fi
if [ -n "$callforward_enabled" -a "$callforward_enabled" = "1" ] ; then
sed -i "s/|INCOMING_HANDLER|/Macro(callhandler,\${CHANNEL(endpoint)})/" $WORK_DIR/extensions.conf
else
sed -i "s/|INCOMING_HANDLER|/Goto(call_line,\${EXTEN},1))/" $WORK_DIR/extensions.conf
if [ -n "$internal_service" -a "$internal_service" = "1" ] ; then
if [ -n "$callforward_enabled" -a "$callforward_enabled" = "1" ] ; then
sed -i "s/|INCOMING_HANDLER|/Macro(callhandler,\${CHANNEL(endpoint)})/" $WORK_DIR/extensions.conf
else
sed -i "s/|INCOMING_HANDLER|/Goto(call_line,\${EXTEN},1))/" $WORK_DIR/extensions.conf
fi
fi
if [ -n "$extension_all_ports" ] ; then
......@@ -873,6 +876,7 @@ configure_extensions_provider() {
local cbbs_type
local callreturn_enabled
local redial_enabled
local internal_service
local mailbox
local minimumnumberofdigits
local prefixenable
......@@ -893,6 +897,7 @@ configure_extensions_provider() {
config_get cbbs_type call_features cbbs_type
config_get callreturn_enabled call_features callreturn_enabled
config_get redial_enabled call_features redial_enabled
config_get internal_service call_features internal_service
config_get maxnumdigits numberingplan maxnumdigits
# check if SIP Provider is disabled
......@@ -1042,21 +1047,26 @@ configure_extensions_provider() {
sed -i "s/|WAITTIME|/$cbbs_waittime/" $WORK_DIR/extensions_provider
sed -i "s/|CONGESTIONTONE|/$congestiontone/" $WORK_DIR/extensions_provider
# Configure call forwarding if enabled
if [ -n "$callforward_enabled" -a "$callforward_enabled" = "1" ] ; then
echo "exten => $cfim_off,1, Macro(delete_cfim,$1)" >> $WORK_DIR/extensions_provider
echo "exten => $cfbs_off,1, Macro(delete_cfbs,$1)" >> $WORK_DIR/extensions_provider
echo "exten => $cfb_off,1, Macro(delete_cfb,$1)" >> $WORK_DIR/extensions_provider
fi
if [ -n "$internal_service" -a "$internal_service" = "1" ] ; then
sed -i "8s/.*/include => $1-callforwarding/" $WORK_DIR/extensions_provider
sed -i "10s/.*/include => $1-do_not_disturb/" $WORK_DIR/extensions_provider
# Configure call forwarding if enabled
if [ -n "$callforward_enabled" -a "$callforward_enabled" = "1" ] ; then
echo "[$1-callforwarding]" >> $WORK_DIR/extensions_provider
echo "exten => $cfim_off,1, Macro(delete_cfim,$1)" >> $WORK_DIR/extensions_provider
echo "exten => $cfbs_off,1, Macro(delete_cfbs,$1)" >> $WORK_DIR/extensions_provider
echo "exten => $cfb_off,1, Macro(delete_cfb,$1)" >> $WORK_DIR/extensions_provider
fi
# Configure call return if enabled
if [ -n "$callreturn_enabled" -a "$callreturn_enabled" = "1" ] ; then
echo "exten => $call_return,1, Macro(call_return,$1)" >> $WORK_DIR/extensions_provider
fi
# Configure call return if enabled
if [ -n "$callreturn_enabled" -a "$callreturn_enabled" = "1" ] ; then
echo "exten => $call_return,1, Macro(call_return,$1)" >> $WORK_DIR/extensions_provider
fi
# Configure redial if enabled
if [ -n "$redial_enabled" -a "$redial_enabled" = "1" ] ; then
echo "exten => $redial,1, Macro(redial,$1)" >> $WORK_DIR/extensions_provider
# Configure redial if enabled
if [ -n "$redial_enabled" -a "$redial_enabled" = "1" ] ; then
echo "exten => $redial,1, Macro(redial,$1)" >> $WORK_DIR/extensions_provider
fi
fi
echo "" >> $WORK_DIR/extensions_provider
......@@ -1074,12 +1084,13 @@ configure_extensions_provider() {
echo "" >> $WORK_DIR/extensions_provider
# Configure dnd
echo "[$1-do_not_disturb]" >> $WORK_DIR/extensions_provider
echo "exten => ${dnd_off},1, Macro(delete_dnd,$1)" >> $WORK_DIR/extensions_provider
echo "exten => ${dnd_on},1, Macro(create_dnd,$1)" >> $WORK_DIR/extensions_provider
echo "exten => ${dnd_status},1, Macro(status_dnd,$1)" >> $WORK_DIR/extensions_provider
echo "" >> $WORK_DIR/extensions_provider
if [ -n "$internal_service" -a "$internal_service" = "1" ] ; then
echo "[$1-do_not_disturb]" >> $WORK_DIR/extensions_provider
echo "exten => ${dnd_off},1, Macro(delete_dnd,$1)" >> $WORK_DIR/extensions_provider
echo "exten => ${dnd_on},1, Macro(create_dnd,$1)" >> $WORK_DIR/extensions_provider
echo "exten => ${dnd_status},1, Macro(status_dnd,$1)" >> $WORK_DIR/extensions_provider
echo "" >> $WORK_DIR/extensions_provider
fi
cat $WORK_DIR/extensions_provider >> $WORK_DIR/extensions.conf
config_get direct_dial $1 direct_dial
......@@ -1091,13 +1102,13 @@ configure_extensions_provider() {
if [ -n "$direct_dial" -o \( -n "$callforward_enabled" -a "$callforward_enabled" = "1" \) ] ; then
echo "[|PROVIDER|-direct]" > $WORK_DIR/extensions_direct
sed -i "s/|PROVIDER|/$1/" $WORK_DIR/extensions_direct
if [ -n "$callforward_enabled" -a "$callforward_enabled" = "1" ] ; then
echo "exten => _${cfim_on},1, Macro(create_cfim,$1)" >> $WORK_DIR/extensions_direct
echo "exten => _${cfbs_on},1, Macro(create_cfbs,$1)" >> $WORK_DIR/extensions_direct
echo "exten => _${cfb_on},1, Macro(create_cfb,$1)" >> $WORK_DIR/extensions_direct
if [ -n "$internal_service" -a "$internal_service" = "1" ] ; then
if [ -n "$callforward_enabled" -a "$callforward_enabled" = "1" ] ; then
echo "exten => _${cfim_on},1, Macro(create_cfim,$1)" >> $WORK_DIR/extensions_direct
echo "exten => _${cfbs_on},1, Macro(create_cfbs,$1)" >> $WORK_DIR/extensions_direct
echo "exten => _${cfb_on},1, Macro(create_cfb,$1)" >> $WORK_DIR/extensions_direct
fi
fi
for i in $direct_dial ; do
echo "Adding direct dial extension $i for $1"
if [ "${i:0:1}" != "_" ] ; then
......@@ -1368,6 +1379,7 @@ configure_tel_line() {
local sip_provider_enabled
local callwaiting_enabled
local do_not_disturb
local internal_service
local clir
config_get enabled $1 enabled "1"
......@@ -1380,6 +1392,7 @@ configure_tel_line() {
config_get offhook_silence_timeout $1 offhook_silence_timeout
config_get callwaiting_enabled $1 callwaiting_enabled
config_get do_not_disturb $1 do_not_disturb
config_get internal_service call_features internal_service
config_get clir $1 clir
#If line is configured with no sip_provider, or sip_provider is disabled, use local_extensions context
......@@ -1433,7 +1446,9 @@ configure_tel_line() {
sed -i "s/|OFFHOOK_SILENCE_TIMEOUT|/$offhook_silence_timeout/" $WORK_DIR/tel_line
sed -i "s/|DTMFRELAY|/$dtmfmode/" $WORK_DIR/tel_line
sed -i "s/|CALLWAITING|/$callwaiting_enabled/" $WORK_DIR/tel_line
sed -i "s/|DND|/$do_not_disturb/" $WORK_DIR/tel_line
if [ -n "$internal_service" -a "$internal_service" = "1" ] ; then
sed -i "15i do_not_disturb=$do_not_disturb" $WORK_DIR/tel_line
fi
sed -i "s/|CLIR|/$clir/" $WORK_DIR/tel_line
sed -i "s/|LINE_NAME|/$LINENAME/" $WORK_DIR/tel_line
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment