返回列表 發帖

Some useful dialplans

To reload asterisk
  1. exten = 700,1,Playback(posix-restarting)
  2. exten = 700,2,Wait(1)
  3. exten = 700,3,System(/usr/sbin/asterisk -rx reload)
  4. exten = 700,4,Hangup
複製代碼
settings

To record a message
  1. exten = 310,1,Answer
  2. exten = 310,2,Wait(2)
  3. exten = 310,3,Record(asterisk-recording%d:gsm)
  4. exten = 310,4,Wait(2)
  5. exten = 310,5,Playback(${RECORDED_FILE})
  6. exten = 310,6,Wait(2)
  7. exten = 310,7,Hangup
複製代碼

回復 3# bubblestar

Please share yours as well.

TOP

本帖最後由 ckleea 於 2011-10-5 21:10 編輯

I use this dialplan to solve the problem of unable to detect DTMF in WaitExten application.

Now I can use this to answer PSTN to Asterisk, then properly read the DTMF keystrokes and proceed
  1. [ivr-0]
  2. exten => 1001,1,Answer
  3. exten => 1001,n,SIPDtmfMode(rfc2833)
  4. exten => 1001,n,Wait()
  5. exten => 1001,n,Background(thank-you-for-calling,m)
  6. exten => 1001,n,Background(vm-enter-num-to-call,m)
  7. exten => 1001,n,Read(Newext,,9)
  8. exten => 1001,n,GotoIf(${Newext:0:1} = 2,3,6?dlocal)
  9. exten => 1001,n,GotoIf(${Newext:0:1} = 9?dhk)
  10. exten => 1001,n,GotoIf(${Newext:0:1} = 0,4,5,7,8?derr)
  11. exten => 1001,n(dlocal),Dial(LOCAL/${Newext})
  12. exten => 1001,n(dhk),DIAL(SIP/**8133${Newext:1}@obitrunk)
  13. exten => 1001,n(derr),Goto(1001,1)
  14. ;exten => 1001,n,WaitExten()
  15. ;exten => 1001,n, Dial(LOCAL/${Newext})
  16. ;exten => 1001,n,Goto(1001,1)
  17. exten => 1001,n,Hangup
複製代碼

TOP

回復 8# 角色


    Still not complete. Something wrong. But it is approaching success.

TOP

code updated

TOP

回復 12# 角色

I can tell you that my Waitexten cannot accept digit starting from 9

TOP

回復 14# bubblestar

Yes. Mximonitor can do

TOP

回復 16# bubblestar

I try already but not succeed. Still accepting one to two digits only.

TOP

回復 18# bubblestar

In fact I have tried various option within WaitExten()

TOP

回復 20# 角色

My set up is to use HKBN 2b for incoming and then go out via PSTN connect via ATA.

HKBN 2b per se is a VOIP connection in my understanding though other people may think it is a PSTN because they can dial in via any physical phone they have.

I suggest you also try to put up 2b into your asterisk 1.8 to test run. I do encounter a few problem now after iphone apps for 2b is available.

Sometimes: registered but cannot dial in or out. Dialing in will ring my iphone despite the apps has been turned off
Sometimes: registered but go to 2b voicemail
Sometimes: dial out always failed.

TOP

Another macro to handle incoming call
  1. [macro-phone]
  2. exten => s,1,Dial(SIP/${MACRO_EXTEN},25)
  3. exten => s,n,Goto(${DIALSTATUS},1)
  4. exten => ANSWER,1,Hangup
  5. exten => CANCEL,1,Hangup
  6. exten => NOANSWER,1,Voicemail(${MACRO_EXTEN}@default,u)
  7. exten => BUSY,1,Voicemail(${MACRO_EXTEN}@default,b)
  8. exten => CONGESTION,1,Voicemail(${MACRO_EXTEN}@default,b)
  9. exten => CHANUNAVAIL,1,Voicemail(${MACRO_EXTEN}@default,u)
  10. exten => a,1,VoicemailMain(${MACRO_EXTEN}@default)

  11. ; usage
  12. [users]
  13. exten => 5001,1,Macro(phone)
  14. exten => 5002,1,Macro(phone)
複製代碼

TOP

Superdial 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
複製代碼

TOP

I have moved all my macro into another conf file to make my extensions.conf nice and tidy.

I will follow this direction to clean up all the unnecessary and clumsy ordering of different labels.

TOP

This is the beginning.

I have defined two users for sip and iax connections using template approach. Few trunks that allow me to use resources. Other being setup in progress.



screenshot.15-10-2011 07.07.50.png
2011-10-15 07:15

TOP

返回列表