【发布时间】:2012-05-08 11:14:33
【问题描述】:
我正在开发一个 SIP 提供商应用程序。我使用传输 UDP。我有一个问题, 我发送邀请消息 SIP 服务器。
INVITE sip:102@192.168.1.33 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.33:5001;branch=z9hG4bK9232c352-a28c-4467-988e-8027e0031209;rport
To: <sip:102@192.168.1.33>
From: "101"<sip:101@192.168.1.33:5060>;tag=rkktjbvq
CSeq: 1 INVITE
Call-ID: lrfnpvlvrbojabxnuldgejvncshccjpwsfxsobpcpmjrnsvkeh
Max-Forwards: 70
Contact: <sip:101@192.168.1.33:5001>
User-Agent: Iconium
Content-Type: application/sdp
Content-Length: 849
v=0
o=101 940412967 940412967 IN IP4 192.168.1.33
s=Ozeki VoIP SIP SDK
c=IN IP4 192.168.1.33
t=0 0
m=audio 5003 RTP/AVP 8 0 101 98 9 3 100 97 103 15 4 104 105 106 107 18
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=30
a=rtpmap:9 G722/8000
a=fmtp:9 bitrate=64000
a=rtpmap:3 GSM/8000
a=rtpmap:100 SPEEX/16000
a=rtpmap:97 SPEEX/8000
a=rtpmap:103 L16/8000
a=rtpmap:15 G728/8000
a=rtpmap:4 G723/8000
a=rtpmap:104 G726-16/8000
a=rtpmap:105 G726-24/8000
a=rtpmap:106 G726-32/8000
a=rtpmap:107 G726-40/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=sendrecv
m=video 5005 RTP/AVP 102 99 34
a=rtpmap:102 H263-1998/90000
a=fmtp:102 QCIF=1;CIF=1
a=rtpmap:99 H264/90000
a=fmtp:99 packetization-mode=1
a=rtpmap:34 H263/90000
a=fmtp:34 QCIF=1;CIF=1
a=sendrecv
一切正常。SIP 服务器使用 Proxy-Authenticate 响应
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 192.168.1.33:5001;branch=z9hG4bK9232c352-a28c-4467-988e-8027e0031209;rport=5001
Proxy-Authenticate:Digest nonce="414d535c05ab5fd821:79225947c170510b155be0828d92e7e4", algorithm=MD5, realm="3CXPhoneSystem"
To: <sip:102@192.168.1.33>;tag=d92fe85a
From: "101"<sip:101@192.168.1.33:5060>;tag=rkktjbvq
Call-ID: lrfnpvlvrbojabxnuldgejvncshccjpwsfxsobpcpmjrnsvkeh
CSeq: 1 INVITE
User-Agent: 3CXPhoneSystem 10.0.23053.0
Content-Length: 0
然后我发送带有 ACK 的身份验证;
INVITE sip:102@192.168.1.33 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.33:5001;branch=z9hG4bKaaf896d5-bd08-48f2-8e3d-0cf043e8324e;rport
To: <sip:102@192.168.1.33>
From: "101"<sip:101@192.168.1.33:5060>;tag=rkktjbvq
CSeq: 2 INVITE
Call-ID: lrfnpvlvrbojabxnuldgejvncshccjpwsfxsobpcpmjrnsvkeh
Max-Forwards: 70
Contact: <sip:101@192.168.1.33:5001>
User-Agent: Iconium
Content-Type: application/sdp
Proxy-Authorization:Digest username="101", realm="3CXPhoneSystem", nonce="414d535c05ab5fd821:79225947c170510b155be0828d92e7e4", response="8592afb1b7f3440afd9607dc3db588cb", uri="sip:102@192.168.1.33", algorithm=MD5
Content-Length: 849
v=0
o=101 940412967 940412967 IN IP4 192.168.1.33
s=Ozeki VoIP SIP SDK
c=IN IP4 192.168.1.33
t=0 0
m=audio 5003 RTP/AVP 8 0 101 98 9 3 100 97 103 15 4 104 105 106 107 18
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=rtpmap:98 iLBC/8000
a=fmtp:98 mode=30
a=rtpmap:9 G722/8000
a=fmtp:9 bitrate=64000
a=rtpmap:3 GSM/8000
a=rtpmap:100 SPEEX/16000
a=rtpmap:97 SPEEX/8000
a=rtpmap:103 L16/8000
a=rtpmap:15 G728/8000
a=rtpmap:4 G723/8000
a=rtpmap:104 G726-16/8000
a=rtpmap:105 G726-24/8000
a=rtpmap:106 G726-32/8000
a=rtpmap:107 G726-40/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=sendrecv
m=video 5005 RTP/AVP 102 99 34
a=rtpmap:102 H263-1998/90000
a=fmtp:102 QCIF=1;CIF=1
a=rtpmap:99 H264/90000
a=fmtp:99 packetization-mode=1
a=rtpmap:34 H263/90000
a=fmtp:34 QCIF=1;CIF=1
a=sendrecv
Sıp 服务器响应与
SIP 2.0/400 Bad Content-Length(larger than datagram)
但在 Ozeki Voip SDK 中, 而 content-length=851 一切正常。(使用 UDP 传输)
我该怎么做?我的问题在哪里?
编辑: 我的 UDP 客户端:
private void SendSIPMessage(string mesaj, bool korumalı)
{
IPEndPoint remotendpoint = new IPEndPoint(IPAddress.Any, port);
UdpClient udpClient = new UdpClient();
try
{
udpClient.Connect("192.168.1.33", 5060);
Byte[] sendBytes = Encoding.ASCII.GetBytes(mesaj);
udpClient.Send(sendBytes, sendBytes.Length);
string receivedMessage = string.Empty;
Byte[] receiveBytes = udpClient.Receive(ref remotendpoint);
receivedMessage = Encoding.ASCII.GetString(receiveBytes);
label1.Text += receivedMessage + "\n";
}
【问题讨论】:
-
如果您查看通过 Wireshark 之类的网络发送的消息,您会看到什么?您的 UDP 数据报是否分片?
标签: sip