返回列表 發帖

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

回復 10# 角色


I think one needs to redesign on the macro for his own requirement since different trunk has its different dialing prefix.
It is different from the hunting group that DAHDI works for e.g. FXO ports.

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

For the failover in available in GUI, it has a macro at the backend to handle. One may check if the macro can further modify to suit the needs

TOP

本帖最後由 bubblestar 於 2013-1-1 12:05 編輯

回復 10# 角色


似乎這個Super Dial 是較為單一對應 failover 而制定。

以我當時跟ckleea 師兄討論時所談及的理解,我們所講的Macro Super Dial 是基於能同時應用在多種Multiple 週邊Devices /Clients 上面的。  例如,Dial out 時會接應在Dahdi / 2bApp / HKBN2b / cmphone / SPA3102 / OBi110 之上,並可不斷擴充(理論上),視乎大家手上有什麼週邊設備可以接駁Asterisk Server。

假如 HGC 這間公司突然發生故障,不能提供服務,那麼就算你有兩、三條同一公司的線路,也變得英雄無用武之地了;相反,ckleea 兄所講的便可以大派用場了,我自己現在也用了差不多兩年了,遇到其中一、兩個服務不通時,的確非常有效。

同一概念,撥出Google Voice,也可以經Asterisk,OBi110 作免費的首選,最後才把要收費的IDD 放到最後面。

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

返回列表