Forwarding Incoming Calls over an Asterisk IAX Trunk.
I needed to find a way of forwarding incoming calls from one Asterisk box over to another Asterisk box. There were restrictions in simply putting the ISDN cards into the new Asterisk box. To do this I had to first connect the boxes with an IAX2 trunk which is easy enough. Once the 2 Asterisk boxes are connected via an IAX2 trunk it was a case of creating a custom extension and to forward incoming calls to this custom extension.
For each incoming number on the first box I had to create a custom extension that corresponded to this incoming number.
Simply editing extensions_custom.conf and adding the following
[custom-5551234] exten => s,1,Dial(IAX2/TrunkName/5551234,30,r); |
This is essentially saying to create a custom extension called custom-5551234 if this extension is called to start the call with priority 1 and to Dial the IAX trunk with a timeout of 30 seconds and to force the generation of the ring tone
Then on the first Asterisk box I created an Inbound Route that stated if there is a call to 5551234 transfer / call 55512334 on the IAX2 Trunk.
This was done with a simple Custom App to dial
custom-5551234,s,1 |
On the second Asterisk box you simply then create and Inbound rule as normal for a direct dial and point the extension to the IVR / Extension / Conference room as requested.
This has worked really well and has proved incredibly reliable.
Thank you so much! This is very useful
Hello,
Thanks for the tip! It helped a lot. However, it took me a few hours to figure out that the trunk on server B has to have peer details set of context=from-trunk. Mine was context=from-internal and it would not work.
Just wanted to give others a heads up on that.