Compare commits

...

2 Commits

Author SHA1 Message Date
Sukru Senli
145016ea2e voice-client: make line indexing platform independent 2019-06-05 13:47:18 +02:00
Sukru Senli
6bad18a68d voice-client: update default config 2019-06-05 13:46:43 +02:00
2 changed files with 173 additions and 222 deletions

View File

@@ -1,138 +1,138 @@
config 'tel_line' 'brcm0' config tel_line 'brcm0'
option 'extension' '0000' option extension '0000'
option 'sip_account' 'sip0' option noise '0'
option 'noise' '0' option vad '0'
option 'vad' '0' option txgain 4
option 'txgain' 4 option rxgain 4
option 'rxgain' 4 option echo_cancel 1
option 'echo_cancel' 1 option callwaiting '0'
option 'callwaiting' '0' option clir '0'
option 'clir' '0' option sip_account 'sip0'
config 'tel_line' 'brcm1' config tel_line 'brcm1'
option 'extension' '1111' option extension '1111'
option 'sip_account' 'sip0' option noise '0'
option 'noise' '0' option vad '0'
option 'vad' '0' option txgain 4
option 'txgain' 4 option rxgain 4
option 'rxgain' 4 option echo_cancel 1
option 'echo_cancel' 1 option callwaiting '0'
option 'callwaiting' '0' option clir '0'
option 'clir' '0' option sip_account 'sip0'
config 'tel_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'
option 'vad' '0' option vad '0'
option 'txgain' 4 option txgain 4
option 'rxgain' 4 option rxgain 4
option 'echo_cancel' 1 option echo_cancel 1
option 'callwaiting' '0' option callwaiting '0'
option 'clir' '0' option clir '0'
config 'tel_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'
option 'vad' '0' option vad '0'
option 'txgain' 4 option txgain 4
option 'rxgain' 4 option rxgain 4
option 'echo_cancel' 1 option echo_cancel 1
option 'callwaiting' '0' option callwaiting '0'
option 'clir' '0' option clir '0'
config 'tel_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'
option 'vad' '0' option vad '0'
option 'txgain' 4 option txgain 4
option 'rxgain' 4 option rxgain 4
option 'echo_cancel' 1 option echo_cancel 1
option 'callwaiting' '0' option callwaiting '0'
option 'clir' '0' option clir '0'
config 'tel_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'
option 'vad' '0' option vad '0'
option 'txgain' 4 option txgain 4
option 'rxgain' 4 option rxgain 4
option 'echo_cancel' 1 option echo_cancel 1
option 'callwaiting' '0' option callwaiting '0'
option 'clir' '0' option clir '0'
config 'tel_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'
option 'vad' '0' option vad '0'
option 'txgain' 4 option txgain 4
option 'rxgain' 4 option rxgain 4
option 'echo_cancel' 1 option echo_cancel 1
option 'callwaiting' '0' option callwaiting '0'
option 'clir' '0' option clir '0'
config 'tel_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'
option 'vad' '0' option vad '0'
option 'txgain' 4 option txgain 4
option 'rxgain' 4 option rxgain 4
option 'echo_cancel' 1 option echo_cancel 1
option 'callwaiting' '0' option callwaiting '0'
option 'clir' '0' option clir '0'
config 'dialplan' 'custom_dialplan' config dialplan 'custom_dialplan'
option 'custom_outgoing_enabled' '0' option custom_outgoing_enabled '0'
option 'custom_incoming_enabled' '0' option custom_incoming_enabled '0'
option 'custom_hangup_enabled' '0' option custom_hangup_enabled '0'
option 'all_ports_extension' '#123456' option all_ports_extension '#123456'
option 'test_audio_extension' '#123457' option test_audio_extension '#123457'
option 'test_echo_extension' '#123458' option test_echo_extension '#123458'
option 'record_message_extension' '#999999' option record_message_extension '#999999'
config 'sip_advanced' 'SIP' config sip_advanced 'SIP'
option 'rtpstart' '10000' option rtpstart '10000'
option 'rtpend' '20000' option rtpend '20000'
option 'dtmfmode' 'rfc2833' option dtmfmode 'rfc2833'
option 'remotehold' 'yes' option remotehold 'yes'
option 'contact_line_suffix' '1' option contact_line_suffix '1'
option 'registertimeoutbackoff' '512' option registertimeoutbackoff '512'
option 'registerattemptsbackoff' '0' option registerattemptsbackoff '0'
option 'register403timeout' '0' option register403timeout '0'
option 'register503timeout' '0' option register503timeout '0'
option 'registertimeoutguardsecs' '15' option registertimeoutguardsecs '15'
option 'registertimeoutguardlimit' '30' option registertimeoutguardlimit '30'
option 'registertimeoutguardpct' '0.2' option registertimeoutguardpct '0.2'
option defaultexpiry '300' option defaultexpiry '300'
option 'tls_version' 'tlsv1' option tls_version 'tlsv1'
option 'tls_cipher' 'DES-CBC3-SHA' option tls_cipher 'DES-CBC3-SHA'
option 'stun_server' '' option stun_server ''
option 'dnsmgr' 'no' option dnsmgr 'no'
option 'dnsmgr_refresh_interval' '300' option dnsmgr_refresh_interval '300'
option 'srvlookup' 'yes' option srvlookup 'yes'
config 'tel_advanced' 'TEL' config tel_advanced 'TEL'
option 'country' 'SWE' option country 'SWE'
option 'jbenable' 'yes' option jbenable 'yes'
option 'jbforce' 'no' option jbforce 'no'
option 'jbmaxsize' '500' option jbmaxsize '500'
option 'jbimpl' 'adaptive' option jbimpl 'adaptive'
option 'genericplc' 'yes' option genericplc 'yes'
option 'dialoutmsec' '4000' option dialoutmsec '4000'
option 'cw_enable' 'yes' option cw_enable 'yes'
config 'features' 'features' config features 'features'
option 'cbbs_enabled' '1' option cbbs_enabled '1'
option 'callforward_enabled' '1' option callforward_enabled '1'
option 'callwaiting_enabled' '1' option callwaiting_enabled '1'
option 'redial_enabled' '1' option redial_enabled '1'
option 'callreturn_enabled' '1' option callreturn_enabled '1'
option 'advanced_register_settings' '1' option advanced_register_settings '1'
config log 'LOG' config log 'LOG'
option console 'notice,warning,error' option console 'notice,warning,error'
@@ -146,31 +146,32 @@ config ringing_status 'RINGING_STATUS'
option shouldring '1' option shouldring '1'
config call_filter 'call_filter0' config call_filter 'call_filter0'
option block_foreign '0' option block_foreign '0'
option block_special_rate '0' option block_special_rate '0'
option block_outgoing '0' option block_outgoing '0'
option block_incoming '0' option block_incoming '0'
config 'sip_service_provider' 'sip0' config cdr_log 'CDR_LOG'
option 'name' 'Account 1' option cdr_syslog '0'
option 'enabled' '0'
option 'codec0' 'alaw' config sip_service_provider 'sip0'
option name 'Account 1'
option enabled '0'
option codec0 'alaw'
option cbbs_key '5' option cbbs_key '5'
option cbbs_maxretry '5' option cbbs_maxretry '5'
option cbbs_retrytime '300' option cbbs_retrytime '300'
option cbbs_waittime '30' option cbbs_waittime '30'
option 'autoframing' '1' option autoframing '1'
option 'cfim_on' '*21*' option cfim_on '*21*'
option 'cfim_off' '#21#' option cfim_off '#21#'
option 'cfbs_on' '*61*' option cfbs_on '*61*'
option 'cfbs_off' '#61#' option cfbs_off '#61#'
option cw_on '*43#' option cw_on '*43#'
option cw_off '#43#' option cw_off '#43#'
option cw_status '*#43#' option cw_status '*#43#'
option 'call_return' '*69' option call_return '*69'
option 'redial' '*66' option redial '*66'
option 'is_fax' '0' option is_fax '0'
option 'transport' 'udp' option transport 'udp'
config cdr_log 'CDR_LOG'
option cdr_syslog '0'

View File

@@ -260,90 +260,41 @@ read_codecs_ptime()
# #
read_lines() read_lines()
{ {
local lines="" local line call_lines lineid ldx lines llength clength
local call_lines local loffset=$(ubus -t 1 call voice.asterisk platform | jsonfilter -e @.lineoffset)
local fxsIdx fxsEpt dectIdx dectEpt loffset=${loffset:-0}
# Are lines already set by user conf? config_get call_lines $1 call_lines "0"
config_get call_lines $1 call_lines
# Otherwise set default depending on board HW. This for line in $call_lines ; do
# is only done at very first boot or a default reset.
if test -z "$call_lines"; then
# Get all FSX voice endpoints. Translate to uppercase with awk
# due to tr [:upper:] doesn't work in our BusyBox.
voicePorts=$(db get hw.board.VoicePortOrder | \
awk '{ print toupper($0) }' | \
sed -e "s/\([[:alpha:]]*\)\([[:digit:]]\)/\1\/\2/g")
voiceNames=$(db get hw.board.VoicePortNames)
hasVoice=0
if test $(db get hw.board.hasVoice) = "1"; then # convert line format to <LINENAME><LINEID>
# Get the first FSX voice endpoint index by case $line in
# searching for the name usually used. [0-9])
fxsIdx=$(echo $voiceNames | \ line="$LINENAME$line"
awk -e '{ ;;
i = 1; "$CHANNELNAME"/[0-9])
while(i <= NF && tolower($i) !~ /^tel.*$/) { clength=$(echo $CHANNELNAME | wc -c)
i++; line="$LINENAME${line:$clength}"
} ;;
print i;
}'
)
# Convert index to endpoint ID
if test $fxsIdx -gt 0; then
fxsEpt=$(echo $voicePorts | awk '{ print $'$fxsIdx' }')
fi
hasVoice=1
fi
if test $(db get hw.board.hasDect) = "1"; then
# Get the first Dect voice endpoint index by
# searching for the name usually used.
dectIdx=$(echo $voiceNames | \
awk -e '{
i = 1;
while(i <= NF && tolower($i) !~ /^dect.*$/) {
i++;
}
print i;
}
')
if test $dectIdx -gt 0; then
dectEpt=$(echo $voicePorts | awk '{ print $'$dectIdx' }')
fi
hasVoice=1
fi
if test $hasVoice -eq 1; then
call_lines="$dectEpt $fxsEpt"
# Remove leading/trailing spaces
call_lines=$(echo $call_lines | xargs echo -n)
# If we didn't find any endpoint ID we
# fallback to activate them all.
if test -z "$call_lines"; then
call_lines="$voicePorts"
fi
fi
# Save the endpoint IDs we found where the
# GUI expects to find them.
uci_set voice_client "${1}" "call_lines" "$call_lines"
uci_commit voice_client
fi
for i in $call_lines ; do
case $i in
''|*[!0-9]*) lines=$lines"$i&" ;;
*) lines=$lines"$CHANNELNAME/$i&" ;;
esac esac
# get the index from line name
# llength=$(echo $LINENAME | wc -c)
# lineid="${lineid:$llength}"
# get the index from uci config order
lineid="$(uci show voice_client | grep =tel_line | grep -wn $line | cut -d ':' -f1)"
[ -n "$lineid" ] || continue
# -1 to get uci config index (which starts from 0)
# +loffset to give correct number of channel driver
ldx=$((lineid-1+loffset))
lines="$lines$CHANNELNAME/$ldx&"
done done
lines=$(escape_sed_substitution $lines) lines=$(escape_sed_substitution $lines)
echo "${lines%??}" echo "${lines%??}"
} }
@@ -1481,7 +1432,6 @@ configure_extensions()
# #
configure_extensions_provider() configure_extensions_provider()
{ {
echo COMES HERE
local enabled local enabled
local displayname local displayname
local user local user