Not able to register using PJSIP ios library

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

 



I am trying to register my sip account to my Kamailio SIP server using https://github.com/chebur/pjsip which is using pjsip 2.7.1. 

I am getting SIP registration error: No suitable credential (PJSIP_ENOCREDENTIAL) [status=171101] 

From the Doc it says it happens when you are not giving proper realm and scheme while registering. But the thing is it successfully registers itself when using given ios example app from pjsip library where you do telnet connection and execute pjsip-cli command. So that means '*' as realm and 'digest' as scehem is working but it does not when I am using this library.

My code is like below, what should I do?

        var status = pj_status_t()
       
        pjsua_create()
       
        var ua_cfg:pjsua_config = pjsua_config()
        var log_cfg:pjsua_logging_config = pjsua_logging_config()
        var media_cfg:pjsua_media_config = pjsua_media_config()
       
        pjsua_config_default(&ua_cfg);
       
        pjsua_logging_config_default(&log_cfg);
        pjsua_media_config_default(&media_cfg);
       
        pjsua_init(&ua_cfg, &log_cfg, &media_cfg);
       
        var transportConfig:pjsua_transport_config = pjsua_transport_config()
       
        pjsua_transport_config_default(&transportConfig);
       
        transportConfig.port = 5060;
       
       
       
        pjsua_transport_create(PJSIP_TRANSPORT_UDP, &transportConfig, nil);
       
       
        status = pjsua_start();
       
       
        var acc_cfg = pjsua_acc_config()
       
       
        pjsua_acc_config_default(&acc_cfg);
       
        acc_cfg.id = giveStruct(string: "sip:1001@105.156.199.132")
        acc_cfg.reg_uri = giveStruct(string: "sip:105.156.199.132:5060")
        acc_cfg.cred_count = 1;
        acc_cfg.cred_info.0.realm = giveStruct(string: "*")
        acc_cfg.cred_info.0.scheme = giveStruct(string: "digest")
        acc_cfg.cred_info.0.username = giveStruct(string: "1001")
        acc_cfg.cred_info.0.data_type = 0
        acc_cfg.cred_info.0.data = "" "1001")
        acc_cfg.reg_timeout = 3600
        acc_cfg.register_on_acc_add = 1
        acc_cfg.allow_contact_rewrite = 1
        pjsua_acc_add(&acc_cfg,1, &accountId)
       
        

The response I am getting

15:36:08.406           pjsua_core.c  ...TX 484 bytes Request msg REGISTER/cseq=52140 (tdta0x1488202a8) to UDP 105.156.199.132:5060:
REGISTER sip:105.156.199.132:5060 SIP/2.0

Via: SIP/2.0/UDP 192.168.1.113:5060;rport;branch=z9hG4bKPjVdtvBG2BI-vKTCR.U5DySVrtU4eaMgDc

Max-Forwards: 70

From: <sip:105.156.199.132>;tag=LKPvzQc2oemq7e.jtQ3-lXXF429fGE1w

To: <sip:105.156.199.132>

Call-ID: dNIIqF2voTg5iH8-83mPoVdjsUur0jKE

CSeq: 52140 REGISTER

Contact: <sip:192.168.1.113:5060;ob>

Expires: 3600

Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS

Content-Length:  0




--end msg--
15:36:08.406            pjsua_acc.c  ..Acc 0: Registration sent
15:36:08.529           pjsua_core.c  .RX 499 bytes Response msg 401/REGISTER/cseq=52140 (rdata0x148821228) from UDP 105.156.199.132:5060:
SIP/2.0 401 Unauthorized

Via: SIP/2.0/UDP 192.168.1.113:5060;rport=5060;branch=z9hG4bKPjVdtvBG2BI-vKTCR.U5DySVrtU4eaMgDc;received=103.78.19.70

From: <sip:105.156.199.132>;tag=LKPvzQc2oemq7e.jtQ3-lXXF429fGE1w

To: <sip:105.156.199.132>;tag=b27e1a1d33761e85846fc98f5f3a7e58.9f16

Call-ID: dNIIqF2voTg5iH8-83mPoVdjsUur0jKE

CSeq: 52140 REGISTER

WWW-Authenticate: Digest realm="105.156.199.132", nonce="XRSWPF0UlRBnTQ/XFuYSBGvKpDigHCdH"

Server: kamailio (4.4.7 (x86_64/linux))

Content-Length: 0




--end msg--
15:36:08.529            pjsua_acc.c  ....IP address change detected for account 0 (192.168.1.113:5060 --> 103.78.19.70:5060). Updating registration (using method 4)
15:36:08.529      sip_auth_client.c  ...Unable to set auth for tdta0x1488202a8: can not find credential for 105.156.199.132/Digest
15:36:08.529            pjsua_acc.c  ....SIP registration error: No suitable credential (PJSIP_ENOCREDENTIAL) [status=171101]

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[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