I have a question regarding the subject. Please take a look at the below example and kindly guide me.
Two Asterisk Boxes “A” & “B”, let say “A” be in USA and “B” be in UK
Trunk between the two boxes "IAX2"
Box “A” is connected with a SIP Provider and has a DID
Call between the two boxes is working fine.
Both Boxes have VOIP Phones configured with SIP
My Question:
I want to call from Asterisk “B” box to a US City Via SIP Provider connected with Asterisk “A”
Basically i would like to know how to transfer call over IAX2 trunk from one location to another and call out via SIP Provider making local calls between US and UK.
Kindly advise what to do and where i need to make the changes.
You don’t need to transfer the call you need to route the call.
If the trunk between the systems is in the from-internal context (as it should be), any calls matching the outbound routes on system A will be routed out system A’s resources. When a call arrives from system B the call must be formatted to match the outbound routes on system A.
With a little planning the routing can be elegant and transparent to the users.
You do not need to route the call from B to A as it adds latency.Instead configure on B the same “trunk” you have on A, but leave the registration empty. This will allow you making outbound calls. You can remove more stuff from the trunk definition which is not important for outbound only, like context or qualify.
Thanks a lot for the replies. Let me explain my failure:
I added the same SIP settings as of Server A in Server B and Created out-bound route , by selecting the SIP Trunk and adding the line
[from-Internal]
exten=> _0.,1,Dial(SIP/SIPTRUNK/${EXTEN:1}@,r)
exten=> _X.,1,hangup()
If i add IAX2 settings the calls reach to the Server A from Server B , but does not goes through SIP.
I am adding the Custom code to /etc/asterisk/extensions_custom.conf
Trunk for IAX2 is setup in /etc/asterisk/iax_additional.conf [Basically i added the trunk via GUI and not Edited iax_additional.conf as freepbx phrohibits that.]
Trunks Settings for IAX2 on server B are as under
If you are asking for a custom context, or outbound route module, Where should i add it? In Server A or Server B ? coz i am using IAX2 Trunk Setup to connect two machines and the trunk are connected via extensions 20000 and 20001. With this setup internal extensions and Legacy pbxes connected with both Server A and B are working now when i try to call any external number from Server B , IAX2 comes in action and the Call is Simply going to Server B from Server A but then i become lost as i don’t know what to do e.g if i call number 123456, the call goes to Server A as IAX2/123456-1967 , Now my question is how to Forward this IAX2/123456 to SIP.
Where to put outbound route
Totaly Lost !!!
If you could advise any document or any video it would be highly appreciated.
He already told you not install any custom modules. Everything you are trying to do can be accomplished via stock FreePBX.
When configuring outbound route on B, forget about A, and configure routing to US numbers via the trunk you already defined. The only problem you might have could be the fact the SIP trunk at your provider is pinned to A’s ip address, so you might want to remove that restriction if it is in place. Other than that you might want read a little about configuring routes
I have a static IP from my SIP Provider. I am already using IAX2 Trunk to Connect two Asterisk Boxes. But, As per Obelisk, i need to create the same SIP trunk in Server B as i Have in Server A.
As Obelisk pointed out you can directly originate calls on server B if you setup an identical SIP trunk and not register it, just use it for outbound. That way you don’t even need server A to relay the traffic.
The IAX trunk is for extension to extension calling between the offices.
I tried to install SIP Trunk on Server B, with and without registration, But no Luck. I deleted all of the custom configs.
Asterisk> sip show registry [shows unregistered, when i even try to configure SIP Trunk with Registration in Server B] Means my SIP Provider has my external IP binding Enabled.
I Even tried to Configure only Outbound route and selected IAX2 trunk, but no luck.
Any one with a document or tutorial or any website stating how to call via remote SIP or Longdistance Toll bypass, please advise.
There is a chance your provider will not let you send traffic from an address that is not registered.
Send us the output of iax2 show peer xxx where xxx is the name of the trunk to server b.
Also send call trace when initiating a call from server b to server a.
The trunk on server a must be in from-internal context.
There is nothing special about intermachine dialing, you just need to make sure you are sending the correct digits that match the outbound route on the target server.
Here is the output from office server for a trunk that connects to my server at home. I can call both extensions and make outbound calls from this trunk:
maieast*CLI> iax2 show peer shhome
* Name : shhome
Secret : <Set>
Context : from-internal
Parking lot :
Mailbox :
Dynamic : Yes
Callnum limit: 0
Calltoken req: No
Trunk : No
Encryption : No
Callerid : "" <>
Expire : 3224899
ACL : No
Addr->IP : 107.x.x.x Port 4569
Defaddr->IP : 0.0.0.0 Port 0
Username : shhome
Codecs : 0x2 (gsm)
Codec Order : (gsm)
Status : OK (38 ms)
Qualify : every 60000ms when OK, every 10000ms when UNREACHABLE (sample smoothing Off)
maieast*CLI>
Here is the peer detials, (note if static IP use host = ip address, I am registering my system as I have port 4569 opened up for remote access.
disallow=all
allow=gsm
username=shhome
context=from-internal
secret=xxxxxxxx
host=dynamic
qualify=yes
type=friend
Name : ata-ala
Secret :
Context : from-internal
Mailbox :
Dynamic : No
Trunk : No
Callerid : “” <>
Expire : -1
ACL : No
Addr->IP : 192.168.x.x Port 4569
Defaddr->IP : 0.0.0.0 Port 0
Username : 9000
Codecs : 0xe (gsm|ulaw|alaw)
Codec Order : (ulaw|alaw|gsm)
Status : OK (46 ms)
Qualify : every 60000ms when OK, every 10000ms when UNREACHABLE (sample smoothing Off)