Cannot send Subscribe request after first registration with multiple NICs present - have to wait for re-registration.

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

 



Hi,

I have made some progress on this issue. First of all it's real cause is
the fact that NAT traversal is present, not that there are multiple NICs
present.

I have found and replied to a similar topic with the same problem. There I
state mu current, viable workaround. The workaround involves utilizing the
force_contact parameter of account config structure. This lets us ignore
any NAT discovery/traversal and simply state the contact that should be in
the Contact header all the time...

Here it is:
http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2013-August/016607.html

If anyone knows a better solution or can offer me some advice I would be
much grateful.

Regards,
Radek


2013/5/22 Rados?aw Szalski <radoslaw.szalski at gmail.com>

> Hello!
>
> I am using PJSIP/PJSUA libraries version 2.1.0. I do not have a STUN
> server configured.
>
> TL;DR
>
> I get
>
> SIP/2.0 403 Forbidden - Not Registered! You must register first with a
> S-CSCF
>
> When I try to send a SUBSCRIBE request, after the UA has registered
> (successfully!) with the IMS. I have to wait until the registration
> expires, is automatically refreshed and only then I am able to successfully
> send the SUBSCRIBE request!
>
>
>
> Long version:
>
>
>
> I have 2 NICs:
>
> eth0: 10.0.41.63
> eth1: 10.0.3.15
>
> Eth1 has a default route assigned to it, so that is the interface that is
> being chosen by default. The problem is, that my IMS server has an IP
> 10.0.41.61 (thus eth0 should be chosen in the end).
>
> Now, PJSUA is by default configured to update registration info, once
> incoming responses differ in the IP addresses, and logs confirm that this
> is precisely the case.
>
> I can see that the second REGISTER request is sent with correct Contact
> header. SUBSCRIBE  request also uses this Contact. The problem is that the
> reponse from IMS that I get after sending SUBSCRIBE request is:
>
> SIP/2.0 403 Forbidden - Not Registered! You must register first with a
> S-CSCF
>
> and Subscription is Terminated immediately.
>
> I have to wait until the registration expires, to successfully SUBSCRIBE
> to other UA. I tried manually refreshing the subscription by
> calling pjsua_acc_set_registration(acc_id, PJ_TRUE); but that doesn't make
> a difference.
>
> Everything works, as soon as I delete the default route/disable other
> NICs, but that shouldn't be needed.
>
> Am I not waiting for something somewhere ? Am I making a mistake somewhere
> in my registration/configuration code ?
>
>
> Logs/code is at the bottom.
>
>
> Thanks in advance!
>
> Regards,
> Radek
>
>
> Logs showing that PJSUA detects IP change and re-registers. Bothe Contact
> headers have correct expires set:
>
>
> 21:31:26.732    tsx0x83e778  .Incoming Response msg
> 200/REGISTER/cseq=44135 (rdata0x835ab8) in state Calling
> 21:31:26.732    tsx0x83e778  ..State changed from Calling to Completed,
> event=RX_MSG
> 21:31:26.734    pjsua_acc.c  ....SIP outbound status for acc 0 is not
> active
> 21:31:26.734    pjsua_acc.c  ....IP address change detected for account 0 (
> 10.0.3.15:5071 --> 10.0.41.63:5071). Updating registration (using method
> 2)
> 21:31:26.734    pjsua_acc.c  ....Acc 0: setting registration..
> 21:31:26.734       endpoint  .....Request msg REGISTER/cseq=44135
> (tdta0x83fd40) created.
> 21:31:26.734    tsx0x841da8  ......Transaction created for Request msg
> REGISTER/cseq=44136 (tdta0x83fd40)
> 21:31:26.734    tsx0x841da8  .....Sending Request msg REGISTER/cseq=44136
> (tdta0x83fd40) in state Null
> 21:31:26.734  sip_resolve.c  ......Starting async DNS A query:
> target=pcscf.open-ims.test, transport=Unspecified, port=4060
> 21:31:26.734     resolver.c  ......Picked up DNS A record for
> pcscf.open-ims.test from cache, ttl=300
> 21:31:26.734   pjsua_core.c  ......TX 576 bytes Request msg
> REGISTER/cseq=44136 (tdta0x83fd40) to UDP 10.0.41.61:4060:
> REGISTER sip:open-ims.test SIP/2.0
> Via: SIP/2.0/UDP 10.0.41.63:5071
> ;rport;branch=z9hG4bKPjc3Dz.We8eVebvXaX0WLQbGVA7KN00NHJ
> Route: <sip:pcscf.open-ims.test:4060;lr>
> Max-Forwards: 70
> From: <sip:alice@xxxxxxxxxxxxx>;tag=u5hk42TCupQFDzAlKuTdzMF8DfSNssPz
> To: <sip:alice at open-ims.test>
> Call-ID: R2-QND6HB144-vsdzI118Ay-p.uObe7i
> CSeq: 44136 REGISTER
> Contact: <sip:alice at 10.0.41.63:5071;ob>
> Contact: <sip:alice at 10.0.3.15:5071;ob>;expires=0
> Expires: 300
> Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY,
> REFER, MESSAGE, OPTIONS
> Content-Length:  0
>
>
>
> This is how I create the contact for initial SUBSCRIBE request:
>
>
>
> pj_pool_t *tmp_pool = NULL;
>     pj_str_t contact;
>     pj_status_t status;
>
>     pjsua_acc *acc = pjsua_get_acc();
>
>
>     if (acc->contact.slen) {
>         contact = acc->contact;
>     } else {
>         tmp_pool = pjsua_pool_create("tmpbuddy", 512, 256);
>         status = pjsua_acc_create_uac_contact(tmp_pool, &contact,
> pjsua_acc_get_default(),
>                 &servlet_uri);
>
>         if (status != PJ_SUCCESS) {
>             pjsua_perror(THIS_FILE, "Unable to generate Contact header",
> status);
>             pj_pool_release(tmp_pool);
>         }
>     }
>
>
>
>
> This is how I register the user account:
>
>
>
>  pjsua_acc_config cfg;
>     pj_status_t status;
>
>     pjsua_acc_config_default(&cfg);
>     cfg.id = pj_str("sip:" SIP_USER "@" SIP_DOMAIN);
>     cfg.reg_uri = pj_str("sip:" SIP_DOMAIN);
>     cfg.cred_count = 1;
>     cfg.reg_timeout = 300;
>     cfg.cred_info[0].realm = pj_str("*");
>     cfg.cred_info[0].scheme = pj_str("digest");
>     cfg.cred_info[0].username = pj_str(SIP_USER "@" SIP_DOMAIN);
>     cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
>     cfg.cred_info[0].data = pj_str(SIP_PASSWD);
>
>     status = pjsua_acc_add(&cfg, PJ_TRUE, &acc_id);
>
>     if (status != PJ_SUCCESS) {
>         error_exit("Error adding account", status);
>     }
>     // Wait until successfully registered
>     pjsua_acc_info test;
>     pjsua_acc_get_info(acc_id, &test);
>
>     while (test.status != 200) {
>         pjsua_acc_get_info(acc_id, &test);
>     }
>
>
> Configuration of UDP transport:
>
>
> {
>         pjsua_transport_config cfg;
>         pjsua_transport_config_default(&cfg);
>         cfg.port = (pj_uint16_t) SIP_PORT;
>         status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &cfg, NULL);
>         if (status != PJ_SUCCESS)
>             error_exit("Error creating transport", status);
>     }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20130801/dae2e3f8/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