我正在开发一个 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";
}