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/20130522/ae37c629/attachment-0001.html>