我成功完全从pjsip项目构建了样本vidgui。但是当我运行时,它无法登录到IMS服务器。服务器返回错误:
SIP/2.0 400 Bad Request - P-Visited-Network-ID header missing
以下是应用程序运行时的调试日志:
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)
以下是有关pjsua_acc_config的代码:(SIP_USERNAME,SIP_PASSWORD,SIP_DOMAIN已使用我的IMS帐户信息定义)
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>");
帮我修复此错误。谢谢!
答案 0 :(得分:2)
我认为您正面临着一个已知的OpenIMS问题:P-CSCF正在4060收听,S-CSCF收听5060.您应该通过P-CSCF到达S-CFCS,但是您正在直接访问最后一个服务器通过连接到端口5060,然后,它会抱怨因为P-Visited-Network-ID标头(应该由P-CSCF添加)丢失。
我建议您将代理地址配置更新为:
acc_cfg.proxy[acc_cfg.proxy_cnt++] = pj_str((char*) "<sip:" SIP_DOMAIN ":4060;transport=tcp>");
再试一次。
希望这有帮助。