Trying to get the public ip adress, solved by STUN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Benny Prijono wrote:
> On Mon, May 19, 2008 at 4:12 PM, Tanguy Floc'h <electrocut at gmail.com> wrote:
>   
>> Hi (again) !
>>
>> I want to get the public ip adress value, just to display this adress to the
>> user, when the STUN resolution is done.
>>
>> For the moment, I've add theses lines in pjsua "on_nat_detect" callback :
>>
>>         // Get pjsua instance
>>         pjsua_var = pjsua_get_var();
>>
>>         // Get public IP
>>         char* ip_string = pjsua_var->tpdata[0].local_name.host.ptr;
>>
>> but it isn't a clean way to do it, since I have to link
>> <pjsua-lib/pjsua_internal.h> (And we are not supposed to do this)
>>
>>     
>
> Yeah.
>
>   
>> Is there another way to get this value ?
>>
>>     
>
> You can query the transport info (pjsua_transport_info) of the SIP UDP
> transport with pjsua_transport_get_info(). When STUN is enabled, the
> transport_info.local_name.host will contain the public IP address
> resolved by STUN.
>   
I've just tried, and it works perfectly.

The code looks much better now,

Regards,

Electrocut

> Cheers
>  Benny
>
>
>   
>> Thanks,
>>
>> Electrocut
>>     
>
> _______________________________________________
> 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
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080519/4495db9d/attachment.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux