[pjsip] STUN & local call

logan logan04x at gmail.com
Sun Nov 4 08:00:33 EST 2007

Hi Benny,

I had a similar scenario and I did the following.

I enable STUN and call pjsua_init, then I clear the STUN field in pjsua_var 
structure by including pjsua_internal.h (I also made a few changes to 
pjsua_resolve_stun_server), create my UDP transport, and set back the STUN 
server in pjsua_var. Now any message send by the account which uses that 
transport won't use STUN mapped addresses in the SDP, via, and contact 
headers. This approach seems to work fine for me. Any caveats though?


Best Regards,

----- Original Message ----- 
From: "Benny Prijono" <bennylp at pjsip.org>
To: "pjsip embedded/DSP SIP discussion" <pjsip at lists.pjsip.org>
Sent: Sunday, November 04, 2007 5:24 PM
Subject: Re: [pjsip] STUN & local call

> Michael Bradley Jr wrote:
>> Hi,
>> when STUN is enable, i can't make a successful call to an UA in the same 
>> Network
>> segment.
>> Here is call flow
>> UA1: pjsua 0.7.0
>> localIP: publicIP: 88.xx.xx.xx
>> UA2: Grandstream IP-Phone
>> localIP: publicIP: 88.xx.xx.xx
>> UA1 ---> UA2 ( >>
>> INVITE sip:xvc at SIP/2.0
>> sdp: c:88.xx.xx.xx
>> UA2 --> UA1 ( --> 88.xx.xx.xx)
>> 200/2.0/UDP 88.xx.xx.xx:5060
>> sdp: c:
>> UA1 never get the 200 since it's send to the public Address...
>> So my question:
>> how can i set the IP of the destination of the RTP stream in my initial
>> INVITE using pjsua-lib since i can figure out that both UA are behind the 
>> same NAT?
> Currently you can't. When STUN is used, the public IP will always be
> used in the SDP, regardless of where the destination UA is located.
> But if only the other UA (UA2) is also pjsua, then there shouldn't
> be any problem with media communication since pjsua will switch the
> destination RTP/RTCP address to the source address of the packet.
> And when you use pjsua to pjsua, you can enable ICE as well. With
> ICE enabled, it will automatically select which media address to use
> based on ICE negotiation.
> cheers,
>  -benny
>> Thanks,
>> Michael
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org 

More information about the pjsip mailing list