返回列表 發帖

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

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

That's a good idea and towards a right direction.  Our dialplan file size is getting larger and it is time to re-organize them in a systematic, manageable and easier way.

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

回復 23# ckleea


   
It seems a new improvement has been made on this code.  I will go through the details later tonight but could you briefly highlight the differences between this one with our existing macro super dial ?

TOP

回復 22# ckleea


   
Thanks ckleea c-hing.  This new dialplan is even neater than the one (also using macro) that I am using.  I will replace mine with this one if it can run smoothly after test.

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

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

回復 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

本帖最後由 角色 於 2011-10-7 09:10 編輯

I do not know whether your gain setting is correct or not?

You may use analogue method by making voice call from your mobile phone to your extension directly and observe the voice volume. In fact, we need a spectrum analysis which would be useful.

YH

TOP

回復 18# bubblestar

In fact I have tried various option within WaitExten()

TOP

回復 17# ckleea


        
To my understanding, the command Answer() is set to 0.5 seconds by default when picking up the line.  If the same rule is also applied for WaitExten(), only 0.5 seconds is not enough for the caller to input all 8 to 10 digits before it expires.

Hence, I have set WaitExten(10) in my IVR to allow adequate input time.  I found that yours is just using default WaitExten().  You may try to set longer time to accommodate all 8 - 10 digits instead of just 2 as you encountered.

TOP

回復 16# bubblestar

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

TOP

本帖最後由 bubblestar 於 2011-10-5 22:48 編輯

回復 13# ckleea


   
If you doubt about WaitExten(), you should also check whether you have set the autofallthough = yes in the general section under extensions.conf.  They have close relationship with each other after Asterisk version greater than 1.2

http://www.voip-info.org/wiki/view/Asterisk+cmd+WaitExten

Notes
WaitExten does not work in a Macro!
The autofallthrough setting was introduced in Asterisk 1.2 now defaults to 'yes' in Asterisk 1.4; if your dialplan relies on the ability to 'run off the end' of an extension and wait for a new extension without using WaitExten() to accomplish that, you will need set autofallthrough to 'no' in your extensions.conf file. If you want to set autofallthrough to 'no', you must go through your dialplan and add WaitExten() at every place where execute would run off the end of an extension and wait for another one to be dialed.
An examination of the source code seems to suggest that TIMEOUT(response) and TIMEOUT(digit) do not have any effect on WaitExten.


For info., I have my autofallthrough set to yes from the very first beginning when setting up my server.

TOP

回復 14# bubblestar

Yes. Mximonitor can do

TOP

返回列表