[Serusers] STUN server question (was ACK problem)

Hamish Archer hamish at archer.net.nz
Thu May 6 23:14:24 CEST 2004


Thanks Klaus.

I have the Grandstream phone determining its public NAT IP if I switch 
to using the Stun server at sipphone.com. That means that the contact 
and Via are already correct and I don't have to go through the rtpproxy 
either.

It still won't work if I use my stun server. I have tried mystun from 
iptel.org and the Vocal stund server. Both of them seem to answer the 
stun queries OK but the Grandstream phone doesn't change the contact and 
Via like it does if I point it at the sipphone.com stun server.

Anyone know what sort of stun server sipphone are using?

Hamish


Klaus Darilion wrote:

> It looks like your NAT-box is traverseable by use of STUN as xlite 
> works fine. Further, it looks like Budgetone claims to support stun, 
> but couldn't make it as good as xlite. So, you can configure ser to do 
> the nat-traversal.
>
> As stated before, the problem is the private IP in the 200 OK of 
> budgetone. So you have to catch the 200 OK and rewrite the contact:
>
> i do it this way:
>
> ..
> if (behind NAT) {
>   force_rtp_proxy();
>   t_on_reply("1"); #RTP proxy and rewrite Contact of callee
> }
> ..
>
>
> onreply_route[1]{
>     #RTP proxy and rewrite Contact of callee
>     fix_nated_contact();
>
>     if ( (status=~"200" || status=~"183") ) {
>         force_rtp_proxy();
>         append_hf("P-RTP-Proxy: YES\r\n");
>     };
> }
>
> klaus
>
> Hamish Archer wrote:
>
>> 222.152.11.236 is the public IP of the NAT firewall in front of the 
>> UA / Grandstream phone
>> xx.xx.xx.51 is the public IP of the asterisk server
>> xx.xx.xx.52 is the public IP of the ser proxy
>> 192.168.1.158 is obviously the private IP of the UA that is causing 
>> the problem.
>>
>> I am trying to work around this using fix_nated_contact but haven't 
>> got it working yet. I have tried using a different UA (X-Lite) and it 
>> worked first time but still won't with the Grandstream phone.
>>
>> It would seem that the problem could be solved if the private IP 
>> address of the UA never made it to ser. Both UAs are using STUN to 
>> traverse that NAT so I have been looking at the Register requests 
>> with ethereal and it appears that X-Lite is adding a Via <public NAT 
>> IP> and correctly modifying Contact: to <public NAT IP> but the 
>> Grandstream phone isn't changing anything when using the STUN server. 
>> The only time the public NAT IP appears when registering the 
>> Grandstream phone is in the 200 OK response from ser. Could it be 
>> that this issue is really with the UA and not how SER is handling it?
>>
>> Hamish
>>
>> Klaus Darilion wrote:
>>
>>> It would easy debugging if you would shortly describe your setup
>>>
>>> e.g. .52 public IP of natbox 1
>>> 51...?
>>> 236...? proxy? or public UA?
>>>
>>> I guess you have to use "fix_nated_contact" on the 200 OK message. 
>>> Make a replyroute to catch the 200 OK.
>>>
>>> regards,
>>> klaus
>>>
>>> Hamish Archer wrote:
>>>
>>>> Hi all,
>>>>
>>>> I have ser operating with a combination of X-lite and grandstream 
>>>> phones. I am trying to get it it play nicely with Asterisk and have 
>>>> run into a strange situation. Calling from ser to asterisk works 
>>>> fine but when I try to call back from asterisk to ser I run into 
>>>> problems, the sip device (behind NAT)  rings but when I answer the 
>>>> call ser tries to send the ACK back to the private IP and not the 
>>>> public IP (found using STUN) that it was using up until that point.
>>>>
>>>> I have the following debug from ngrep to illustrate the problem. 
>>>> Offending SIP packet marked with ########s
>>>>
>>>> Any ideas?
>>>>
>>>> #
>>>> U 222.152.11.236:36595 -> xx.xx.xx.52:5060
>>>> SIP/2.0 100 trying.
>>>> Via: SIP/2.0/UDP xx.xx.xx.52;branch=z9hG4bKbe2d.2a520d95.0.
>>>> Via: SIP/2.0/UDP xx.xx.xx.51:5080;branch=z9hG4bK6484622b.
>>>> From: "Hamish Archer" <sip:100 at xx.xx.xx.51:5080>;tag=as12db357a.
>>>> To: <sip:17778134000 at proxy02.blahblah.xxx>.
>>>> Call-ID: 1738a1ee3d2310af4082784e4d0a6d89 at xx.xx.xx.51.
>>>> CSeq: 102 INVITE.
>>>> User-Agent: Grandstream BT100 1.0.4.54.
>>>> Content-Length: 0.
>>>> .
>>>>
>>>> #
>>>> U 222.152.11.236:36595 -> xx.xx.xx.52:5060
>>>> SIP/2.0 180 ringing.
>>>> Via: SIP/2.0/UDP xx.xx.xx.52;branch=z9hG4bKbe2d.2a520d95.0.
>>>> Via: SIP/2.0/UDP xx.xx.xx.51:5080;branch=z9hG4bK6484622b.
>>>> Record-Route: <sip:xx.xx.xx.52;ftag=as12db357a;lr=on>.
>>>> From: "Hamish Archer" <sip:100 at xx.xx.xx.51:5080>;tag=as12db357a.
>>>> To: <sip:17778134000 at proxy02.blahblah.xxx>;tag=760cdf6859149410.
>>>> Call-ID: 1738a1ee3d2310af4082784e4d0a6d89 at xx.xx.xx.51.
>>>> CSeq: 102 INVITE.
>>>> User-Agent: Grandstream BT100 1.0.4.54.
>>>> Content-Length: 0.
>>>> .
>>>>
>>>> #
>>>> U 222.152.11.236:36595 -> xx.xx.xx.52:5060
>>>> SIP/2.0 180 ringing.
>>>> Via: SIP/2.0/UDP xx.xx.xx.52;branch=z9hG4bKbe2d.2a520d95.0.
>>>> Via: SIP/2.0/UDP xx.xx.xx.51:5080;branch=z9hG4bK6484622b.
>>>> Record-Route: <sip:xx.xx.xx.52;ftag=as12db357a;lr=on>.
>>>> From: "Hamish Archer" <sip:100 at xx.xx.xx.51:5080>;tag=as12db357a.
>>>> To: <sip:17778134000 at proxy02.blahblah.xxx>;tag=efb3a3fe9b832ccc.
>>>> Call-ID: 1738a1ee3d2310af4082784e4d0a6d89 at xx.xx.xx.51.
>>>> CSeq: 102 INVITE.
>>>> User-Agent: Grandstream BT100 1.0.4.54.
>>>> Content-Length: 0.
>>>> .
>>>>
>>>> #
>>>> U 222.152.11.236:36595 -> xx.xx.xx.52:5060
>>>> SIP/2.0 200 OK.
>>>> Via: SIP/2.0/UDP xx.xx.xx.52;branch=z9hG4bKbe2d.2a520d95.0.
>>>> Via: SIP/2.0/UDP xx.xx.xx.51:5080;branch=z9hG4bK6484622b.
>>>> Record-Route: <sip:xx.xx.xx.52;ftag=as12db357a;lr=on>.
>>>> From: "Hamish Archer" <sip:100 at xx.xx.xx.51:5080>;tag=as12db357a.
>>>> To: <sip:17778134000 at proxy02.blahblah.xxx>;tag=760cdf6859149410.
>>>> Call-ID: 1738a1ee3d2310af4082784e4d0a6d89 at xx.xx.xx.51.
>>>> CSeq: 102 INVITE.
>>>> User-Agent: Grandstream BT100 1.0.4.54.
>>>> Contact: <sip:17778134000 at 192.168.1.158>.
>>>> Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.
>>>> Content-Type: application/sdp.
>>>> Content-Length: 209.
>>>> .
>>>> v=0.
>>>> o=17778134000 8000 8000 IN IP4 192.168.1.158.
>>>> s=SIP Call.
>>>> c=IN IP4 222.152.11.236.
>>>> t=0 0.
>>>> m=audio 5004 RTP/AVP 0 101.
>>>> a=rtpmap:0 PCMU/8000.
>>>> a=ptime:20.
>>>> a=rtpmap:101 telephone-event/8000.
>>>> a=fmtp:101 0-11.
>>>>
>>>> #################################################
>>>> U xx.xx.xx.52:5060 -> 192.168.1.158:5060
>>>> ACK sip:17778134000 at 192.168.1.158 SIP/2.0.
>>>> Max-Forwards: 10.
>>>> Record-Route: <sip:xx.xx.xx.52;ftag=as12db357a;lr=on>.
>>>> Via: SIP/2.0/UDP xx.xx.xx.52;branch=0.
>>>> Via: SIP/2.0/UDP xx.xx.xx.51:5080;branch=z9hG4bK6484622b.
>>>> Route: <sip:17778134000 at 192.168.1.158>.
>>>> From: "Hamish Archer" <sip:100 at xx.xx.xx.51:5080>;tag=as12db357a.
>>>> To: <sip:17778134000 at proxy02.blahblah.xxx>;tag=760cdf6859149410.
>>>> Contact: <sip:100 at xx.xx.xx.51:5080>.
>>>> Call-ID: 1738a1ee3d2310af4082784e4d0a6d89 at xx.xx.xx.51.
>>>> CSeq: 102 ACK.
>>>> User-Agent: Asterisk PBX.
>>>> Content-Length: 0.
>>>> ###################################################
>>>>
>>>> #
>>>> U 222.152.11.236:36595 -> xx.xx.xx.52:5060
>>>> SIP/2.0 200 OK.
>>>> Via: SIP/2.0/UDP xx.xx.xx.52;branch=z9hG4bKbe2d.2a520d95.0.
>>>> Via: SIP/2.0/UDP xx.xx.xx.51:5080;branch=z9hG4bK6484622b.
>>>> Record-Route: <sip:xx.xx.xx.52;ftag=as12db357a;lr=on>.
>>>> From: "Hamish Archer" <sip:100 at xx.xx.xx.51:5080>;tag=as12db357a.
>>>> To: <sip:17778134000 at proxy02.blahblah.xxx>;tag=760cdf6859149410.
>>>> Call-ID: 1738a1ee3d2310af4082784e4d0a6d89 at xx.xx.xx.51.
>>>> CSeq: 102 INVITE.
>>>> User-Agent: Grandstream BT100 1.0.4.54.
>>>> Contact: <sip:17778134000 at 192.168.1.158>.
>>>> Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE.
>>>> Content-Type: application/sdp.
>>>> Content-Length: 210.
>>>> .
>>>> v=0.
>>>> o=17778134000 8000 8000 IN IP4 192.168.1.158.
>>>> s=SIP Call.
>>>> c=IN IP4 222.152.11.236.
>>>> t=0 0.
>>>> m=audio 35337 RTP/AVP 0 101.
>>>> a=rtpmap:0 PCMU/8000.
>>>> a=ptime:20.
>>>> a=rtpmap:101 telephone-event/8000.
>>>> a=fmtp:101 0-11.
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Serusers mailing list
>>>> serusers at lists.iptel.org
>>>> http://lists.iptel.org/mailman/listinfo/serusers
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>
>
>
>
>




More information about the sr-users mailing list