我正在尝试使用 request.createResponse(200) 在 Invite 请求后使用 Sip Servlet 发送 200 OK 响应。
问题是 Contact 标头没有“用户名”部分。为什么会这样?
相关代码:
protected void doInvite(SipServletRequest arg0) throws ServletException, IOException {
SipServletResponse respRinging = arg0.createResponse(180);
respRinging.send();
SipServletResponse respOk = arg0.createResponse(200);
String sdpData = "v=0\r\n" +
"o=- 2 2 IN IP4 192.168.50.18\r\n" +
"s=Testing V1.0\r\n" +
"c=IN IP4 192.168.50.18\r\n" +
"t=0 0\r\n" +
"m=audio 63364 RTP/AVP 18 101\r\n" +
"a=fmtp:18 annexb=yes\r\n" +
"a=fmtp:101 0-15\r\n" +
"a=rtpmap:18 G729/8000\r\n" +
"a=rtpmap:101 telephone-event/8000\r\n" +
"a=sendrecv\r\n";
byte[] contents = sdpData.getBytes();
respOk.setContent(contents, arg0.getContentType());
respOk.send();
}
创建了 200 条消息:
%dMES%22=SIP/2.0 200 OK
Call-ID: ZDE4MzY3NzAzNjRlN2UwZDBmMGZlNDA1MTNlZWJiOWE.
CSeq: 1 INVITE
From: 6000 <sip:6000@192.168.50.18>;tag=d765eb39
To: 2451 <sip:2451@192.168.50.18>;tag=9020141091761795_local.1330939329531_17_16
Via: SIP/2.0/UDP 192.168.50.201:57332;branch=z9hG4bK-d8754z-cc352300a144627e-1---d8754z-;rport=57332;received=192.168.50.201
Content-Type: application/sdp
Content-Length: 221
Contact: sip:IP-HOST:5060;transport=udp
我希望联系人 URI 是sip:2451@IP-HOST:5060;transport=udp