netrxinc
asked on
How do I tell an Asterisk dialplan to use any available trunk when dialing out using the dialout-trunk macro
I am trying to get my extensions_custom.conf file configured to make an outbound call on any available SIP trunk using [macro-dialout-trunk].
The following line works:
exten=> 2001,1,Macro(dialout-trunk ,2,9155512 12)
I would llke to replace the ,2, with something that reflects any open trunk. Currently I have 2 trunks, but I will soon be getting several more.
Thanks.
The following line works:
exten=> 2001,1,Macro(dialout-trunk
I would llke to replace the ,2, with something that reflects any open trunk. Currently I have 2 trunks, but I will soon be getting several more.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The 1st argument passed to [macro-dialout-trunk] is not identical to the first parameter used in the Asterisk Dial command. Looking at the source of [macro-dialout-trunk] on my FreePBX box, it looks like you would need to change the Dial command in your new macro to this:
exten => s,n,Dial(${OUT_${TRUNK}}/$ {ARG1})
Or perhaps a better alternative would be to call the FreePBX macro from your macro - i.e. replace your Dial command with this:
exten => s,n,Macro(dialout-trunk,${ TRUNK},${A RG1})
Taking a wider look at your question, I wonder why you consider it necessary to cycle through different trunks and what you mean by an "open trunk". SIP trunks can normally carry more than 1 call at a time. Also, FreePBX does already have functionality in "Outbound Routes" to attempt to call using one trunk and, if that fails, to attempt the same call on a different one. Is it just that you want an inbound call from a particular DDI to redial immediately as an outbound call on another? If so, please look at this previous question:
https://www.experts-exchange.com/questions/24917262/Route-calls-to-Trunk.html
exten => s,n,Dial(${OUT_${TRUNK}}/$
Or perhaps a better alternative would be to call the FreePBX macro from your macro - i.e. replace your Dial command with this:
exten => s,n,Macro(dialout-trunk,${
Taking a wider look at your question, I wonder why you consider it necessary to cycle through different trunks and what you mean by an "open trunk". SIP trunks can normally carry more than 1 call at a time. Also, FreePBX does already have functionality in "Outbound Routes" to attempt to call using one trunk and, if that fails, to attempt the same call on a different one. Is it just that you want an inbound call from a particular DDI to redial immediately as an outbound call on another? If so, please look at this previous question:
https://www.experts-exchange.com/questions/24917262/Route-calls-to-Trunk.html
ASKER
Thanks for your help. My main problem is that I've been using this software for about a week :) I rethought what I was doing and took a completely different approach, and am now using the Recording Panel in FreePBX to set an extension to Call Forward to an outside line, thereby letting the existing code and macros handle everything...AND IT WORKS!!!
ASKER
Appreciate your assistance.
extensions-custom.txt
errorlog.txt