Did you define the username,password and domain after include like below: #define SIP_DOMAIN "yourdomain" #define SIP_USER "yourusername" #define SIP_PASSWD "yourpassword" If the above didn't work, try the example thing, I mean like below: #define SIP_DOMAIN "example.com" #define SIP_USER "haripriya" #define SIP_PASSWD "secret" Coz when I run the script like above it does register saying sip:rachel at example.com <sip%3Arachel at example.com>, but after few mins it says SIP registration failed ( timeout ) coz this is just for testing purpose. Good luck! Rachel On Mon, Sep 14, 2009 at 4:10 AM, Haripriya A R <haripriya.ar at sourceedge.com>wrote: > Hi all, > > I am trying to register using pjsip? I am getting 401 unauthorized as a > response?. After that it is not resending register request with the > credential details?. > > Can any one help me in this ??? > > > > transportid = -1; > > pjsua_transport_config tcp_cfg; > > unsigned i; > > pj_status_t status; > > // register thread > > pj_thread_desc desc = {0}; > > pj_thread_t* thread = NULL; > > pj_thread_register("GThread", desc, &thread); > > pjsua_create(); > > pool = pjsua_pool_create("pjsua", 1000, 1000); > > > > pjsua_config_default(&cfg); > > pjsua_logging_config_default(&lcfg); > > pjsua_media_config_default(&mcfg); > > pjsua_transport_config_default(&udp_cfg); > > udp_cfg.port = 5060; > > pjsua_transport_config_default(&rtp_cfg); > > rtp_cfg.port = 4000; > > lcfg.level = 4; > > > > pjsua_init(&cfg,&lcfg,&mcfg); > > > > /* Add UDP transport unless it's disabled. */ > > > > pjsua_acc_id aid; > > > > status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, > > &udp_cfg, > > &transportid); > > > > /* Add local account */ > > status = pjsua_acc_add_local(transportid, PJ_TRUE, &aid); > > > > status = pjsua_media_transports_create(&rtp_cfg); > > > > pjsua_start(); > > > > pjsua_acc_config_default(&accConfig); > > > > accConfig.id = pj_str("sip:"SIP_USER"@"SIP_DOMAIN); > > accConfig.reg_uri = pj_str("sip:"SIP_USER"@"SIP_DOMAIN); > > > > // AUTHENTICATION > > accConfig.cred_count = 1; > > accConfig.cred_info[0].username = pj_str(SIP_USER); > > accConfig.cred_info[0].realm = pj_str("*"); > > accConfig.cred_info[0].scheme = pj_str(SCHEME); > > accConfig.cred_info[0].data_type = > PJSIP_CRED_DATA_PLAIN_PASSWD; > > accConfig.cred_info[0].data = pj_str(SIP_PASSWD); > > > > pjsua_acc_id pjAccId= -1; > > status = pjsua_acc_add(&accConfig, PJ_TRUE, &pjAccId); > > > > > > Thanks in Advance. > > _______________________________________________ > 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/20090914/646845e6/attachment-0001.html>