[Serusers] Ser + Asterisk on the same box??

SIP sip at arcdiv.com
Thu May 24 12:06:57 CEST 2007


John Breen wrote:
> SIP wrote:
>> Your biggest issue, bar none, is using the loopback address for 
>> anything externally-facing. 127.0.0.1 is called a loopback address 
>> for a reason -- it never leaves the host itself. Just how do you 
>> expect the SIP phones to be able to contact a 127.0.0.1 address when 
>> that address is, in essence, themselves?
>>
>> There's something inherently flawed in your design.
>>
>> Let's back up and explain, in detail, what it is exactly you're 
>> trying to do, and why you feel the 127.0.0.1 address should be part 
>> of this equation? Perhaps we can suggest something if we know what 
>> you're trying to do.
>>
> There's a very simple reason.  Asterisk and SER are on the same 
> machine.  So the traffic from SER to asterisk doesn't need to leave 
> the box.  This is why I'm using the loopback interface - there's no 
> need to use the real world one.
>
127.0.0.1 is a special address.  If MY machine, for instance, tries to 
connect to 127.0.0.1, it's connecting to itself. If Bob's machine tries 
to connect to 127.0.0.1, he's connecting to Bob's machine. While, 
technically, you COULD accomplish having Asterisk on an internal IP 
address on the local machine, in order for it to actually work, you'd 
need to turn the computer into a router (start doing RIP or some such), 
which would immeasurably complicate things.

Remember, a SIP call has two parts. One is the signaling portion (the 
actual SIP portion of the call) and one is the media portion (RTP -- the 
voice stuff).  SER handles the SIP portion but doesn't do anything with 
the RTP portion. It can't, itself, 'proxy' that voice portion from the 
outside world to an internal-only IP on your box, so you won't ever get 
any audio to your Asterisk server that way.  What happens in that 
scenario is that your softphone calls the SER box. SER tells the 
softphone that it needs to connect its RTP/audio portion of the call to 
the IP of the asterisk server directly. If the IP of the asterisk server 
is internal (or the loopback IP), then the softphone has no way to know 
how to get to it, so it can't connect the audio properly.

If you were running mediaproxy or RTPproxy on the SAME box, IT could 
proxy the audio portion from the outside world to the Asterisk server 
running on the same machine with an internal IP. However, then you're 
creating an incredibly complex scenario and using even more resources 
for each call.

Your best bet if you need both servers to run on the same box is simply 
to run Asterisk on the same external IP as SER but with a different 
port. That way, the outside world can connect its audio to the Asterisk 
server and you won't get some of the weird issues you're getting now.

N.



More information about the sr-users mailing list