mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
BB: update voice-client package
This commit is contained in:
parent
c5094c630c
commit
498ad0be3e
11 changed files with 282 additions and 74 deletions
|
|
@ -85,6 +85,11 @@ comfortnoise=0
|
|||
; Maximum delay between on/off hook for detecting hook flash, milliseconds
|
||||
hfmaxdelay=500
|
||||
|
||||
; Feature Access Codes
|
||||
; DTMF tone sequences to be treated as feature access codes
|
||||
; The '.' character is used as wildcard
|
||||
featureaccesscodes = |FAC|
|
||||
|
||||
;
|
||||
; Unused/undocumented settings, do not uncomment/change these
|
||||
;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ exten => _[+0-9a-zA-Z].,1, |CUSTOM_INCOMING|
|
|||
|
||||
; Store caller id, and write to call log
|
||||
exten => _[+0-9a-zA-Z].,n, Set(DB(LASTCALLER/${CHANNEL(peername)})=${CALLERID(NUM)})
|
||||
exten => _[+0-9a-zA-Z].,n, Set(result=${SHELL(/usr/lib/asterisk/log_call.sh Incoming ${CALLERID(NUM)})})
|
||||
exten => _[+0-9a-zA-Z].,n, Set(result=${SHELL(/usr/lib/asterisk/log_call.sh Incoming ${CALLERID(NUM)} ${EXTEN})})
|
||||
|
||||
; Handle call - Goto(call_line,${EXTEN},1) or Macro(callhandler,${CHANNEL(peername)})
|
||||
exten => _[+0-9a-zA-Z].,n, |INCOMING_HANDLER|
|
||||
|
|
@ -38,4 +38,4 @@ exten => h,3, Hangup()
|
|||
[clir]
|
||||
|CLIR_FAC_SET|exten => _|CLIR|.,1, Set(CALLERID(num-pres)=prohib_not_screened)
|
||||
|CLIR_FAC_SET|exten => _|CLIR|.,n, Set(CALLERID(name-pres)=prohib_not_screened)
|
||||
|CLIR_FAC_SET|exten => _|CLIR|.,n, Goto(${EXTEN:4},1)
|
||||
|CLIR_FAC_SET|exten => _|CLIR|.,n, Goto(${EXTEN:|CLIR_FAC_LEN|},1)
|
||||
|
|
|
|||
|
|
@ -149,16 +149,14 @@ exten => s,n(call_cfbs), Dial(SIP/${linecfbs}@${ARG1})
|
|||
;
|
||||
; ${ARG1} - Extension
|
||||
;
|
||||
exten => s,1, Set(result=${SHELL(/usr/lib/asterisk/log_call.sh Incoming ${ARG1} Blocked)})
|
||||
exten => s,n, Congestion(10)
|
||||
exten => s,1, Congestion(10)
|
||||
exten => s,n, Hangup()
|
||||
|
||||
[macro-callhandler-outgoing-blocked]
|
||||
;
|
||||
; ${ARG1} - Extension
|
||||
;
|
||||
exten => s,1, Set(result=${SHELL(/usr/lib/asterisk/log_call.sh Outgoing ${ARG1} Blocked)})
|
||||
exten => s,n, Playtones(congestion)
|
||||
exten => s,1, Playtones(congestion)
|
||||
exten => s,n, Wait(5)
|
||||
exten => s,n, Congestion(10)
|
||||
exten => s,n, Hangup()
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ include => |PROVIDER|-outgoing
|
|||
|
||||
[|PROVIDER|-transfer]
|
||||
; Context used for call transfer for this Provider
|
||||
include => local_extensions
|
||||
include => |PROVIDER|-transfer-remote
|
||||
|
||||
[|PROVIDER|-transfer-remote]
|
||||
; Context used for call transfer to remote extension for this Provider
|
||||
exten => _X.,1, Transfer(SIP/${EXTEN}@|PROVIDER|,,)
|
||||
|
||||
[|PROVIDER|-outgoing]
|
||||
|
|
@ -17,7 +22,7 @@ exten => _X.,1, Transfer(SIP/${EXTEN}@|PROVIDER|,,)
|
|||
exten => _[*#0-9].,1, Set(DIAL_EXTEN=${EXTEN})
|
||||
exten => _[*#0-9].,n, |CUSTOM_OUTGOING|
|
||||
exten => _[*#0-9].,n, |CALL_FILTER|
|
||||
exten => _[*#0-9].,n, Set(result=${SHELL(/usr/lib/asterisk/log_call.sh Outgoing ${DIAL_EXTEN})})
|
||||
exten => _[*#0-9].,n, Set(result=${SHELL(/usr/lib/asterisk/log_call.sh Outgoing |USERNAME| ${DIAL_EXTEN})})
|
||||
exten => _[*#0-9].,n, Set(DB(LASTCALL/|PROVIDER|)=${DIAL_EXTEN})
|
||||
exten => _[*#0-9].,n, Set(CALLERID(name)=|DISPLAYNAME|)
|
||||
exten => _[*#0-9].,n, Set(__TRANSFER_CONTEXT=|PROVIDER|-transfer)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
[general]
|
||||
pickupexten = ;Disabled
|
||||
|
||||
[featuremap]
|
||||
;blindxfer => |BLINDXFER| ;Blind transfer (default is #)
|
||||
blindxfer => |BLINDXFER| ;Blind transfer (default is #)
|
||||
disconnect => ;Disabled
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
[rooms]
|
||||
|
|
@ -157,9 +157,3 @@ config log 'LOG'
|
|||
option syslog_facility 'local0'
|
||||
option syslog ''
|
||||
|
||||
config cbbs_localextensions 'cbbs_localextensions'
|
||||
option name 'Local Extensions'
|
||||
option cbbs_key '5'
|
||||
option cbbs_maxretry '5'
|
||||
option cbbs_retrytime '30'
|
||||
option cbbs_waittime '20'
|
||||
|
|
|
|||
49
voice-client/files/etc/config/voice_codecs
Normal file
49
voice-client/files/etc/config/voice_codecs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
config supported_codec 'ulaw'
|
||||
option name 'G.711MuLaw'
|
||||
option ptime_min '10'
|
||||
option ptime_max '150'
|
||||
option ptime_default '20'
|
||||
option ptime_increment '10'
|
||||
|
||||
config supported_codec 'alaw'
|
||||
option name 'G.711ALaw'
|
||||
option ptime_min '10'
|
||||
option ptime_max '150'
|
||||
option ptime_default '20'
|
||||
option ptime_increment '10'
|
||||
|
||||
config supported_codec 'g729'
|
||||
option name 'G.729a'
|
||||
option ptime_min '10'
|
||||
option ptime_max '230'
|
||||
option ptime_default '20'
|
||||
option ptime_increment '10'
|
||||
|
||||
config supported_codec 'g723'
|
||||
option name 'G.723.1'
|
||||
option ptime_min '30'
|
||||
option ptime_max '300'
|
||||
option ptime_default '30'
|
||||
option ptime_increment '30'
|
||||
|
||||
config supported_codec 'g726'
|
||||
option name 'G.726'
|
||||
option ptime_min '10'
|
||||
option ptime_max '300'
|
||||
option ptime_default '20'
|
||||
option ptime_increment '10'
|
||||
option bitrate '32'
|
||||
|
||||
config supported_codec 'gsm'
|
||||
option name 'GSM'
|
||||
option ptime_min '10'
|
||||
option ptime_max '300'
|
||||
option ptime_default '20'
|
||||
option ptime_increment '10'
|
||||
|
||||
config supported_codec 'ilbc'
|
||||
option name 'iLBC'
|
||||
option ptime_min '10'
|
||||
option ptime_max '300'
|
||||
option ptime_default '20'
|
||||
option ptime_increment '10'
|
||||
25
voice-client/files/etc/idc_cc.cfg
Normal file
25
voice-client/files/etc/idc_cc.cfg
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
AUS;0011;61
|
||||
BEL;00;32
|
||||
BRA;00;55
|
||||
CHL;1xx0;56
|
||||
CHN;00;86
|
||||
CZE;00;420
|
||||
DNK;00;45
|
||||
ETS;00;372
|
||||
FIN;00,99x,99xx,99xxx;358
|
||||
FRA;00;33
|
||||
DEU;00;49
|
||||
HUN;00;36
|
||||
IND;00;91
|
||||
ITA;00;39
|
||||
JPN;010;81
|
||||
NLD;00;31
|
||||
NZL;00;64
|
||||
USA;011;1
|
||||
ESP;00;34
|
||||
SWE;00;46
|
||||
CHE;00;41
|
||||
NOR;00;47
|
||||
TWN;00x;886
|
||||
GBR;00;44
|
||||
ARE;00;971
|
||||
|
|
@ -29,6 +29,9 @@ ASTERISKDIR=/etc/asterisk
|
|||
WORKDIR=/tmp/$MODULENAME.$$
|
||||
MD5SUMSFILE=/tmp/$MODULENAME-sums.$$
|
||||
|
||||
# Whitespace separated list of BRCM feature access codes
|
||||
BRCM_FAC=
|
||||
|
||||
#TODO: go through templates, check usage
|
||||
|
||||
TMPL_EXTENSIONS=$TEMPLATEDIR/extensions.conf.TEMPLATE
|
||||
|
|
@ -55,6 +58,8 @@ TMPL_DNSMGR=$TEMPLATEDIR/dnsmgr.conf.TEMPLATE
|
|||
TMPL_VOICEMAIL=$TEMPLATEDIR/voicemail.conf.TEMPLATE
|
||||
TMPL_VOICEMAIL_MAILBOX=$TEMPLATEDIR/voicemail_mailbox.TEMPLATE
|
||||
|
||||
TMPL_MEETME=$TEMPLATEDIR/meetme.conf.TEMPLATE
|
||||
|
||||
TMPL_QUEUES=$TEMPLATEDIR/queues.conf.TEMPLATE
|
||||
TMPL_QUEUE=$TEMPLATEDIR/queue.TEMPLATE
|
||||
|
||||
|
|
@ -164,6 +169,7 @@ assemble_and_copy_config()
|
|||
mv $WORKDIR/res_stun_monitor.tmp $WORKDIR/res_stun_monitor.conf
|
||||
mv $WORKDIR/features.tmp $WORKDIR/features.conf
|
||||
mv $WORKDIR/voicemail.tmp $WORKDIR/voicemail.conf
|
||||
mv $WORKDIR/meetme.tmp $WORKDIR/meetme.conf
|
||||
mv $WORKDIR/logger.tmp $WORKDIR/logger.conf
|
||||
mv $WORKDIR/queues.tmp $WORKDIR/queues.conf
|
||||
mv $WORKDIR/dnsmgr.tmp $WORKDIR/dnsmgr.conf
|
||||
|
|
@ -554,7 +560,17 @@ restore_secret()
|
|||
{
|
||||
local section_found
|
||||
local secret
|
||||
local config_file
|
||||
# Provide backwards compatibility
|
||||
if [ -f "$ASTERISKDIR/sip_providers.conf" ] ; then
|
||||
config_file=$ASTERISKDIR/sip_providers.conf
|
||||
elif [ -f "$ASTERISKDIR/sip_peers.conf" ] ; then
|
||||
config_file=$ASTERISKDIR/sip_peers.conf
|
||||
else
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -f $config_file ] ; then
|
||||
while read line
|
||||
do
|
||||
if [ -n "$section_found" ] ; then
|
||||
|
|
@ -568,7 +584,7 @@ restore_secret()
|
|||
#we found the correct section
|
||||
section_found=1
|
||||
fi
|
||||
done < $ASTERISKDIR/sip_providers.conf
|
||||
done < $config_file
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -718,10 +734,10 @@ configure_sip_provider()
|
|||
fi
|
||||
|
||||
# Set or remove encryption
|
||||
if [ -z "$encryption" ] ; then
|
||||
if [ -z "$encryption" -o "$encryption" == "0" ] ; then
|
||||
sed -i "/|ENCRYPTION|/d" $WORKDIR/sip_provider.tmp
|
||||
else
|
||||
sed -i "s/|ENCRYPTION|/$encryption/g" $WORKDIR/sip_provider.tmp
|
||||
sed -i "s/|ENCRYPTION|/yes/g" $WORKDIR/sip_provider.tmp
|
||||
fi
|
||||
|
||||
# Force ulaw/alaw if fax, otherwise read selected codecs
|
||||
|
|
@ -966,6 +982,10 @@ configure_queue()
|
|||
|
||||
echo "[macro-$1]" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,1,Answer()" >> $WORKDIR/macros.tmp
|
||||
|
||||
# Workaround to fix no ringback issue for incoming SIP calls
|
||||
echo "exten => s,n,Playback(silence/1)" >> $WORKDIR/macros.tmp
|
||||
|
||||
echo "exten => s,n,Queue($1,R)" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n,MacroExit()" >> $WORKDIR/macros.tmp
|
||||
echo "" >> $WORKDIR/macros.tmp
|
||||
|
|
@ -1044,6 +1064,58 @@ configure_sip_user()
|
|||
rm -f $WORKDIR/sip_user.tmp
|
||||
}
|
||||
|
||||
#
|
||||
# Install common macros used by call filters
|
||||
#
|
||||
configure_call_filters()
|
||||
{
|
||||
local country
|
||||
config_get country BRCM country
|
||||
# Read the International Dialing Code and the Country Code from config
|
||||
|
||||
echo "Looking up IDC and CC for country $country"
|
||||
while read line
|
||||
do
|
||||
i=0
|
||||
for v in $(echo $line | tr ";" "\n")
|
||||
do
|
||||
if [ "$i" -eq "0" -a "$v" != "$country" ] ; then
|
||||
continue 2
|
||||
fi
|
||||
if [ "$i" -eq "1" ] ; then
|
||||
idc=$v
|
||||
fi
|
||||
if [ "$i" -eq "2" ] ; then
|
||||
cc=$v
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
if [ -n "$idc" -a -n "$cc" ] ; then
|
||||
# IDC and CC found
|
||||
break
|
||||
fi
|
||||
done < "/etc/idc_cc.cfg"
|
||||
|
||||
echo "Found IDCs: $idc"
|
||||
echo "Found CCs: $cc"
|
||||
|
||||
echo "[macro-check-foreign]" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,1,NoOp()" >> $WORKDIR/macros.tmp
|
||||
|
||||
# Create regex patterns
|
||||
# All x characters are replaced with [0-9] to match a single digit
|
||||
idc="($(echo $idc | tr -s "" | tr "," "|" | sed 's/x/[0-9]/g'))"
|
||||
cc="($(echo $cc | tr -s "" | tr "," "|"))"
|
||||
|
||||
echo "exten => s,n,GotoIf($[\"\${ARG1}\":\"($idc[0-9]+)\">0]?international:not-foreign)" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n(international),GotoIf($[\"\${ARG1}\":\"(${idc}${cc}[0-9]+)\">0]?not-foreign)" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n,Set(FOREIGN=1)" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n,MacroExit()" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n(not-foreign),Set(FOREIGN=0)" >> $WORKDIR/macros.tmp
|
||||
echo "" >> $WORKDIR/macros.tmp
|
||||
}
|
||||
|
||||
#
|
||||
# Install call filter macros
|
||||
#
|
||||
|
|
@ -1060,7 +1132,12 @@ configure_call_filter()
|
|||
#
|
||||
configure_call_filter_helper()
|
||||
{
|
||||
local sip_provider filter_mode goto_label
|
||||
local block_foreign
|
||||
local block_special_rate
|
||||
|
||||
config_get block_foreign $1 block_foreign
|
||||
config_get block_special_rate $1 block_special_rate
|
||||
|
||||
[ "$#" -ge 2 ] || return 0
|
||||
|
||||
direction=$2
|
||||
|
|
@ -1068,69 +1145,49 @@ configure_call_filter_helper()
|
|||
return
|
||||
fi
|
||||
|
||||
echo "[macro-$1-$direction-call-filter]" >> $WORKDIR/macros.tmp
|
||||
echo "[macro-$1-$direction]" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,1,NoOp()" >> $WORKDIR/macros.tmp
|
||||
|
||||
config_get filter_mode $1 $direction
|
||||
if [ "x$filter_mode" == "xblacklist" ] ; then
|
||||
goto_label="block"
|
||||
fi
|
||||
if [ "x$filter_mode" == "xwhitelist" ] ; then
|
||||
goto_label="pass"
|
||||
if [ "x$direction" == "xoutgoing" -a "x$block_foreign" == "x1" ] ; then
|
||||
echo "exten => s,n,Macro(check-foreign,\${DIAL_EXTEN})" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n,GotoIf($[\${FOREIGN}==1]?block)" >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
|
||||
if [ -z "$goto_label" ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
local section cfgtype owner tmp
|
||||
local section cfgtype owner
|
||||
for section in ${CONFIG_SECTIONS}; do
|
||||
config_get cfgtype "$section" TYPE
|
||||
[ "x$cfgtype" != "xcall_filter_rule" ] && continue
|
||||
[ "x$cfgtype" != "xcall_filter_rule_$direction" ] && continue
|
||||
config_get owner $section owner
|
||||
if [ "x$owner" == "x$1" ] ; then
|
||||
local rule_direction rule_user rule_extension rule_enabled
|
||||
config_get rule_direction $section direction
|
||||
config_get rule_user $section user
|
||||
local rule_extension rule_enabled
|
||||
config_get rule_extension $section extension
|
||||
config_get rule_enabled $section enabled
|
||||
|
||||
[ "x$rule_direction" != "x$direction" ] && continue
|
||||
|
||||
[ -z "$rule_enabled" -o "$rule_enabled" = "0" ] && continue
|
||||
|
||||
# Regular expression for matching calling or called number
|
||||
regexp="$rule_extension[0-9]*"
|
||||
regexp=$(echo $rule_extension | sed 's/#.*/\[0-9\]*/')
|
||||
|
||||
if [ "x$rule_direction" == "xoutgoing" ] ; then
|
||||
if [ "x$rule_user" == "x*" ] ; then
|
||||
tmp="exten => s,n,GotoIf($[\"\${DIAL_EXTEN}\":\"$regexp\">0]?$goto_label)"
|
||||
echo $tmp >> $WORKDIR/macros.tmp
|
||||
else
|
||||
tmp="exten => s,n,GotoIf($[$[\"\${DIAL_EXTEN}\":\"$regexp\">0] &"
|
||||
tmp="$tmp $[\"\${CHANNEL}\":\"$rule_user/[0-9]+|$rule_user-[0-9]+\">0]]?$goto_label)"
|
||||
echo $tmp >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
if [ "x$direction" == "xoutgoing" ] ; then
|
||||
cmd="GotoIf($[\"\${DIAL_EXTEN}\":\"$regexp\">0]?block)"
|
||||
echo "exten => s,n,$cmd" >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
|
||||
if [ "x$rule_direction" == "xincoming" ] ; then
|
||||
tmp="exten => s,n,GotoIf($[\"\${CALLERID(num)}\":\"$regexp\">0]?$goto_label)"
|
||||
echo $tmp >> $WORKDIR/macros.tmp
|
||||
if [ "x$direction" == "xincoming" ] ; then
|
||||
cmd="GotoIf($[\"\${CALLERID(num)}\":\"$regexp\">0]?block)"
|
||||
echo "exten => s,n,$cmd" >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "x$filter_mode" == "xblacklist" ] ; then
|
||||
echo "exten => s,n,Goto(pass)" >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
echo "exten => s,n,MacroExit()" >> $WORKDIR/macros.tmp
|
||||
if [ "x$direction" == "xincoming" ] ; then
|
||||
tmp="exten => s,n(block),Macro(callhandler-incoming-blocked,\${CALLERID(num)})"
|
||||
echo $tmp >> $WORKDIR/macros.tmp
|
||||
cmd="Macro(callhandler-incoming-blocked,\${CALLERID(num)})"
|
||||
echo "exten => s,n(block),$cmd" >> $WORKDIR/macros.tmp
|
||||
else
|
||||
tmp="exten => s,n(block),Macro(callhandler-outgoing-blocked,\${DIAL_EXTEN})"
|
||||
echo $tmp >> $WORKDIR/macros.tmp
|
||||
cmd="Macro(callhandler-outgoing-blocked,\${DIAL_EXTEN})"
|
||||
echo "exten => s,n(block),$cmd" >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
echo "exten => s,n(pass),NoOp()" >> $WORKDIR/macros.tmp
|
||||
}
|
||||
|
||||
get_call_filter()
|
||||
|
|
@ -1146,11 +1203,7 @@ get_call_filter()
|
|||
local call_filter enabled
|
||||
config_get call_filter $provider call_filter
|
||||
if ! [ -z "$call_filter" ] ; then
|
||||
# check if call filter is enabled
|
||||
config_get enabled $call_filter enabled
|
||||
if [ "x$enabled" = "x1" ] ; then
|
||||
macro="Macro($call_filter-$direction-call-filter)"
|
||||
fi
|
||||
macro="Macro($call_filter-$direction)"
|
||||
fi
|
||||
echo $macro
|
||||
}
|
||||
|
|
@ -1264,6 +1317,8 @@ configure_extensions()
|
|||
if [ -n "$clir" -a "$clir" != "" ] ; then
|
||||
sed -i "s/|CLIR_FAC_SET|//" $WORKDIR/extensions.tmp
|
||||
sed -i "s/|CLIR|/$clir/" $WORKDIR/extensions.tmp
|
||||
sed -i "s/|CLIR_FAC_LEN|/${#clir}/" $WORKDIR/extensions.tmp
|
||||
BRCM_FAC="$BRCM_FAC $clir."
|
||||
else
|
||||
sed -i "s/|CLIR_FAC_SET|/;/" $WORKDIR/extensions.tmp
|
||||
fi
|
||||
|
|
@ -1375,6 +1430,7 @@ configure_extensions_provider()
|
|||
|
||||
#common settings
|
||||
sed -i "s/|PROVIDER|/$1/g" $WORKDIR/extensions_provider.tmp
|
||||
sed -i "s/|USERNAME|/$user_without_suffix/g" $WORKDIR/extensions_provider.tmp
|
||||
sed -i "s/|CUSTOM_OUTGOING|/$custom_outgoing/" $WORKDIR/extensions_provider.tmp
|
||||
sed -i "s/|CALL_FILTER|/$call_filter_macro/" $WORKDIR/extensions_provider.tmp
|
||||
sed -i "s/|DISPLAYNAME|/$(escape_sed_substitution $displayname)/" $WORKDIR/extensions_provider.tmp
|
||||
|
|
@ -1438,13 +1494,19 @@ configure_extensions_provider()
|
|||
|
||||
local call_lines call_ivr call_queue extension
|
||||
echo "exten => $user,n,Set(__TRANSFER_CONTEXT=\${CHANNEL(peername)}-transfer)" >> $tmp
|
||||
|
||||
# replace prefix '+' with '00'
|
||||
echo "exten => $user,n,GotoIf($[\"\${CALLERID(NUM):0:1}\" = \"+\"]?rewrite:norewrite)" >> $tmp
|
||||
echo "exten => $user,n(rewrite),Set(CALLERID(num)=\"00\${CALLERID(num):1}\"))" >> $tmp
|
||||
echo "exten => $user,n(norewrite),NoOp()">> $tmp
|
||||
|
||||
config_get call_lines $1 call_lines
|
||||
config_get call_queue $1 call_queue
|
||||
config_get call_ivr $1 call_ivr
|
||||
if ! [ -z "$call_lines" ] ; then
|
||||
# read a list of lines that should be dialled on incoming calls
|
||||
incoming_lines=$(read_lines $1)
|
||||
echo "exten => $user,n,Dial($incoming_lines,$(get_voicemail_timeout),t)" >> $tmp
|
||||
echo "exten => $user,n,Dial($incoming_lines,$(get_voicemail_timeout),tF(hangup,h,2))" >> $tmp
|
||||
echo "exten => $user,n,GotoIf($[\"\${DIALSTATUS}\"=\"ANSWER\"]?endcall)" >> $tmp
|
||||
echo "exten => $user,n,GotoIf($[\"\${DIALSTATUS}\"=\"BUSY\"]?noanswer)" >> $tmp
|
||||
echo "exten => $user,n,GotoIf($[\"\${DIALSTATUS}\"=\"NOANSWER\"]?noanswer:endcall)" >> $tmp
|
||||
|
|
@ -1601,6 +1663,7 @@ configure_brcm()
|
|||
local jbimpl
|
||||
local dtmfcompatibility
|
||||
local dialoutmsec
|
||||
local fac
|
||||
|
||||
config_get country BRCM country
|
||||
config_get jbenable BRCM jbenable
|
||||
|
|
@ -1609,8 +1672,11 @@ configure_brcm()
|
|||
config_get jbimpl BRCM jbimpl
|
||||
config_get dtmfmode SIP dtmfmode
|
||||
config_get dialoutmsec BRCM dialoutmsec
|
||||
config_get fac BRCM fac
|
||||
|
||||
endptcfg $country
|
||||
BRCM_FAC="$BRCM_FAC $fac"
|
||||
# Convert whitespace to commas
|
||||
BRCM_FAC=$(echo $BRCM_FAC | sed -e 's/^ *//' -e 's/ *$//' | tr -s ' ' | tr ' ' ',')
|
||||
|
||||
if [ -z "$dialoutmsec" ] ; then
|
||||
dialoutmsec=4000
|
||||
|
|
@ -1622,6 +1688,7 @@ configure_brcm()
|
|||
sed -i "s/|JBMAXSIZE|/$jbmaxsize/" $WORKDIR/brcm.tmp
|
||||
sed -i "s/|JBIMPL|/$jbimpl/" $WORKDIR/brcm.tmp
|
||||
sed -i "s/|DIALOUTMSEC|/$dialoutmsec/" $WORKDIR/brcm.tmp
|
||||
sed -i "s/|FAC|/$BRCM_FAC/" $WORKDIR/brcm.tmp
|
||||
|
||||
if [ "$dtmfmode" == "compatibility" ] ; then
|
||||
dtmfcompatibility="1"
|
||||
|
|
@ -1765,6 +1832,52 @@ get_voicemail_timeout()
|
|||
fi
|
||||
}
|
||||
|
||||
configure_conference()
|
||||
{
|
||||
local extension moh
|
||||
config_get extension conference extension
|
||||
config_get moh conference moh
|
||||
|
||||
if [ -z "$extension" -o "x$extension" == "x" ] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
options="Ip"
|
||||
if [ "x$moh" == "x1" ] ; then
|
||||
options="${options}M"
|
||||
fi
|
||||
|
||||
echo "Configuring conference"
|
||||
echo "exten => $extension,1,Answer()" >> $WORKDIR/extensions_local.tmp
|
||||
echo "exten => $extension,n,Playback(conf-getconfno)" >> $WORKDIR/extensions_local.tmp
|
||||
echo "exten => $extension,n(enterno),Read(confno,,5)" >> $WORKDIR/extensions_local.tmp
|
||||
|
||||
for section in ${CONFIG_SECTIONS}; do
|
||||
config_get cfgtype "$section" TYPE
|
||||
[ "x$cfgtype" != "xconference_room" ] && continue
|
||||
|
||||
local name id enabled
|
||||
config_get name $section name
|
||||
config_get id $section id
|
||||
config_get enabled $section enabled
|
||||
|
||||
[ -z "$enabled" -o "$enabled" != "1" ] && continue
|
||||
|
||||
echo "Enabling conference room $id"
|
||||
echo "exten => $extension,n,GotoIf($[\"\${confno}\"=\"$id\"]?enterconf)" >> $WORKDIR/extensions_local.tmp
|
||||
echo "conf => $id" >> $WORKDIR/meetme.tmp
|
||||
done
|
||||
|
||||
echo "exten => $extension,n,Playback(conf-invalid)" >> $WORKDIR/extensions_local.tmp
|
||||
echo "exten => $extension,n,Goto(enterno)" >> $WORKDIR/extensions_local.tmp
|
||||
|
||||
# Enter the caller into a MeetMe conference.
|
||||
# It is possible to use the ConfBridge 1.8 application instead.
|
||||
# Just make sure to update the $options variable.
|
||||
echo "exten => $extension,n(enterconf),MeetMe(\${confno},$options)" >> $WORKDIR/extensions_local.tmp
|
||||
echo "exten => $extension,n,Hangup()" >> $WORKDIR/extensions_local.tmp
|
||||
}
|
||||
|
||||
#Create an extension "hint" to allow dialtone to be set according to sip provider reg status
|
||||
create_extensions_dialtone()
|
||||
{
|
||||
|
|
@ -1881,6 +1994,7 @@ start() {
|
|||
cp $TMPL_CODECS $WORKDIR/codecs.tmp
|
||||
cp $TMPL_VOICEMAIL $WORKDIR/voicemail.tmp
|
||||
cp $TMPL_DNSMGR $WORKDIR/dnsmgr.tmp
|
||||
cp $TMPL_MEETME $WORKDIR/meetme.tmp
|
||||
touch $WORKDIR/sip_providers.tmp
|
||||
touch $WORKDIR/sip_registrations.tmp
|
||||
touch $WORKDIR/sip_users.tmp
|
||||
|
|
@ -1891,6 +2005,7 @@ start() {
|
|||
###########################
|
||||
# Call Filter configuration
|
||||
###########################
|
||||
configure_call_filters
|
||||
config_foreach configure_call_filter call_filter
|
||||
|
||||
#########################
|
||||
|
|
@ -1928,6 +2043,11 @@ start() {
|
|||
configure_voicemail
|
||||
config_foreach configure_mailbox mailbox
|
||||
|
||||
############
|
||||
# Conference
|
||||
############
|
||||
configure_conference
|
||||
|
||||
######
|
||||
# IVR
|
||||
######
|
||||
|
|
|
|||
|
|
@ -7,34 +7,43 @@
|
|||
# at 100 rows. Some very basic concurrency is supported.
|
||||
#
|
||||
# Usage:
|
||||
# log_call.sh Direction Number [Note]
|
||||
# log_call.sh Direction From To [Note]
|
||||
#
|
||||
# Examples:
|
||||
# ./log_call Incoming 07012345678
|
||||
# ./log_call Outgoing 07876543210 Blocked
|
||||
# ./log_call Incoming 07012345678 07876543210
|
||||
# ./log_call Outgoing 07876543210 07012345678 Blocked
|
||||
#####################################################
|
||||
|
||||
#Check that there is a direction specified
|
||||
# Check that there is a direction specified
|
||||
if [ -z "$1" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Check that there is a number specified
|
||||
# Check that there is a calling number specified
|
||||
if [ -z "$2" ] ; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Check that there is a called number specified
|
||||
if [ -z "$3" ] ; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
direction=$1
|
||||
|
||||
# Remove any suffix starting with an underscore
|
||||
from=$(echo $2 | sed 's/_.*//')
|
||||
to=$(echo $3 | sed 's/_.*//')
|
||||
|
||||
note=$4
|
||||
|
||||
logfile="/var/call_log"
|
||||
tempfile=$(mktemp)
|
||||
now=$(date)
|
||||
|
||||
for i in 1 2 3 4 5 ; do
|
||||
if mkdir /var/lock/log_call.lck ; then
|
||||
if ! [ -z $3 ] ; then
|
||||
echo "$now;$1;$2;$3" >> $tempfile
|
||||
else
|
||||
echo "$now;$1;$2" >> $tempfile
|
||||
fi
|
||||
echo "$now;$direction;$from;$to;$note" >> $tempfile
|
||||
head -n99 $logfile >> $tempfile
|
||||
mv $tempfile $logfile
|
||||
rmdir /var/lock/log_call.lck
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue