Board logo

標題: Failover trunk [打印本頁]

作者: ckleea    時間: 2011-2-13 13:50     標題: Failover trunk

本帖最後由 ckleea 於 2011-2-13 22:24 編輯

What is your favourite dialplan for a failover trunk setup so that if trunk 1 fails, dial via trunk 2?

Gladful if you can share
作者: Qnewbie    時間: 2011-2-13 18:11

IP01 has one macro for failover in a normal outbound dial rule.
作者: ckleea    時間: 2011-2-13 20:48

The question I post is that I have some problems with HKBN 2b. Dial out encountered problem. I have to fail over to PSTN. But my PSTN trunk is connected via SPA3000.

Now my solution as follow:
Use a macro
  1. [macro-superdial]
  2. ; add some abilities to Dial(Technology/resource[&Technology2/resource2...][|timeout][|options][|URL]):
  3. ;       ${ARG1} - Technology/resource[&Technology2/resource2...] (like SIP/2201)
  4. ;       ${ARG2} - timeout in seconds
  5. ;       ${ARG3} - Dial command options
  6. ;       ${ARG4} - URL (see Dial command for info)
  7. ;       ${ARG5} - Group name (used if you want to limit the number of calls in any way)
  8. ;       ${ARG6} - Max. group number (maximum number of concurrent calls you want to allow for that group)
  9. ;       ${ARG7} - Caller ID name (typically for outgoing calls only)
  10. ;       ${ARG8} - Caller ID number (typically for outgoing calls only)
  11. ;       ${ARG9} - CDR account name (over-rides account group setting in sip.conf or iax.conf)
  12. ;       ${ARG10} - voicemail to send to if noanswer (typically for incoming calls only)
  13. ; Usage instructions:
  14. ;       for an outgoing call, in extensions.conf you just list multiple lines like:
  15. ;               exten => s,1,Macro(superdial,IAX2/voipjet/${tfnumber},,,,voip,${MAXVOIPCALLS},yourname,8005551234,voipjet)
  16. ;               exten => s,2,Macro(superdial,IAX2/alpeh-com/${tfnumber},,,,voip,${MAXVOIPCALLS},yourname,8005551234,aleph)
  17. ;       and it will take the first one that is available
  18. ;
  19. ;       it also works for incoming like so ..
  20. ;               exten => s,1,Wait(2)
  21. ;               exten => s,2,Macro(superdial,${PHONE1},15,Ttm,,pstn,${MAXPSTNCALLS},${CALLERIDNAME},${CALLERIDNUM},pstn,u${GENERALVM})
  22. ;               exten => s,3,Macro(superdial,${PHONE1},15,Ttm,,pstn,${MAXPSTNCALLS},${CALLERIDNAME},${CALLERIDNUM},pstn,u${GENERALVM})
  23. ;               exten => s,4,Voicemail(b${GENERALVM})
  24. ;       and then goes to unavailable voicemail if one times out .. otherwise (eg if busy) it tries the next extension
  25. ;       if all are busy or unavailable .. it gets to the last priority which is the busy voicemail
  26. ;
  27. exten => s,1,Set(GROUP()=${ARG5})
  28. exten => s,2,Set(GROUPCOUNT=${GROUP_COUNT(${ARG5})})
  29. exten => s,3,GotoIf($[${GROUPCOUNT} > ${ARG6}]?104)
  30. exten => s,4,GotoIf($["${ARG7}" = ""]?macro-superdial,s,6)
  31. exten => s,5,Set(CALLERID(name)=${ARG7})        ; skip this if ARG7 is empty
  32. exten => s,6,GotoIf($["${ARG8}" = ""]?macro-superdial,s,8)
  33. exten => s,7,Set(CALLERID(number)=${ARG8})              ; skip this if ARG8 is empty
  34. exten => s,8,GotoIf($["${ARG9}" = ""]?macro-superdial,s,10)
  35. exten => s,9,SetAccount(${ARG9})        ; skip this if ARG9 is empty
  36. exten => s,10,Dial(${ARG1},${ARG2},${ARG3},${ARG4})
  37. exten => s,11,Goto(s-${DIALSTATUS},1)
  38. exten => s,104,Goto(s-CHANUNAVAIL,1)
  39. exten => s-BUSY,1,Noop
  40. exten => s-NOANSWER,1,GotoIf($["${ARG10}" = ""]?macro-superdial,s-NOANSWER,3)
  41. exten => s-NOANSWER,2,Voicemail(${ARG10})
  42. exten => s-NOANSWER,3,Noop
  43. exten => _s-.,1,Noop
複製代碼

作者: bubblestar    時間: 2011-2-13 20:56

名符其實的 Super Dial ! 要仔細看才能明白線路的走向。

如果用 DAHDI,可利用 4 條線 (如果有的話),只要簡單的 g0 便可以自動跳線撥出。

exten => _9X.,1,Dial(DAHDI/g0/${EXTEN:1},40,r)
作者: ckleea    時間: 2011-2-13 21:10

My dialplan now is as follow:
If hkbn2b fails, it will use http digest to connect SPA3000 to dial out PSTN
Only problem is different callerid.

;dial-out via HKBN 2b
[CallingRule_2b-out_nocid]
;exten => _9.,1,Dial(SIP/133${EXTEN:1}@hkbn2b)
;exten => _9.,n,Hangup()

exten => _9.,1,Macro(superdial,SIP/133${EXTEN:2}@hkbn2b)
exten => _9.,2,Macro(superdial,SIP/pstn-spa3k-d1/${EXTEN:1})
作者: ckleea    時間: 2011-2-13 21:26

本帖最後由 ckleea 於 2011-2-13 21:54 編輯

I also modify the following macro by adding these 2 lines in red to accommodate error in HKbn2b connection
  1. [macro-trunkdial-failover-0.3]
  2. exten = s,1,GotoIf($[${LEN(${FMCIDNUM})} > 6]?1-fmsetcid,1)
  3. exten = s,n,GotoIf($[${LEN(${GLOBAL_OUTBOUNDCIDNAME})} > 1]?1-setgbobname,1)
  4. exten = s,n,Set(CALLERID(num)=${IF($[${LEN(${CID_${CALLERID(num)}})} > 2]?${CID_${CALLERID(num)}}:)})
  5. exten = s,n,Set(CALLERID(all)=${IF($[${LEN(${ARG5})} > 2]?${ARG5}:)})
  6. exten = s,n,GotoIf($[${LEN(${CALLERID(num)})} > 6]?1-dial,1)
  7. exten = s,n,Set(CALLERID(all)=${IF($[${LEN(${CID_${ARG3}})} > 6]?${CID_${ARG3}}:${GLOBAL_OUTBOUNDCID})})
  8. exten = s,n,Set(CALLERID(all)=${IF($[${LEN(${ARG5})} > 2]?${ARG5}:)})
  9. exten = s,n,Goto(1-dial,1)
  10. exten = 1-setgbobname,1,Set(CALLERID(name)=${GLOBAL_OUTBOUNDCIDNAME})
  11. exten = 1-setgbobname,n,Goto(s,3)
  12. exten = 1-fmsetcid,1,Set(CALLERID(num)=${FMCIDNUM})
  13. exten = 1-fmsetcid,n,Set(CALLERID(name)=${FMCIDNAME})
  14. exten = 1-fmsetcid,n,Goto(s,4)
  15. exten = 1-dial,1,Dial(${ARG1})
  16. exten = 1-dial,n,Gotoif(${LEN(${ARG2})} > 0 ?1-${DIALSTATUS},1:1-out,1)
  17. exten = 1-CHANUNAVAIL,1,Dial(${ARG2})
  18. exten = 1-CHANUNAVAIL,n,Hangup()
  19. exten = 1-CONGESTION,1,Dial(${ARG2})
  20. exten = 1-CONGESTION,n,Hangup()
  21. [color=Red]exten = 1-NOANSWER,1,Dial(${ARG2})
  22. exten = 1-NOANSWER,n,Hangup()[/color]
  23. exten = 1-out,1,Hangup()
複製代碼

作者: ckleea    時間: 2011-2-13 21:34

example of speed dial as follow

exten=330,1,Macro(trunkdial-failover-0.3,SIP/2xxxxxxx@hkbn2b,SIP/2xxxxxxx@pstn-spa3k-d1,hkbn2b,pstn-spa3k-d1)
作者: ckleea    時間: 2011-2-13 21:47

回復 4# bubblestar


    Yours is line hunting. Mine is failover (analog, voip, other, in any combination)
作者: ckleea    時間: 2011-2-13 21:50

If you have more voip/analog lines, you can


exten => _9.,1,Macro(superdial,SIP/133${EXTEN:2}@hkbn2b)
exten => _9.,1,Macro(superdial,DAHDI/g0/${EXTEN:1})
exten => _9.,2,Macro(superdial,SIP/pstn-spa3k-d1/${EXTEN:1})
作者: bubblestar    時間: 2011-2-13 22:02

A super failover trunk dialing tutorial 超讚!!!  我 LIKE
作者: ckleea    時間: 2011-2-13 22:04

Learn from problem. Need to set up IP01 dial plan for my brother. Since yesterday, my 2b fails intermittently. So I have to work out a back up solution. Here is my work. Glad you like it.
作者: ckleea    時間: 2011-2-13 22:08

I am still not sure whether to get a tdm410p or your sangoma USB-FXO. So I use this. In the future, I can mix more like using the spare spa3000 or my spa400 sip trunk.

This failover macro will work great in a mixed environment.

For a FXO card, if the card fails or DAHDI has problem, it can't work. But for me, I use different technologies.
作者: ckleea    時間: 2011-2-13 22:10

Please also refer to this link to learn more

http://www.voip-info.org/wiki/view/Asterisk+variable+DIALSTATUS
作者: bubblestar    時間: 2011-2-13 22:25

回復 12# ckleea


   
Agree!  Your contingency plan per se is a failover.  

Your solution seems to be a one-to-many idea.  Of course, you have 2-lines-to-many-devices, in fact.

Whew!  you are something else.
作者: ckleea    時間: 2011-2-13 22:28

This is our spirit to keep trying and learning from problems.
老土D,就是香港精神

哈哈!
作者: ckleea    時間: 2011-2-13 22:32

The next trial will be to get support from other users in HK. so that we can have failover from PCCW, HGC, NWT, HKBN, etc


作者: bubblestar    時間: 2011-2-13 22:43

What a GREAT idea!
作者: ckleea    時間: 2011-2-13 22:44

This is our VOIP world!!
作者: ckleea    時間: 2011-2-13 22:45

Not only the cheapest but reliable.
作者: 角色    時間: 2011-2-13 23:06

The next trial will be to get support from other users in HK. so that we can have failover from PCCW ...
ckleea 發表於 2011-2-13 22:32


CK's asterisk server can be acted as a super hub of our general asterisk servers.

YH
作者: ckleea    時間: 2011-2-14 06:30

回復 20# 角色


    I am just at the beginning. Still many not sure and not understand. However, with mutual co-operation, we can do more in a reliable and economic way.
作者: ckleea    時間: 2011-2-14 07:25

Give you a feel of the log message on failover.

You can see 2b has no answer then it goes to dial via pstn line.
  1. JABBER: asterisk INCOMING:
  2.     -- Accepting AUTHENTICATED call from 192.168.xxx.x:
  3.        > requested format = alaw,
  4.        > requested prefs = disabled,
  5.        > actual format = alaw,
  6.        > host prefs = disabled,
  7.        > priority = reqonly
  8.     -- Executing [9xxxxxxxx@DLPN_DP1:1] Macro("IAX2/6101-4113", "superdial,SIP/133xxxxxxxx@hkbn2b") in new stack
  9.     -- Executing [s@macro-superdial:1] Set("IAX2/6101-4113", "GROUP()=") in new stack
  10.     -- Executing [s@macro-superdial:2] Set("IAX2/6101-4113", "GROUPCOUNT=0") in new stack
  11. [Feb 14 07:48:32] WARNING[30286]: ast_expr2.fl:468 ast_yyerror: ast_yyerror():  syntax error: syntax error, unexpected $end, expecting '-' or '!' or '(' or '<token>'; Input:
  12. 0 >
  13.     ^
  14. [Feb 14 07:48:32] WARNING[30286]: ast_expr2.fl:472 ast_yyerror: If you have questions, please refer to doc/tex/channelvariables.tex.
  15.     -- Executing [s@macro-superdial:3] GotoIf("IAX2/6101-4113", "0?104") in new stack
  16.     -- Executing [s@macro-superdial:4] GotoIf("IAX2/6101-4113", "1?macro-superdial,s,6") in new stack
  17.     -- Goto (macro-superdial,s,6)
  18.     -- Executing [s@macro-superdial:6] GotoIf("IAX2/6101-4113", "1?macro-superdial,s,8") in new stack
  19.     -- Goto (macro-superdial,s,8)
  20.     -- Executing [s@macro-superdial:8] GotoIf("IAX2/6101-4113", "1?macro-superdial,s,10") in new stack
  21.     -- Goto (macro-superdial,s,10)
  22.     -- Executing [s@macro-superdial:10] Dial("IAX2/6101-4113", "SIP/133xxxxxxxx@hkbn2b,,,") in new stack
  23.   == Using SIP RTP TOS bits 184
  24.   == Using SIP RTP CoS mark 5
  25.     -- Called 133xxxxxxxx@hkbn2b
  26.     -- No one is available to answer at this time (1:0/0/0)
  27.     -- Executing [s@macro-superdial:11] Goto("IAX2/6101-4113", "s-NOANSWER,1") in new stack
  28.     -- Goto (macro-superdial,s-NOANSWER,1)
  29.     -- Executing [s-NOANSWER@macro-superdial:1] GotoIf("IAX2/6101-4113", "1?macro-superdial,s-NOANSWER,3") in new stack
  30.     -- Goto (macro-superdial,s-NOANSWER,3)
  31.     -- Executing [s-NOANSWER@macro-superdial:3] NoOp("IAX2/6101-4113", "") in new stack
  32.     -- Executing [9xxxxxxxx@DLPN_DP1:2] Macro("IAX2/6101-4113", "superdial,SIP/pstn-spa3k-d1/xxxxxxxx") in new stack
  33.     -- Executing [s@macro-superdial:1] Set("IAX2/6101-4113", "GROUP()=") in new stack
  34.     -- Executing [s@macro-superdial:2] Set("IAX2/6101-4113", "GROUPCOUNT=0") in new stack
  35. [Feb 14 07:48:33] WARNING[30286]: ast_expr2.fl:468 ast_yyerror: ast_yyerror():  syntax error: syntax error, unexpected $end, expecting '-' or '!' or '(' or '<token>'; Input:
  36. 0 >
  37.     ^
  38. [Feb 14 07:48:33] WARNING[30286]: ast_expr2.fl:472 ast_yyerror: If you have questions, please refer to doc/tex/channelvariables.tex.
  39.     -- Executing [s@macro-superdial:3] GotoIf("IAX2/6101-4113", "0?104") in new stack
  40.     -- Executing [s@macro-superdial:4] GotoIf("IAX2/6101-4113", "1?macro-superdial,s,6") in new stack
  41.     -- Goto (macro-superdial,s,6)
  42.     -- Executing [s@macro-superdial:6] GotoIf("IAX2/6101-4113", "1?macro-superdial,s,8") in new stack
  43.     -- Goto (macro-superdial,s,8)
  44.     -- Executing [s@macro-superdial:8] GotoIf("IAX2/6101-4113", "1?macro-superdial,s,10") in new stack
  45.     -- Goto (macro-superdial,s,10)
  46.     -- Executing [s@macro-superdial:10] Dial("IAX2/6101-4113", "SIP/pstn-spa3k-d1/xxxxxxxx,,,") in new stack
  47.   == Using SIP RTP TOS bits 184
  48.   == Using SIP RTP CoS mark 5
  49.     -- Called pstn-spa3k-d1/xxxxxxxxx\
  50.     -- SIP/pstn-spa3k-d1-00000007 is ringing
  51.     -- SIP/pstn-spa3k-d1-00000007 answered IAX2/6101-4113
  52.   == Spawn extension (macro-superdial, s, 10) exited non-zero on 'IAX2/6101-4113' in macro 'superdial'
  53.   == Spawn extension (DLPN_DP1, 9xxxxxxxx, 2) exited non-zero on 'IAX2/6101-4113'
  54.     -- Hungup 'IAX2/6101-4113'
複製代碼

作者: ckleea    時間: 2011-2-14 09:00

The other possibilities for our world is skype trunks. I have 4 at the moment and can add more if my ATOM D525 can be made working. I have migrated the D330 server images into D525 but not working well. Somethings outside asterisk not working as expected. Not enough time to deal with.

Besides, another thing is that we need a better internet line. To may understanding and experience, I feel HGC is still better for my use. I do encounter problem with my 2b account while I am in HKBN network.
作者: Qnewbie    時間: 2011-2-14 20:58

WOW, 4 skype trunks+PCCW, HGC, NWT, HKBN etc. You are running a small voip company!
作者: ckleea    時間: 2011-2-14 21:07

No, only one PCCW line and a 2b line. Skype trunk is from the siptosis software.
作者: Qnewbie    時間: 2011-2-14 21:21

Is it true that the Skype limits the number of skype clients per ip?

There are 4 skype clients might used at the same time at home. If I add one more to run siptosis using monthly subscription plan, there are 5 skype users per ip! So the limitation rumours rises my concern.
作者: ckleea    時間: 2011-2-14 22:14

本帖最後由 ckleea 於 2011-2-14 22:38 編輯

Now I have 5 skype trunks added to my asterisk server.

All are working.
作者: Qnewbie    時間: 2011-2-15 01:47

That's great!
作者: ckleea    時間: 2011-2-15 07:36

回復 28# Qnewbie

It will be much better for me to get my D525 running to host more skype trunks.

How is your skype - voip setup? Can you tell us how you make it work? Do you have a linux server or use windows for skype connection?
作者: Qnewbie    時間: 2011-2-15 16:46

The skype trunk is set up with siptosis in plain windows, no other fancy stuff.

It should be installed to ATOM PC(former asterisk server with slow CF-card) latter if the number of skype is not limited.
作者: ckleea    時間: 2011-2-15 19:45

I try to increase to 8 now. But not yet able to work.
作者: bubblestar    時間: 2011-2-15 21:01

回復 31# ckleea


   
How long does it take to initiate a real call when you reach the first available trunk, say on the fourth or fifth trunk?

I ask as I did a similar test and placed the unavailable trunk in the first 3 position on purpose.  When the system check the fourth trunk and sucessfully initiated the call, it took about 20 - 30 seconds.

In this connection, I infer that the more we add, the longer time we need and wait to make the call.
作者: ckleea    時間: 2011-2-15 21:29

Just complete. 9 trunks all working

stsTrunk_01/stsTrunk_01    192.168.1xx.xx                                      5072     OK (3 ms)
stsTrunk_02/stsTrunk_02    192.168.1xx.xx                                      5073     OK (3 ms)
stsTrunk_03/stsTrunk_03    192.168.1xx.xx                                      5074     OK (4 ms)
stsTrunk_04/stsTrunk_04    192.168.1xx.xx                                      5075     OK (4 ms)
stsTrunk_05/stsTrunk_05    192.168.1xx.xx                                      5076     OK (3 ms)
stsTrunk_06/stsTrunk_06    192.168.1xx.xx                                      5077     OK (3 ms)
stsTrunk_07/stsTrunk_07    192.168.1xx.xx                                      5078     OK (3 ms)
stsTrunk_08/stsTrunk_08    192.168.1xx.xx                                      5079     OK (3 ms)
stsTrunk_09/stsTrunk_09    192.168.1xx.xx                                      5080     OK (1 ms)
作者: ckleea    時間: 2011-2-15 21:30

回復 32# bubblestar


    Of course, it will takes some time. As noted, it is for failover, some time lapse is expected.
作者: bubblestar    時間: 2011-2-15 21:49

Are those stsTrunks use the same IP (different ports I know) on the same server?  My test was made on difference different IPs on difference VoIP devices.  So, I think it took some time in my case.

Anyway, thanks for your experiment report.  Yours are quite acceptable and satisfactory.
作者: ckleea    時間: 2011-2-15 21:57

You can set up your skype trunk by siptosis in a linux machine. Then, use IP01 within LAN to connect as sip trunk
作者: ckleea    時間: 2011-2-15 22:47

One interesting thing I observe, even you have all skype accounts set up and run. In windows skype, some may actually not appeared online. Don't know why.

Anyway when dial in, it works.
作者: ckleea    時間: 2011-2-15 22:58

How is the performance with multiple active calls?
Linux CPU usage under varying conditions.

Virtualbox (not an ideal setup) in 32 bit mode using a Vista 64 Host Dual Core AMD Athlon X2 4850e.
Skype sound device setup is a 2 card snd-dummy configuration. SIP codec for all channels is PCMU.
6 calls were from the same Vista host using softphones. The other 4 were made from another PC using softphones.
The Ubuntu distro is a 32 bit 9.0.4 (desktop) with 1.5GB total ram allocation. Approx 800MB was used for the entire setup.
10 Idle channels - There really are 10 they just are not "top" processes.
10 Active channels to echo test - Despite the apparent high load, there was no issue.
6 Active channels to echo test

Dedicated Ubuntu 64 bit 10.04 (desktop) on Dual Core AMD Athlon X2 4850e and 4GB ram.
Skype 2.1.0.81 using a single card snd-dummy configuration. SIP codec for all channels is PCMU.
10 calls were from another PC using softphones.
Top on 10.04 shows weird cpu % sometimes for idle processes.
10 Idle channels - There really are 10 they just are not "top" processes.
10 Active channels to echo test
6 Active channels to echo test
10 Active channels to echo test - This is using sndShare for sound device

Windows Vista CPU usage under varying conditions.
These shots are on a Vista 64 Host Dual Core AMD Athlon X2 4850e.
Skype sound device setup using on-board sound device. SIP codec for all channels is PCMU.
6 calls were from the same Vista host using softphones. The other 4 were made from another PC using softphones.
10 Idle channels
10 Active channels to echo test - This system maxed out at 8. It struggled to get 10 going.
6 Active channels to echo test
作者: bubblestar    時間: 2011-4-19 21:26

本帖最後由 bubblestar 於 2011-4-19 21:31 編輯

因為最近加入了OBi110 及 OBiAPP 兩種撥打模式,經過一番組合後,現在都可以利用Super Dial 的方法撥打PSTN電話了,好處是不用再死記不同的Dialing Prefix,實在記死人了

但我發現OBi110 及 OBiAPP 的撥打反應最慢,而且打完之後,可能要等幾十秒後,才可以打第二次,可能要在個別OBi110 的機子內調較一下才有改善,而且我比較特別,因為OBi110接了入Siemens DECT Phone,經過了幾重關卡,這也許是反應慢了的原因吧!
  1. exten => _9X.,1,Noop(Dialing out through PSTN)
  2. exten => _9X.,n,Macro(superdial,DAHDI/g0/${EXTEN:1})
  3. exten => _9X.,n,Macro(superdial,SIP/${EXTEN:1}@SPA3K-HTTPD)
  4. exten => _9X.,n,Macro(superdial,SIP/**8${EXTEN:1}@obi110)
  5. exten => _9X.,n,Macro(superdial,SIP/2*${EXTEN:1}@obiapp)
  6. exten => _9X.,n,Macro(superdial,SIP/5${EXTEN:1}@ip01)
複製代碼



但好奇怪,IP01條Rule一定要放在最後,否則,把它放在中間時,有時不通的時候,它不會Pass 給下一條Rule撥打,所以要留意先後次序,自行測試至最佳的設定。
作者: ckleea    時間: 2011-4-19 21:41

回復 39# bubblestar


    well done.
作者: ckleea    時間: 2011-4-19 22:33

如果有其他CHing借出的trunk,功能上可以更加多完化。
作者: bubblestar    時間: 2011-4-21 22:44

本帖最後由 bubblestar 於 2011-4-21 22:56 編輯
因為最近加入了OBi110 及 OBiAPP 兩種撥打模式,經過一番組合後,現在都可以利用Super Dial 的方法撥打PSTN ...
bubblestar 發表於 2011-4-19 21:26



   

上面的一段Dial Plan雖然可以正確地利用不同Trunk撥出電話,但我在CLI 入面看,發覺它有很多Warning prompt,令我感覺好樣衰和肉酸,所以現在修正如下,主要是用一些逗號填補了一些沒有使用的ARG 空位,讓Marco 讀取後,不會發出Warning Prompt。現在感覺良好了,一個Warning error 也沒有,乾淨靚仔晒 。

我在呢方面有D潔僻
  1. exten => _9X.,1,Noop(Dialing out through PSTN)
  2. exten => _9X.,n,Macro(superdial,DAHDI/g0/${EXTEN:1},,m,,,1,,,,)
  3. exten => _9X.,n,Macro(superdial,SIP/${EXTEN:1}@SPA3K-HTTPD,,m,,,1,,,,)
  4. exten => _9X.,n,Macro(superdial,SIP/**8${EXTEN:1}@obi110,,m,,,1,,,,)
  5. exten => _9X.,n,Macro(superdial,SIP/2*${EXTEN:1}@obiapp,,m,,,1,,,,)
  6. exten => _9X.,n,Macro(superdial,SIP/5${EXTEN:1}@ip01,,m,,,1,,,,)
複製代碼

作者: ckleea    時間: 2011-4-21 23:28

回復 42# bubblestar


    You are really fast. I notice it for long time but no time to deal with.
Thanks
作者: bubblestar    時間: 2011-4-22 00:47

另外,有關另一條 macro-trunkdial-failover-0.3 一樣出現Warning Prompt,現亦修正改為 macro-trunkdial-failover-0.3a 如下:
  1. [macro-trunkdial-failover-0.3a]
  2. exten = s,1, Set(GROUP()=OUTBOUND_GROUP)
  3. exten = s,2, Noop(${GROUP_COUNT(OUTBOUND_GROUP)})
  4. exten = s,3, GotoIf($[${GROUP_COUNT(OUTBOUND_GROUP)} > 1]?1-CHANUNAVAIL,1)
  5. exten = s,4,Set(CALLERID(num)=${IF($[${LEN(${CID_${CALLERID(num)}})} > 2]?${CID_${CALLERID(num)}}:)})
  6. exten = s,n,GotoIf($[${LEN(${CALLERID(num)})} > 6]?1-dial,1)
  7. exten = s,n,Set(CALLERID(all)=${IF($[${LEN(${CID_${ARG3}})} > 6]?${CID_${ARG3}}:${GLOBAL_OUTBOUNDCID})})
  8. exten = s,n,Goto(1-dial,1)
  9. exten = 1-dial,1,Dial(${ARG1})
  10. exten = 1-dial,n,Gotoif(${LEN(${ARG2})} > 0 ?1-${DIALSTATUS},1:1-out,1)
  11. exten = 1-CHANUNAVAIL,1,Dial(${ARG2})
  12. exten = 1-CHANUNAVAIL,n,Hangup()
  13. exten = 1-CONGESTION,1,Dial(${ARG2})
  14. exten = 1-CONGESTION,n,Hangup()
  15. exten = 1-NOANSWER,1,Dial(${ARG2})
  16. exten = 1-NOANSWER,n,Hangup()
  17. exten = 1-out,1,Hangup()
複製代碼
把它運用於Speed Dial 之中,使用如下:

[context]
exten => 330,1,Macro(trunkdial-failover-0.3a,DAHDI/g0/1878200,SIP/**81878200@obitalk,,)


現在可以跟那些Warning Prompt 說拜拜了。
作者: ckleea    時間: 2011-4-24 22:56

回復 33# ckleea

唔知點解第9 條唔 work?
作者: ckleea    時間: 2011-4-26 09:57

回復 45# ckleea


    My mistake in the config file. Now all nine skype accounts work. To report in the tutorial threads later.
作者: ckleea    時間: 2011-4-27 21:40

My failover trunk as follow
  1. exten => _9.,1,Set(GLOBAL(hkno)=00852${EXTEN:1})
  2. ; first try HKBN2b
  3. exten => _9.,n,Macro(superdial,SIP/133${EXTEN:1}@hkbn2b,,m,,,1,,,,)
  4. ; then try YHFung's HKBN2b
  5. exten => _9.,n,Dial(SIP/6207,2,M(senddigits)tr)
  6. ; then try SPA3000's landline
  7. exten => _9.,n,Macro(superdial,SIP/pstn-spa3k-d1/133${EXTEN:1},,m,,,1,,,,)
  8. ; then try landline at OBi110
  9. exten => _9.,n,Macro(superdial,SIP/**8${EXTEN:1}@obitrunk,,m,,,1,,,,)
  10. ; then try USG 3G modem
  11. exten => _9.,n,Macro(superdial,Datacard/datacard0/133${EXTEN:1},,m,,,1,,,,)
  12. exten => _9.,n,Hangup()
複製代碼

作者: bubblestar    時間: 2011-4-27 22:27

Very robust failover trunk especially the last one with Datacard.  Will try to integrate it with my existing one later.  Many thanks.
作者: 角色    時間: 2011-4-28 06:58

回復 47# ckleea

My God! You have nine outbound trunks to make a Hong Kong PSTN call. Is there any failures found at the present moment?


YH
作者: ckleea    時間: 2011-4-28 07:17

回復 49# 角色


    It is five only. The reason behind is to test every possibility of outgoing call
作者: ckleea    時間: 2011-4-28 08:16

There are other under considerations
1. Using other trunks e.g. H323 provided by other friends, sip trunk by other users
In this case, I need to hide the caller I'd
2. For IDD calling, choose the cheapest according to time,
3. Control number of concurrent calls per trunk

As suggested by Bubblestar Ching, simplify the code to remember for a certain function
作者: bubblestar    時間: 2011-4-28 10:11

本帖最後由 bubblestar 於 2011-4-28 10:36 編輯

回復 49# 角色


   
In fact, I have similar settings as ckleea C-Hing.  One of the advantages is that we can failover to a NUMBER of trunks instead of only one spare trunk even you just have one single PSTN for outbound.  Of course, it will be more flexible if you have two or more on hand.

An efficient and less memory in dialing prefix is our another prime concern.  How painful you are if you have to memorize and differentiate 6 or 7 or more dialing prefix for just making a single call.

Super Dial is very suitable and especially for those people, like you, who has to make frequent calls to different areas.

SUPER!!!
作者: ckleea    時間: 2011-4-28 10:18

回復 52# bubblestar


However, this is for normal dialing. For speed dial, you need other ways to deal with failover. I can only use 2 trunks per the default macro available from asterisk.
作者: bubblestar    時間: 2011-4-28 10:24

Me too.

I'm thinking whether we can failover using more trunks in this respect.
作者: ckleea    時間: 2011-4-28 21:48

回復 54# bubblestar


    I use something like this for failover in speeddial

exten = 345,1,Macro(trunkdial-failover-0.3a,SIP/98765432@hkbn2b,SIP/98765432@pstn-spa3k-d1,hkbn2b,pstn-spa3k-d1)
作者: bubblestar    時間: 2011-4-29 00:14

Mine is almost the same as following:

exten => 330,1,Macro(trunkdial-failover-0.3a,DAHDI/g0/1878200,SIP/**81878200@obitalk,,)
作者: ckleea    時間: 2011-6-12 07:27

My new failover as follow

[CallingRule_UKCall]
exten => _44.,1,Macro(superdial,SIP/0${EXTEN:2}@pstn-spa3kuk-d1,,m,,,1,,,,)
exten => _44.,n,Macro(superdial,IAX2/ip01/90${EXTEN:2},,m,,,1,,,,)
exten => _44.,n,Hangup()
作者: 角色    時間: 2011-6-12 09:04

这个真的不错,真的学不少的东西。

角色
作者: ckleea    時間: 2011-6-12 16:48

回復 58# 角色


    這個superdial 使用2 條 trunks,用SIP 和IAX,後者非常重要!
作者: ckleea    時間: 2011-6-12 17:21

Important observation.
If I use the superdial macro in two asterisk machines, both machines allows superdial function. i.e. when the first asterisk passes to the second asterisk, the second one will also do superdial functions if this dialplan exists.
作者: ckleea    時間: 2011-6-12 21:41

Another type of speeddial with superdial macro is

exten => 348,1,Set(GLOBAL(speeddial)=xxxxxxxxx)
exten => 348,n,Macro(superdial,SIP/133${speeddial}@hkbn2b,,m,,,1,,,,)
exten => 348,n,Macro(superdial,SIP/pstn-spa3k-d1/133${speeddial},,m,,,1,,,,)
exten => 348,n,Macro(superdial,SIP/**8133${speeddial}@obitrunk,,m,,,1,,,,)
exten => 348,n,Macro(superdial,Datacard/datacard0/133${speeddial},,m,,,1,,,,)
exten => 348,n,Macro(superdial,Dongle/dongle0/133${speeddial},,m,,,1,,,,)
exten => 348,n,Hangup()
作者: ckleea    時間: 2011-6-18 21:18

本帖最後由 ckleea 於 2011-6-18 21:27 編輯

Another trick:

This is to set up a remote trunk IP01 (asterisk 1.4) to dial my asterisk server (1.8) with gtalk and google voice out. The aim is to use specific GV account to dial out so that the caller ID will be correct.

In asterisk server set up a calling rule for the user at remote side

[CallingRule_usergv]
exten => _813XXXXXXXXXX,1,Dial(gtalk/user/+1${EXTEN:3}@voice.google.com)

user is set up in jabber.conf as

[user]
type = client
serverhost = talk.google.com
username = username@gmail.com/Talk
secret = password
port = 5222
usetls = yes
usesasl = yes
statusmessage = "Hi, I am user."
timeout = 100

AT IP01, since it does not have gtalk/jabber module. I have to bridge the call to my asterisk server and dial via an account belong to user i.e. maintain proper caller ID

I have a US calling rule as
exten=_001XXXXXXXXXX,1,Macro(superdial,SIP/813${EXTEN:3}@sipns,,m,,,1,,,,)
exten=_001XXXXXXXXXX,n,Macro(superdial,SIP/**1${EXTEN:2}@obitrunk,,m,,,1,,,,)
exten=_001XXXXXXXXXX,n,Hangup()

In this calling rule, when I dial a US number 0012345678900, the first line will change the number as 8132345678900 and pass to the sip trunk sipns; then my asterisk server responds and using callingrule_usergv, it then dials via a specific account as

gtalk/user/12345678900@voice.google.com

in my server CLI, I can use the call is made by user@gmail.com and hence its callerID is brought together.




歡迎光臨 電訊茶室 (http://telecom-cafe.com/forum/) Powered by Discuz! 7.2