返回列表 發帖

Multi-trunk dialling using superdial macro for Asterisk-GUI 迈向进发

本帖最後由 角色 於 2013-1-1 19:17 編輯

由于有不少的members对于怎样利用Superdial在Asterisk-GUI的使用有兴趣,但是Superdial至能用于Asterisk Engine里,而没有看到在Asterisk-GUI,所以尝试在这样下点功夫,希望能成功,那么大家就可以采用。

为什么我们需要Superdial呢?

就是用很多trunks都可以同时去某个点,但是如果trunk是one-to-one,那么每条trunk是使用率就会很低,为了更加使用率,那么可以many-to-many,而我们member ckleea 提供一个方案就是superdial。不过这个superdial的macro暂时只能适合于Asterisk Engine上用,而在Asterisk-GUI上要进一步研究和探索。

本帖最後由 角色 於 2013-1-1 08:34 編輯

Background

问题先由banana1012(ref)。然后alang (ref)提议用一个macro和启动方法来处理。而ckleea (ref)提供一个superdial的方案,但是都是用于Asterisk Engine。

完成事后回顾:

其实ckleea的帖子都能apply于Asterisk-GUI, 只是assume很多members能看懂,有了这幅帖子,很多不清楚的东西就能明白了。

TOP

本帖最後由 角色 於 2012-12-31 20:07 編輯

在voice menu做比较麻烦,为什么呢?

它的context已经定死,如“[voicemenu-custom-n]”,而不可以修改为[macro-superdial].

所以一定要用file editor来后加处理一下。或者直接用file editor,直接edit extensions.conf文件,加入ckleea的superdial,然后再用alang的方法去call macro就可以。

TOP

再想一想,alang的macro,普通call macro-superdial应该不行,估计需要macro call a list of macro-superdial.

TOP

现在的问题是怎样用Asterisk-GUI的trunk name。

TOP

终于搞定在Asterisk-GUI!现在只起来两条trunks。

让我慢慢组织起来,写一份教程让大家分享。

TOP

本帖最後由 角色 於 2012-12-31 23:05 編輯

在Asterisk的trunks,你可以再users.conf找到,一般都是trunk_1,trunk_2,trunk_n,具体哪一条trunk ID (trunk_1,trunk_2,..,trunk_n)。

exten=_9.,1,Macro(superdial,SIP/trunk_4/${EXTEN:1})
exten=_9.,2,Macro(superdial,SIP/trunk_3/${EXTEN:1})

TOP

用Asterisk的File Editor有一个不方便的地方就是用“;" (comment)后,save后,再打开就看不见,要用ssh入系统才能看见。

TOP

本帖最後由 角色 於 2013-1-1 13:24 編輯

Steps of supdial for Asterisk-GUI of multi-outbound trunks

Creation of oubound trunk

1. Create the outbound trunk as usual as defined in users.conf. Please note the trunk_n with respect to the physical SIP/IAX trunk in users.conf, for example trunk_1 for HGC1 and trunk_2 for HGC2

Each trunk has to be individually tested and confirmed okay. Please observe the diallping plan including digit manipulation.

Creation of the macro superdial using File Editor command

2. Use a File Editor to edit the file "extensions.conf". (The File Editor could be displayed when we select "Show Advanced Options" at the rightmost menu by [Options]->[Advanced Options]

2.1 Add a new context name=macro-superdial and include the following script in the context
  1. ;exten  =>  s,1,Macro(superdial,IAX2/voipjet/${tfnumber},,,,voip,${MAXVOIPCALLS},yourname,8005551234,voipjet)
  2. ;exten  =>  s,2,Macro(superdial,IAX2/alpeh-com/${tfnumber},,,,voip,${MAXVOIPCALLS},yourname,8005551234,aleph)
  3. ;exten  =>  s,1,Wait(2)
  4. ;exten  => s,2,Macro(superdial,${PHONE1},15,Ttm,,pstn,${MAXPSTNCALLS},${CALLERIDNAME},${CALLERIDNUM},pstn,u${GENERALVM})
  5. ;exten  =>  s,3,Macro(superdial,${PHONE1},15,Ttm,,pstn,${MAXPSTNCALLS},${CALLERIDNAME},${CALLERIDNUM},pstn,u${GENERALVM})
  6. ;exten  =>  s,4,Voicemail(b${GENERALVM})
  7. exten => s,1,Set(GROUP()=${ARG5})
  8. exten => s,2,Set(GROUPCOUNT=${GROUP_COUNT(${ARG5})})
  9. exten => s,3,GotoIf($[${GROUPCOUNT} > ${ARG6}]?104)
  10. exten => s,4,GotoIf($["${ARG7}" = ""]?macro-superdial,s,6)
  11. exten => s,5,Set(CALLERID(name)=${ARG7})  ; skip this if ARG7 is empty
  12. exten => s,6,GotoIf($["${ARG8}" = ""]?macro-superdial,s,8)
  13. exten => s,7,Set(CALLERID(number)=${ARG8})  ; skip this if ARG8 is empty
  14. exten => s,8,GotoIf($["${ARG9}" = ""]?macro-superdial,s,10)
  15. exten => s,9,SetAccount(${ARG9})  ; skip this if ARG9 is empty
  16. exten => s,10,Dial(${ARG1},${ARG2},${ARG3},${ARG4})
  17. exten => s,11,Goto(s-${DIALSTATUS},1)
  18. exten => s,104,Goto(s-CHANUNAVAIL,1)
  19. exten => s-BUSY,1,Noop
  20. exten => s-NOANSWER,1,GotoIf($["${ARG10}" = ""]?macro-superdial,s-NOANSWER,3)
  21. exten => s-NOANSWER,2,Voicemail(${ARG10})
  22. exten => s-NOANSWER,3,Noop
  23. exten => _s-.,1,Noop
複製代碼
Create a single outbound dialling rule using ordinary method


Comment out all the lines by semicolons and add the following lines
  1. [CallingRule_hk_pstn]
  2. exten = _9.,1,Macro(superdial,SIP/trunk_1/${EXTEN:1})
  3. exten = _9.,2,Macro(superdial,SIP/trunk_2/${EXTEN:1})
複製代碼

TOP

举例:

我们用HGC和0088做例子,全都是拨打大陆电话,基本格式是

0086 + <mobile phone number>, e.g. 0086 1371371378
0086 + <area code> + <local telephone number>, e.g. 0086 755 22334455

按某些需要,Asterisk系统会转成,
0086 13731371378 转成 0088 86 1371371378
0086 755 22334455 装成 0088 86 755 22334455

TOP

回復 11# ckleea

I agree with you absolutely since we have to manipulate the digits (trimming, removing, adding) to suit individual outbound trunk's requirement provided by other suppliers.

TOP

The main obstacle to users is how to implement those macros on their Asterisk-GUI machines, they need solid step-by-step examples to guide them to install those macros.

Anyway, the purpose of this thread is to combined effort given by ckleea, alang, and bubblestar.

TOP

因为我用ComNet Phone提供的两条test trunks,可以拨打香港电话。现在香港利用我的HKBN 2b电话提供的trunk,那么我的hk_pstn 9字头的就可以有其他3条trunks拨打。

大家也知道我的Asterisk Servers (Asterisk-GUI + Asterisk 1.8,Asterisk 1.8, and Asterisk 11)同时运行于我的QNAP TS-269 Pro。

TOP

本帖最後由 角色 於 2013-1-1 17:22 編輯

从Asterisk 1.8 server中,extension 2401:
server ip=192.168.1.6
extension=2401
password=passwd-2401
default sip port=5060

2b trunk, 拨打模式是9+<HK Tel number>

TOP

然后转到Asterisk-GUI + Asterisk 1.8 Server

Create Trunk
dialling rule = _8X.
server ip=192.168.1.6:5060
username=2401
password=passwd-2401

cut the first digit, i.e. = 8
add digit, i.e. 9

TOP

返回列表