Merge branch 'kent_400' into devel

This commit is contained in:
Kent Ekholm 2019-03-18 13:27:22 +01:00
commit 40240bda8d
4 changed files with 61 additions and 41 deletions

View file

@ -6,7 +6,7 @@ autodial_timeoutmsec=|AUTODIAL_TIMEOUT|
dialtone_timeoutmsec=|DIALTONE_TIMEOUT| dialtone_timeoutmsec=|DIALTONE_TIMEOUT|
context=|CONTEXT| context=|CONTEXT|
context_direct=|CONTEXT|-direct context_direct=|CONTEXT|-direct
dialtone_extension_hint_context=brcm_dialtone dialtone_extension_hint_context=|LINE_NAME|_dialtone
dialtone_extension_hint=|DIALTONE_EXTENSION_HINT| dialtone_extension_hint=|DIALTONE_EXTENSION_HINT|
callwaiting=|CALLWAITING| callwaiting=|CALLWAITING|
clir=|CLIR| clir=|CLIR|

View file

@ -1,4 +1,4 @@
config 'brcm_line' 'brcm0' config 'tel_line' 'brcm0'
option 'extension' '0000' option 'extension' '0000'
option 'sip_account' 'sip0' option 'sip_account' 'sip0'
option 'noise' '0' option 'noise' '0'
@ -9,7 +9,7 @@ config 'brcm_line' 'brcm0'
option 'callwaiting' '0' option 'callwaiting' '0'
option 'clir' '0' option 'clir' '0'
config 'brcm_line' 'brcm1' config 'tel_line' 'brcm1'
option 'extension' '1111' option 'extension' '1111'
option 'sip_account' 'sip0' option 'sip_account' 'sip0'
option 'noise' '0' option 'noise' '0'
@ -20,7 +20,7 @@ config 'brcm_line' 'brcm1'
option 'callwaiting' '0' option 'callwaiting' '0'
option 'clir' '0' option 'clir' '0'
config 'brcm_line' 'brcm2' config 'tel_line' 'brcm2'
option 'extension' '2222' option 'extension' '2222'
option 'sip_account' 'sip0' option 'sip_account' 'sip0'
option 'noise' '0' option 'noise' '0'
@ -31,7 +31,7 @@ config 'brcm_line' 'brcm2'
option 'callwaiting' '0' option 'callwaiting' '0'
option 'clir' '0' option 'clir' '0'
config 'brcm_line' 'brcm3' config 'tel_line' 'brcm3'
option 'extension' '3333' option 'extension' '3333'
option 'sip_account' 'sip0' option 'sip_account' 'sip0'
option 'noise' '0' option 'noise' '0'
@ -42,7 +42,7 @@ config 'brcm_line' 'brcm3'
option 'callwaiting' '0' option 'callwaiting' '0'
option 'clir' '0' option 'clir' '0'
config 'brcm_line' 'brcm4' config 'tel_line' 'brcm4'
option 'extension' '4444' option 'extension' '4444'
option 'sip_account' 'sip0' option 'sip_account' 'sip0'
option 'noise' '0' option 'noise' '0'
@ -53,7 +53,7 @@ config 'brcm_line' 'brcm4'
option 'callwaiting' '0' option 'callwaiting' '0'
option 'clir' '0' option 'clir' '0'
config 'brcm_line' 'brcm5' config 'tel_line' 'brcm5'
option 'extension' '5555' option 'extension' '5555'
option 'sip_account' 'sip0' option 'sip_account' 'sip0'
option 'noise' '0' option 'noise' '0'
@ -64,7 +64,7 @@ config 'brcm_line' 'brcm5'
option 'callwaiting' '0' option 'callwaiting' '0'
option 'clir' '0' option 'clir' '0'
config 'brcm_line' 'brcm6' config 'tel_line' 'brcm6'
option 'extension' '6666' option 'extension' '6666'
option 'sip_account' 'sip0' option 'sip_account' 'sip0'
option 'noise' '0' option 'noise' '0'
@ -75,7 +75,7 @@ config 'brcm_line' 'brcm6'
option 'callwaiting' '0' option 'callwaiting' '0'
option 'clir' '0' option 'clir' '0'
config 'brcm_line' 'brcm7' config 'tel_line' 'brcm7'
option 'extension' '7777' option 'extension' '7777'
option 'sip_account' 'sip0' option 'sip_account' 'sip0'
option 'noise' '0' option 'noise' '0'
@ -116,7 +116,7 @@ config 'sip_advanced' 'SIP'
option 'dnsmgr_refresh_interval' '300' option 'dnsmgr_refresh_interval' '300'
option 'srvlookup' 'yes' option 'srvlookup' 'yes'
config 'brcm_advanced' 'BRCM' config 'tel_advanced' 'TEL'
option 'country' 'SWE' option 'country' 'SWE'
option 'jbenable' 'yes' option 'jbenable' 'yes'
option 'jbforce' 'no' option 'jbforce' 'no'

View file

@ -83,7 +83,7 @@ TMPL_CONFBRIDGE=$TEMPLATEDIR/confbridge.conf.TEMPLATE
TMPL_UDPTL=$TEMPLATEDIR/udptl.conf.TEMPLATE TMPL_UDPTL=$TEMPLATEDIR/udptl.conf.TEMPLATE
TMPL_CHANNEL=$TEMPLATEDIR/$(getLineName).conf.TEMPLATE TMPL_CHANNEL=$TEMPLATEDIR/$(getLineName).conf.TEMPLATE
TMPL_CHANNEL_LINE=$TEMPLATEDIR/$(getLineName)_line.TEMPLATE TMPL_CHANNEL_LINE=$TEMPLATEDIR/tel_line.TEMPLATE
TMPL_MEETME=$TEMPLATEDIR/meetme.conf.TEMPLATE TMPL_MEETME=$TEMPLATEDIR/meetme.conf.TEMPLATE
@ -1161,7 +1161,7 @@ configure_cdr()
configure_call_filters() configure_call_filters()
{ {
local country local country
config_get country $(getChannelName) country config_get country TEL country
# Read the International Dialing Code and the Country Code from config # Read the International Dialing Code and the Country Code from config
echo "Looking up IDC and CC for country $country" echo "Looking up IDC and CC for country $country"
@ -1837,7 +1837,7 @@ configure_codecs()
{ {
echo "Configuring codecs" echo "Configuring codecs"
local genericplc local genericplc
config_get genericplc $(getChannelName) genericplc config_get genericplc TEL genericplc
sed -i "s/|PLC|/$genericplc/" $WORKDIR/codecs.tmp sed -i "s/|PLC|/$genericplc/" $WORKDIR/codecs.tmp
} }
@ -1855,13 +1855,13 @@ configure_tel()
local dialoutmsec local dialoutmsec
local fac local fac
config_get jbenable $(getChannelName) jbenable config_get jbenable TEL jbenable
config_get jbforce $(getChannelName) jbforce config_get jbforce TEL jbforce
config_get jbmaxsize $(getChannelName) jbmaxsize config_get jbmaxsize TEL jbmaxsize
config_get jbimpl $(getChannelName) jbimpl config_get jbimpl TEL jbimpl
config_get dtmfmode SIP dtmfmode config_get dtmfmode SIP dtmfmode
config_get dialoutmsec $(getChannelName) dialoutmsec config_get dialoutmsec TEL dialoutmsec
config_get fac $(getChannelName) fac config_get fac TEL fac
CHANNEL_FAC="$CHANNEL_FAC $fac" CHANNEL_FAC="$CHANNEL_FAC $fac"
# Convert whitespace to commas # Convert whitespace to commas
@ -1938,30 +1938,30 @@ configure_tel_line()
clir=0 clir=0
fi fi
cp $TMPL_CHANNEL_LINE $WORKDIR/$(getLineName)_line.tmp cp $TMPL_CHANNEL_LINE $WORKDIR/tel_line.tmp
sed -i "s/|SECTION|/$1/" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|SECTION|/$1/" $WORKDIR/tel_line.tmp
sed -i "s/|CALLERID|/$extension/g" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|CALLERID|/$extension/g" $WORKDIR/tel_line.tmp
sed -i "s/|CONTEXT|/$sip_provider/g" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|CONTEXT|/$sip_provider/g" $WORKDIR/tel_line.tmp
sed -i "s/|DIALTONE_EXTENSION_HINT|/$1/" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|DIALTONE_EXTENSION_HINT|/$1/" $WORKDIR/tel_line.tmp
sed -i "s/|AUTODIAL|/$autodial/" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|AUTODIAL|/$autodial/" $WORKDIR/tel_line.tmp
sed -i "s/|AUTODIAL_TIMEOUT|/$autodial_timeout/" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|AUTODIAL_TIMEOUT|/$autodial_timeout/" $WORKDIR/tel_line.tmp
sed -i "s/|DIALTONE_TIMEOUT|/$dialtone_timeout/" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|DIALTONE_TIMEOUT|/$dialtone_timeout/" $WORKDIR/tel_line.tmp
sed -i "s/|DTMFRELAY|/$dtmfmode/" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|DTMFRELAY|/$dtmfmode/" $WORKDIR/tel_line.tmp
sed -i "s/|CALLWAITING|/$callwaiting/" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|CALLWAITING|/$callwaiting/" $WORKDIR/tel_line.tmp
sed -i "s/|CLIR|/$clir/" $WORKDIR/$(getLineName)_line.tmp sed -i "s/|CLIR|/$clir/" $WORKDIR/tel_line.tmp
sed -i "s/|LINE_NAME|/$(getLineName)/" $WORKDIR/tel_line.tmp
#Configure CHANNEL line with codecs according to the SIP line settings #Configure CHANNEL line with codecs according to the SIP line settings
# local is_fax # local is_fax
# config_get is_fax $sip_provider is_fax # config_get is_fax $sip_provider is_fax
# if [ -z "$is_fax" -o "$is_fax" = "1" ] ; then # if [ -z "$is_fax" -o "$is_fax" = "1" ] ; then
# sed -i "s/|ALLOW|/allow = ulaw\nallow = alaw/" $WORKDIR/$(getLineName)_line.tmp # sed -i "s/|ALLOW|/allow = ulaw\nallow = alaw/" $WORKDIR/tel_line.tmp
# else # else
# sed -i "s/|ALLOW|/$(read_codecs $sip_provider)/" $WORKDIR/$(getLineName)_line.tmp # sed -i "s/|ALLOW|/$(read_codecs $sip_provider)/" $WORKDIR/tel_line.tmp
# fi # fi
cat $WORKDIR/$(getLineName)_line.tmp >> $WORKDIR/$(getLineName).tmp cat $WORKDIR/tel_line.tmp >> $WORKDIR/$(getLineName).tmp
rm -f $WORKDIR/$(getLineName)_line.tmp rm -f $WORKDIR/tel_line.tmp
} }
# #
@ -2161,7 +2161,7 @@ start_service() {
# and delete non-existing lines from voice_client config # and delete non-existing lines from voice_client config
######################################################## ########################################################
local maxlinenum=$(db get hw.board.VoicePorts) local maxlinenum=$(db get hw.board.VoicePorts)
config_foreach set_line_name $(getLineName)_line $maxlinenum config_foreach set_line_name tel_line $maxlinenum
uci_commit voice_client uci_commit voice_client
####################################### #######################################
@ -2221,9 +2221,9 @@ start_service() {
# CHANNEL configuration # CHANNEL configuration
##################### #####################
configure_tel configure_tel
config_foreach configure_tel_line $(getLineName)_line config_foreach configure_tel_line tel_line
config_foreach configure_tel_line_extension $(getLineName)_line config_foreach configure_tel_line_extension tel_line
config_foreach create_extensions_dialtone $(getLineName)_line config_foreach create_extensions_dialtone tel_line
configure_codecs configure_codecs
########################### ###########################
@ -2298,7 +2298,7 @@ reload_service() {
sleep 1 sleep 1
asterisk -rx "core reload" asterisk -rx "core reload"
asterisk -rx "dialplan reload" asterisk -rx "dialplan reload"
asterisk -rx "$(getLineName) reload" asterisk -rx "$(getChipVendor) reload"
} }
service_triggers() { service_triggers() {

View file

@ -5,7 +5,7 @@
case "$1" in case "$1" in
list) list)
echo '{ "status" : {}, "lines" : {}, "codecs" : {}, "call_log" : {} }' echo '{ "status" : {}, "lines" : {}, "codecs" : {}, "call_log" : {}, "platform" : {} }'
;; ;;
call) call)
@ -126,6 +126,26 @@ case "$1" in
done < /var/log/asterisk/cdr-csv/Master.csv done < /var/log/asterisk/cdr-csv/Master.csv
json_dump json_dump
;; ;;
platform)
json_init
json_add_string platform "$(getLineName)"
case $(getLineName) in
"brcm")
json_add_int lineoffset 0
json_add_int chanoffset 0
;;
"tapi")
json_add_int lineoffset 1
json_add_int chanoffset -1
;;
*)
# Error, unknown platform
;;
esac
json_dump
;;
esac esac
;; ;;
esac esac