How to modify VIA header for a dialog to make use of public address mapped by STUN

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

 



Ok, i figured out that the local transport address in the VIA header comes
from the UDP transport.
I changed the bound address by specifying the STUN mapped address to
pjsip_udp_transport_attach() function.

Now I have another doubt. Actually I am creating/starting the UDP transport
with pjsip_udp_transport_start() API which internally calls
pjsip_udp_transport_attach().
So I make a second call to the attach function so as to set the STUN bound
address in the transport. It seems to work, but is there any pitfall doing
this?

Regards,
Sundar

On Tue, Feb 7, 2012 at 11:08 AM, Sundar Subramaniyan <
sundar.subramaniyan at gmail.com> wrote:

> Hi all,
>
> I am using pjsip and pjnath APIs to build my user agent.
> I would like to REGISTER with the Registrar using the mapped address
> obtained by STUN.
> The STUN mapping is partly ok (having issues with port mapping though,
> described in my other post).
> The question is how do I change the VIA header in a SIP dialog, once STUN
> response is obtained?
>
> I am able to build the FROM, TO and the CONTACT fields with the account
> information and the public address obtained (shown below).
> But the VIA header seems to be using my local transport address. How do I
> change it to the STUN mapped address?
>
> *message log:*
>
> REGISTER sip:iptel.org SIP/2.0
> Via: SIP/2.0/UDP *192.168.0.23:5060*
> ;rport;branch=z9hG4bKPjiHYmNLr3J9bm5TyUGMJuhp3nPiJRk4MO
> Max-Forwards: 70
> From: <sip:sundar2@xxxxxxxxx>;tag=i7pQoYqcuJnNBdIDWGI3TyR.hn3zMtTN
> To: <sip:sundar2 at iptel.org>
> Call-ID: OBdDB3SowCcfiNeUsXjdMuRBU2j.KGSI
> CSeq: 1650 REGISTER
> Contact: <sip:sundar2 at xx.xx.xx.xx:5060>
> Expires: 3600
> Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE
> Content-Length:  0
> --
>
> *registration request procedure followed:*
>
> 1. create registration client with pjsip_regc_create()
> 2. initialize client registration structure with pjsip_regc_init()
> 3. set the transport to be used with pjsip_regc_set_transport()
> 4, set authentication credentials with pjsip_regc_set_credentials()
> 5. set authentication preferences using pjsip_regc_set_prefs()
> 6. set refresh delay with pjsip_regc_set_delay_before_refresh()
> 7. create register request with pjsip_regc_register()
> 8. send the registration request with pjsip_regc_send()
>
> Should I delve a bit deeper to play with the headers myself to get it done
> or is there something am missing?
>
> Thanks in advance,
> Sundar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20120207/5c031946/attachment-0001.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