Question

I success full build sample vidgui from pjsip project. But while i run, it can't login to an IMS server. Server return an error:

SIP/2.0 400 Bad Request - P-Visited-Network-ID header missing

Below is a debug log while application run:

11:07:55.376    pjsua_acc.c  .Acc 0: setting registration..
11:07:55.376    pjsua_acc.c  ..Contact for acc 0 updated for SIP outbound: <sip:18401@10.171.27.92:39191;transport=TCP;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000a3fe1a18>"
11:07:55.376  tcpc0x1386ba8  ...TCP client transport created
11:07:55.376  tcpc0x1386ba8  ...TCP transport 10.171.27.92:41599 is connecting to 10.171.18.21:5060...
11:07:55.376   pjsua_core.c  ...TX 645 bytes Request msg REGISTER/cseq=25194 (tdta0x13843b0) to TCP 10.171.18.21:5060:
REGISTER sip:10.171.18.21 SIP/2.0
Via: SIP/2.0/TCP 10.171.27.92:41599;rport;branch=z9hG4bKPjxBSX6.FR4wQKgeJSOs6OP1HzEBBJ9ivv
Route: <sip:10.171.18.21;transport=tcp;lr>
Max-Forwards: 70
From: <sip:18401@10.171.18.21>;tag=lEY0yl3PZ.6iBX9SRwhC3dmErvvDji3f
To: <sip:18401@10.171.18.21>
Call-ID: zZdqmKCxlxWG2syWmhqLtY0Xdk0rTBT-
CSeq: 25194 REGISTER
Supported: outbound, path
Contact: <sip:18401@10.171.27.92:39191;transport=TCP;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000a3fe1a18>"
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length:  0


--end msg--
11:07:55.377    pjsua_acc.c  ..Acc 0: Registration sent
11:07:55.377     vidgui.cpp  Starting stack..
11:07:55.377   pjsua_core.c  PJSUA state changed: INIT --> STARTING
11:07:55.377 sip_endpoint.c  .Module "mod-unsolicited-mwi" registered
11:07:55.377   pjsua_core.c  .PJSUA state changed: STARTING --> RUNNING
11:07:55.377     vidgui.cpp  Ready
11:07:55.377 sip_endpoint.c  Module "mod-default-handler" registered
11:07:55.385  tcpc0x1386ba8 !TCP transport 10.171.27.92:41599 is connected to 10.171.18.21:5060
11:07:55.388   pjsua_core.c  .RX 623 bytes Response msg 400/REGISTER/cseq=25194 (rdata0x1386e98) from TCP 10.171.18.21:5060:
SIP/2.0 400 Bad Request - P-Visited-Network-ID header missing
Via: SIP/2.0/TCP 10.171.27.92:41599;rport=41599;branch=z9hG4bKPjxBSX6.FR4wQKgeJSOs6OP1HzEBBJ9ivv
From: <sip:18401@10.171.18.21>;tag=lEY0yl3PZ.6iBX9SRwhC3dmErvvDji3f
To: <sip:18401@10.171.18.21>;tag=e7f797549a5ada3f2024dbe4b4572ec6-e254
Call-ID: zZdqmKCxlxWG2syWmhqLtY0Xdk0rTBT-
CSeq: 25194 REGISTER
Server: Sip EXpress router (2.1.0-dev1 OpenIMSCore (i386/linux))
Content-Length: 0
Warning: 392 10.171.18.21:5060 "Noisy feedback tells:  pid=3287 req_src_ip=10.171.27.92 req_src_port=41599 in_uri=sip:10.171.18.21 out_uri=sip:10.171.18.21 via_cnt==1"


--end msg--
11:07:55.389    pjsua_acc.c  ....SIP registration failed, status=400 (Bad Request - P-Visited-Network-ID header missing)
11:07:55.389     vidgui.cpp  ....<sip:18401@10.171.18.21>: 400/Bad Request (expires=-1)

Here is the code about pjsua_acc_config: (SIP_USERNAME, SIP_PASSWORD, SIP_DOMAIN already defined with my IMS account info)

acc_cfg.id = pj_str( (char*)"<sip:" SIP_USERNAME "@" SIP_DOMAIN ">");
acc_cfg.reg_uri = pj_str((char*) ("sip:" SIP_DOMAIN));
acc_cfg.cred_count = 1;
acc_cfg.cred_info[0].realm = pj_str((char*)"*");
acc_cfg.cred_info[0].scheme = pj_str((char*)"digest");
acc_cfg.cred_info[0].username = pj_str((char*)SIP_USERNAME);
acc_cfg.cred_info[0].data = pj_str((char*)SIP_PASSWORD);
acc_cfg.proxy[acc_cfg.proxy_cnt++] = pj_str((char*) "<sip:" SIP_DOMAIN ";transport=tcp>");

Help me fix this error. Thanks!

Was it helpful?

Solution

I think that you're facing a known OpenIMS issue: P-CSCF is listening at 4060 and S-CSCF at 5060. You should pass through P-CSCF to reach S-CFCS but you're directly accessing this last server by connecting to port 5060, then, it complains because P-Visited-Network-ID header, that should be added by P-CSCF, is missing.

I would suggest to update your proxy address configuration to:

acc_cfg.proxy[acc_cfg.proxy_cnt++] = pj_str((char*) "<sip:" SIP_DOMAIN ":4060;transport=tcp>");

and try again.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top