call - getting the group name to the accoding pri port in asterisk -


i using sagoma 8 port card chan_dahdi.conf configure ports are

;autogenerated /usr/sbin/wancfg_dahdi not hand edit ;autogenrated on 2015-06-12 ;dahdi channels configurations  ;for detailed dahdi options, view /etc/asterisk/chan_dahdi.conf.bak  [trunkgroups]  [channels] context=default usecallerid=yes hidecallerid=no callwaiting=yes usecallingpres=yes callwaitingcallerid=yes threewaycalling=yes transfer=yes canpark=yes cancallforward=yes callreturn=yes echocancel=yes echocancelwhenbridged=yes relaxdtmf=yes rxgain=0.0 txgain=0.0 group=1 callgroup=1 pickupgroup=1 immediate=no  ;sangoma a108 port 1 [slot:4 bus:2 span:1] <wanpipe1> switchtype=euroisdn context=from-pstn group=1 echocancel=yes signalling=pri_cpe channel =>1-15,17-31  ;sangoma a108 port 2 [slot:4 bus:2 span:2] <wanpipe2> switchtype=euroisdn context=from-pstn group=2 echocancel=yes signalling=pri_cpe channel =>32-46,48-62  ;sangoma a108 port 3 [slot:4 bus:2 span:3] <wanpipe3> switchtype=euroisdn context=from-pstn group=3 echocancel=yes signalling=pri_cpe channel =>63-77,79-93  ;sangoma a108 port 4 [slot:4 bus:2 span:4] <wanpipe4> switchtype=euroisdn context=from-pstn group=4 echocancel=yes signalling=pri_cpe channel =>94-108,110-124  ;sangoma a108 port 5 [slot:4 bus:2 span:5] <wanpipe5> switchtype=euroisdn context=from-pstn group=5 echocancel=yes signalling=pri_cpe channel =>125-139,141-155  ;sangoma a108 port 6 [slot:4 bus:2 span:6] <wanpipe6> switchtype=euroisdn context=from-pstn group=6 echocancel=yes signalling=pri_cpe channel =>156-170,172-186  ;sangoma a108 port 7 [slot:4 bus:2 span:7] <wanpipe7> switchtype=euroisdn context=from-pstn group=7 echocancel=yes signalling=pri_cpe channel =>187-201,203-217  ;sangoma a108 port 8 [slot:4 bus:2 span:8] <wanpipe8> switchtype=euroisdn context=from-pstn group=8 echocancel=yes signalling=pri_cpe channel =>218-232,234-248 

my problem how can group number of current calling port dynamically in dialplan.

for example if user call pri in port 1 dial statement is

exten => _x.,n,dial(dahdi/g1/${number}) 

and call on second pri port 2

 exten => _x.,n,dial(dahdi/g2/${number}) 

g3,g4,g5 etc other ports in order set particular did

currenty doing when call comes create group variable stores group checking did range

same => n,set(__group=${if($[ ${exten} >= ${didminport1}]? ${if($[ ${exten} <=  ${didmaxport1}]?g1:g1)} :g1)}) same => n,set(__group=${if($[ ${exten} >= ${didminport2}]? ${if($[ ${exten} <= ${didminport2}]?g2: ${group} )} : ${group} )}) 

and etc other groups ,for dialling do

   exten => _x.,n,dial(dahdi/${group}/${number}) 

but dont think idea because have 8 port have write 8 lines determine group , dial matching did.so there way group dynamically in dialplan means if there channel variable can group of current incoming port call?

as know there no such variables dahdi groups.

in chan_dahdi.conf use same option "context=from-pstn", may set "context=pri-g1" group 1 ("context=pri-g2" group 2 , etc.) , define in dialplan that:

[pri-main] exten => s,1,noop(main routine)  [pri-g1] exten => s,1,set(pri_group=1) exten => s,n,goto(pri-main,s,1)  [pri-g2] exten => s,1,set(pri_group=2) exten => s,n,goto(pri-main,s,1)  ...  [pri-g8] exten => s,1,set(pri_group=8) exten => s,n,goto(pri-main,s,1) 

it not convenient setting if there channel variables, fast asterisk.

just notice in [pri-g#] exten may not "s", did number or smth else - see in cli errors soon.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -