Commit ef1429ad authored by Hemlata's avatar Hemlata Committed by Yalu Zhang
Browse files

Set default values properly if the config options are missing

InterDigitTimerOpen, MaximumNumberOfDigits, MinimumNumberOfDigits and other placeholders
parent 0d730a68
[|SECTION|]
enabled = |ENABLED|
;language=|LANGUAGE|
callerid=|CALLERID|
autodial=|AUTODIAL|
autodial_timeoutmsec=|AUTODIAL_TIMEOUT|
......@@ -17,5 +16,4 @@ calleridenable=|CALLERIDENABLE|
calleridnameenable=|CALLERNAMEENABLE|
dtmfrelay=|DTMFRELAY|
do_not_disturb=|DO_NOT_DISTURB|
;|ALLOW|
......@@ -924,11 +924,16 @@ configure_extensions_provider() {
# setting of the numbering plan value
if [ -n "$maxnumdigits" ] ; then
sed -i "s/|MAXDIGITS|/$maxnumdigits/g" $WORK_DIR/extensions_provider
sed -i "s/|MAXDIGITS|/$maxnumdigits/g" $WORK_DIR/extensions_provider
else
sed -i "s/|MAXDIGITS|/15/g" $WORK_DIR/extensions_provider
fi
#configure outgoing map
config_foreach configure_outgoingmap outgoing_map $1 $user
#set default to empty if not present
sed -i "s/|PROVIDER|//g" $WORK_DIR/extensions_provider
#common settings
sed -i "s/|USERNAME|/$user/g" $WORK_DIR/extensions_provider
sed -i "s/|CUSTOM_OUTGOING|/$custom_outgoing/" $WORK_DIR/extensions_provider
......@@ -1224,8 +1229,10 @@ configure_feature_set(){
sed -i "s/|CLIR|/$anonymous_call_enable/" $WORK_DIR/extensions.conf
sed -i "s/|CLIR_FAC_LEN|/${#anonymous_call_enable}/" $WORK_DIR/extensions.conf
channel_fac="$channel_fac $anonymous_call_enable."
else
sed -i "s/|CLIR_FAC_SET|/;/" $WORK_DIR/extensions.conf
else #set values to empty
sed -i "s/|CLIR_FAC_SET|/;/" $WORK_DIR/extensions.conf
sed -i "s/|CLIR|//" $WORK_DIR/extensions.conf
sed -i "s/|CLIR_FAC_LEN|//" $WORK_DIR/extensions.conf
fi
# Configure tone
......@@ -1306,7 +1313,9 @@ configure_feature_set(){
if [ -n "$internal_service" -a "$internal_service" = "1" ] ; then
sed -i "s/|DO_NOT_DISTURB|/$do_not_disturb/" $WORK_DIR/chan_telephony.conf
fi
else #set values to empty if not provided
sed -i "s/|DO_NOT_DISTURB|//" $WORK_DIR/chan_telephony.conf
fi
}
......@@ -1459,12 +1468,18 @@ configure_tel_options() {
if [ -n "$interdigitopenmsec" ]; then
sed -i "s/|INTERDIGITOPENMSEC|/$interdigitopenmsec/" $WORK_DIR/chan_telephony.conf
else
sed -i "s/|INTERDIGITOPENMSEC|/3000/" $WORK_DIR/chan_telephony.conf
fi
if [ -n "$minimumnumberdigits" ] ; then
sed -i "46i minimumnumberdigits =$minimumnumberdigits" $WORK_DIR/chan_telephony.conf
else
sed -i "46i minimumnumberdigits =1" $WORK_DIR/chan_telephony.conf
fi
if [ -n "$terminationdigit" ] ; then
sed -i "46i terminationdigit =$terminationdigit" $WORK_DIR/chan_telephony.conf
else
sed -i "46i terminationdigit =#" $WORK_DIR/chan_telephony.conf
fi
if [ -n "${calleridtype}" ] ; then
......@@ -1640,6 +1655,13 @@ configure_tel_line() {
sed -i "s/|DTMFRELAY|/$dtmfmode/" $WORK_DIR/tel_line
sed -i "s/|LINE_NAME|/$LINENAME/" $WORK_DIR/tel_line
#set values to empty by default is not provided
sed -i "s/|CALLWAITING|//" $WORK_DIR/tel_line
sed -i "s/|CALLERIDENABLE|//" $WORK_DIR/tel_line
sed -i "s/|CALLERNAMEENABLE|//" $WORK_DIR/tel_line
sed -i "s/|ANONYMOUSCALLENABLE|//" $WORK_DIR/tel_line
sed -i "s/|CALLERID|//g" $WORK_DIR/tel_line
sed -i "s/|CONTEXT|//g" $WORK_DIR/tel_line
cat $WORK_DIR/tel_line >> $WORK_DIR/chan_telephony.conf
}
......
Markdown is supported
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