3

I have two asterisk based PBXs, each one of them on a diferent LAN, both LANs connected with a router.

First pbx is 10.0.0.1/24 and second one is 10.0.2.1/24. Both pbx have their own extensions and calls between extensions are working perfectly.

PBX1 has a SIP Trunk with a VoIP provider, in a different network interface on a different network. PBX2 has not any Trunk appart from the one connecting it to PBX1.

The problem I'm facing is that, when a user from PBX2 dials an external phone number, according to the dialing rules the call is routed over the trunk to PBX1 which in turn routes the call to the VoIP Provider, the other end on the PSTN picks the phone and... nothing can be heard.

I debugged the problem and found that, what is happening is that the VoIP Provider is sending the RTP traffic (udp packets on a tcpdump) directly to the device on PBX2. As there is no routing between the VoIP network and PBX2, that traffic is lots.

My question is: Is it the supposed way to work? Am I forced to ensure that any both ends are routable?

Does it exist any way to make PBX1 work as a proxy so that ONLY PBX1 has access to the VoIP provider?

I'm using asterisk 1.4.

Thanks for your help.

Matt
  • 185
  • 2
  • 6

2 Answers2

2

With SIP, the signaling is done via SIP and the digitized audio is sent via a different protocol, RTP. The SIP and RTP can and often are sent to different IP addresses. Thats normally not a problem, as long as the IP addresses are all reachable..

Whats happening in your situation, is something like this:

PBX2 sends a SIP INVITE to PBX1. Included in that INVITE is information about where to send the audio. PBX2 specifies its own IP address. Since its IP address is reachable from PBX1, calls between the two work.

Now, when the callee is an outside line, PBX1 sends its own INVITE to your provider, and passes on in that INVITE the information about where to send the audio (ie, the IP address of PBX2) If both PBXs were on public IPs, this would be fine. Since they are not both reachable from the outside, you need to modify the behavior of PBX1

On PBX1, in your sip.conf file, there should be a peer configuration for PBX2. In that peer configuration, you need to add the following line:

canreinvite=no

(On more recent versions of asterisk, you would use directmedia=no instead.)

This will cause PBX1 to stay in the media path whenever it is involved with a call with PBX2. In otherwords, when you call the outside world, PBX1 will give your provider its own IP address for where to send the audio, it will then proxy that audio, and send it on to PBX2.

Hope this helps!

Joe Sniderman
  • 2,809
  • 1
  • 22
  • 26
  • Together with Joe's above recommendation you may also look at whether you need to use 'externip=ip-address' in sip.conf – samt Aug 16 '14 at 05:04
  • If the OP is going to have PBX1 send the RTP to PBX2, externalip=ip wont be needed, as PBX1 is already able to reach PBX2. Not that it would help even with directmedia, as PBX2 doesnt have a public IP at all. – Joe Sniderman Aug 16 '14 at 05:11
  • In Asterisk 1.4 I believe you need to take a close look at the canreinvite= settings (unfortunately we don't have a copy of your configuration) According to http://www.voip-info.org/wiki/view/Asterisk+sip+canreinvite the canreinvite= sip.conf settings was updated to directmedia= in Asterisk 1.6.2 with further clarifications/updates in Asterisk 1.8 – samt Aug 16 '14 at 05:23
  • yes, canreinvite is deprecated in favor of directmedia - mainly because canreinvite is confusingly named. – Joe Sniderman Aug 16 '14 at 05:25
  • @samt Updated my answer to reflect the OP's asterisk version, and the canreinvite that said version uses. Thx. – Joe Sniderman Sep 07 '14 at 04:32
-2

What you describe is entirely possible. It is, after all, how quite a few VoIP providers themselves work: one of my VoIP providers runs their backend systems on Asterisk. And they can route calls to me down the trunk that I setup to my account on their system.

For inter-Asterisk setup it is probably going to be easier to use IAX2 trunks. They will require only a single port to be open between the two networks.

There are several guides available which describe exactly your scenario.

This one looks like just what the doctor ordered: http://www.minded.ca/default/2010-03-05/multi-server-asterisk-network-with-sip-trunks/

I don't at the moment have two * systems to try it on ... but it looks like a complete setup guide.

liamf
  • 392
  • 4
  • 10