0

我从 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>");

帮我解决这个错误。谢谢!

4

1 回答 1

3

我认为您面临着一个已知的 OpenIMS 问题:P-CSCF 在 4060 侦听,S-CSCF 在 5060 侦听。您应该通过 P-CSCF 到达 S-CFCS,但您通过连接到直接访问最后一个服务器端口 5060,然后,它抱怨,因为应该由 P-CSCF 添加的 P-Visited-Network-ID 标头丢失。

我建议将您的代理地址配置更新为:

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

然后再试一次。

希望这可以帮助。

于 2013-11-15T21:38:38.833 回答