[OpenSIPS-Users] Wrong IP when relaying REGISTER to Asterisk

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Mar 12 12:11:41 CET 2010


Hi Tyler,


Web Support wrote:
> Bogdan,
>
> I am using the fix_nated_contact() because if I don't, it tries to register
> with the private IP of the device on my network... still not the public IP
> of it.
>   
fix_nated_contact() function replaces the contact IP:port part of the 
Contact URI with the source IP and port from the network level. So, you 
should see in Contact the IP of the UAC NAT, but NOT the IP of opensips.

If you really see the IP of opensips in the outgoing register, maybe you 
should check the traffic on the LO interface - maybe the register 
spirals on opensips and he sees itself as source.

Let's have this done first - again run a trace for the REGISTER, but 
looking on all interfaces (ngrep -d any . port 5060 )

Regards,
Bogdan

> Perhaps I'm attacking this the wrong way, maybe you can clarify for me what
> I actually want to do. The end I'm trying to reach is to secure my dialtone
> via TLS, as Asterisk (1.4 due to PBXware) doesn't support it. 
>
> After reading forums, mailing lists, googling non-stop... everything is
> starting to blur. Maybe you can outline for me the steps I need to put into
> place to make this work. As mentioned before, ideally I would like Asterisk
> to acknowledge the UACs as their public IPs, not the OpenSIPS server, as I'm
> putting together a multi-tenanted environment. My understanding is that I
> would:
>
> 1. Register UAC through OpenSIPS via TLS.
> 2. Registration is relayed to Asterisk, Asterisk would see the public IP of
> the UAC.
> 3. INVITES made from a registered UAC would in turn relay through OpenSIPS
> to Asterisk, which would send it to the destination directly, bypassing
> OpenSIPS. 
>
> Is this logic flawed?
>
> -Tyler
>
> -----Original Message-----
> From: users-bounces at lists.opensips.org
> [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
> Sent: Wednesday, March 10, 2010 11:56
> To: OpenSIPS users mailling list
> Subject: Re: [OpenSIPS-Users] Wrong IP when relaying REGISTER to Asterisk
>
> Tyler,
>
> The script logic (for REGISTER) is a bit broken - you authenticate the 
> REGISTER, you save it locally, send a reply to UAC and then relay the 
> REGISTER to asterisk; which will send you back a reply, so you will end 
> up with 2 replies back to UAC :)
>
> Regarding the contact part, I see you are using the fix_nated_contact()  
> function - this is the only function that seams to modify the CT hdr.  
> To validate this assumption, try commenting the function and run again.
>
> Regards,
> Bogdan
>
> Web Support wrote:
>   
>> Bogdan, or anyone,
>>
>> How can I relay the public IP of my UAD off to Asterisk instead of the IP
>>     
> of
>   
>> the OpenSIPS server?
>>
>> Everything I've tried has not changed anything. I am using
>> fix_nated_contact(), as before using it, it was trying to register the
>> private IP of the UAD. 
>>
>> -Tyler
>>
>> -----Original Message-----
>> From: users-bounces at lists.opensips.org
>> [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei Iancu
>> Sent: Tuesday, March 09, 2010 13:34
>> To: OpenSIPS users mailling list
>> Subject: Re: [OpenSIPS-Users] Wrong IP when relaying REGISTER to Asterisk
>>
>> forgot the script :)
>>
>> but look for fix_nated_contact() ....if present
>>
>> Regards,
>> Bogdan
>>
>> Web Support wrote:
>>   
>>     
>>> I've attached the .cfg, I'm sure it's a bit of a mess in your eyes... I'm
>>> still getting the grasp of OpenSIPS scripting and I'm having a hard time
>>> figuring out what is returned from certain function calls.
>>>
>>> I am not knowingly changing the Contact hdr, I think I want to though, so
>>> that it reflects the public IP of the UAD, no?
>>>
>>> Thanks for your help so far Bogdan.
>>>
>>> -Tyler
>>>
>>> -----Original Message-----
>>> From: users-bounces at lists.opensips.org
>>> [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei
>>>       
> Iancu
>   
>>> Sent: Tuesday, March 09, 2010 13:25
>>> To: OpenSIPS users mailling list
>>> Subject: Re: [OpenSIPS-Users] Wrong IP when relaying REGISTER to Asterisk
>>>
>>> Ok, in this case I assume opensips is change it, right ?
>>>
>>> so the question is - does your opensips changes the Contact hdr in 
>>> REGISTERs ?
>>>
>>> Regards,
>>> Bogdan
>>>
>>> Web Support wrote:
>>>   
>>>     
>>>       
>>>> Hello Bogdan,
>>>>
>>>> The IP is of my OpenSIPS server.
>>>>
>>>> -Tyler
>>>>
>>>> -----Original Message-----
>>>> From: users-bounces at lists.opensips.org
>>>> [mailto:users-bounces at lists.opensips.org] On Behalf Of Bogdan-Andrei
>>>>       
>>>>         
>> Iancu
>>   
>>     
>>>> Sent: Tuesday, March 09, 2010 12:34
>>>> To: OpenSIPS users mailling list
>>>> Subject: Re: [OpenSIPS-Users] Wrong IP when relaying REGISTER to
>>>>         
> Asterisk
>   
>>>> Hi Tyler,
>>>>
>>>> can you check at network level (use tcpdump, ngrep), in the REGISTER 
>>>> from opensips to asterisk, what is the Contact header? does this Contact
>>>>         
>
>   
>>>> hdr contain an IP of opensips or an IP of UAD ?
>>>>
>>>> Regards,
>>>> Bogdan
>>>>
>>>> Web Support wrote:
>>>>   
>>>>     
>>>>       
>>>>         
>>>>> Currently I have OpenSIPS installed on one machine, and have my 
>>>>> Asterisk (PBXware) on another machine. When trying to register my UAD 
>>>>> through OpenSIPS, the relay is happening correctly and the device is 
>>>>> showing up in Asterisk, but it's showing up with the IP of OpenSIPS.
>>>>>
>>>>> Ideally, I would like it to be the public IP of the device trying to 
>>>>> register. As it stands right now, my UAD gets authenticated fine, 
>>>>> registered in Asterisk. I can make extension to extension calls, 
>>>>> extension to PSTN calls, but can NOT receive calls.
>>>>>
>>>>> How can I change the IP when relaying the REGISTER to Asterisk so that 
>>>>> it's the public IP of the deivce, instead of my OpenSIPS server?
>>>>>
>>>>> Note: I am a LAMP guy, programming is not new to me, however. OpenSIPS 
>>>>> scripting is still sort of foggy.
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> -Tyler
>>>>>
>>>>>
>>>>>           
> ------------------------------------------------------------------------
>   
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opensips.org
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>   
>>>>>     
>>>>>       
>>>>>         
>>>>>           
>>>>   
>>>>     
>>>>       
>>>>         
>>>   
>>>     
>>>       
>>   
>>     
>
>
>   


-- 
Bogdan-Andrei Iancu
www.voice-system.ro




More information about the Users mailing list