我正在使用sagoma 8端口卡My chan_dahdi.conf
来配置端口
;autogenerated by /usr/sbin/wancfg_dahdi do 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
我的问题是如何在拨号方案中动态获取当前呼叫端口的组号。
例如,如果用户呼叫端口1中的pri,则我的拨号语句为
exten => _X.,n,dial(DAHDI/g1/${NUMBER})
对于第二个pri 2的呼叫
exten => _X.,n,dial(DAHDI/g2/${NUMBER})
g3,g4,g5等用于其他端口以设置该特定DID
当我来电时我正在做什么我创建一个GROUP变量,通过检查DID范围来存储该组
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} )})
其他组的等等,拨号我
exten => _X.,n,dial(DAHDI/${GROUP}/${NUMBER})
但我不认为这是一个好主意,因为我有8个端口所以我必须写8行来确定组并通过匹配DID拨号。所以有什么办法在我的拨号方案中动态获取组意味着是否有任何我可以从中获取当前传入端口呼叫组的通道变量吗?
答案 0 :(得分:6)
据我所知,DAHDI组没有这样的变量。
在你的chan_dahdi.conf中,你使用相同的选项&#34; context = from-pstn&#34;,这样你就可以轻松设置&#34; context = pri-g1&#34;对于组1(&#34; context = pri-g2&#34;对于组2等)然后在拨号方案中定义类似的东西:
[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)
设置好像有通道变量一样方便,但对于星号来说速度快。
请注意,在[pri-g#]中,exten可能不是&#34; s&#34;,但是DID号或其他 - 但你很快就会在CLI错误中看到它。
答案 1 :(得分:0)
偶尔找到你想要的东西 - 你可以在 chan_dahdi.conf 中设置变量:
<form class="form-horizontal" name="submitRequest" id="submitRequest" method="post" action="requestContentv2.php">
<div class="control-group">
<label class="control-label"><small>Request Type</small>
</label>
<div class="controls">
<div class="input-prepend"> <span class="add-on"><i class="icon-list-alt"></i></span>
<select class="span5" id="e1">
<option></option>
<option value="Create New">Create New</option>
<option value="Delete/Remove">Delete/Remove</option>
</select>
</div> <span class="help-block"><small>Select a request type from the list above.</small></span>
</div>
</div>
在此之后,您可以使用您提出的拨号方案。