2009-10-27 104 views
3

我正在寫一個SIP服務器,並且我接到呼叫,然後將它們連接到一個voip電話,問題是當您掛斷voip電話時,BYE的轉發有問題消息,我的手機沒有結束通話。問題與SIP BYE消息

這裏是SIP消息日誌(我代替我的服務器的電話號碼,與1234與5678我的手機的電話號碼,我的服務器的IP地址已經被替換爲X和我的VoIP電話的IP已被替換成Y's) -

Incoming from 174.37.45.134:5060 - 
INVITE sip:[email protected]:5060;rinstance=f10c56ae7fb62958 SIP/2.0 
Record-Route: <sip:174.37.45.134;lr=on;ftag=VPSF506071629460> 
Record-Route: <sip:67.228.177.9;lr=on;ftag=VPSF506071629460> 
Record-Route: <sip:216.82.224.202;lr;ftag=VPSF506071629460> 
Record-Route: <sip:4.79.212.229;lr;ftag=VPSF506071629460> 
Via: SIP/2.0/UDP 174.37.45.134;branch=z9hG4bK9767.ad406992.0 
Via: SIP/2.0/UDP 67.228.177.9;rport=5060;branch=z9hG4bK9767.760c9624.0 
Via: SIP/2.0/UDP 216.82.224.202;rport=5060;received=216.82.224.202;branch=z9hG4bK9767.823f8e12.0 
Via: SIP/2.0/UDP 216.82.224.202;branch=z9hG4bK9767.723f8e12.0 
Via: SIP/2.0/UDP 4.79.212.229;branch=z9hG4bK9767.e30c5303.0 
Via: SIP/2.0/UDP 4.68.250.148:5060;branch=z9hG4bK506071629460-1256581032616 
f: "Carro Ramon" <sip:[email protected]>;tag=VPSF506071629460 
t: <sip:[email protected]:5060> 
i: [email protected] 
CSeq: 1 INVITE 
m: <sip:[email protected]:5060;transport=udp;nat=yes> 
Max-Forwards: 64 
c: application/sdp 
Content-Length: 192 

v=0 
o=- 1256664139 1256664140 IN IP4 209.247.22.135 
s=- 
c=IN IP4 174.37.45.134 
t=0 0 
m=audio 55540 RTP/AVP 0 18 101 
a=rtpmap:101 telephone-event/8000 
a=fmtp:101 0-15 
a=nortpproxy:yes 

Outgoing to 174.37.45.134:5060 - 
SIP/2.0 180 Ringing 
CSeq: 1 INVITE 
Call-ID: [email protected] 
Contact: <sip:[email protected]:5060;transport=udp;nat=yes> 
From: "Carro Ramon" <sip:[email protected]>;tag=VPSF506071629460 
Max-Forwards: 70 
Record-Route: <sip:174.37.45.134;lr=on;ftag=VPSF506071629460>, <sip:67.228.177.9;lr=on;ftag=VPSF506071629460>, <sip:216.82.224.202;lr;ftag=VPSF506071629460>, <sip:4.79.212.229;lr;ftag=VPSF506071629460> 
To: <sip:[email protected]:5060>;tag=dAmXcBGL 
Via: SIP/2.0/UDP 174.37.45.134;branch=z9hG4bK9767.ad406992.0, SIP/2.0/UDP 67.228.177.9;rport=5060;branch=z9hG4bK9767.760c9624.0, SIP/2.0/UDP 216.82.224.202;rport=5060;received=216.82.224.202;branch=z9hG4bK9767.823f8e12.0, SIP/2.0/UDP 216.82.224.202;branch=z9hG4bK9767.723f8e12.0, SIP/2.0/UDP 4.79.212.229;branch=z9hG4bK9767.e30c5303.0, SIP/2.0/UDP 4.68.250.148:5060;branch=z9hG4bK506071629460-1256581032616 
Content-Length: 0 

Outgoing to 174.37.45.134:5060 - 
SIP/2.0 200 OK 
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO 
CSeq: 1 INVITE 
Call-ID: [email protected] 
Contact: <sip:[email protected]:5060;transport=udp;nat=yes> 
Content-Type: application/sdp 
From: "Carro Ramon" <sip:[email protected]>;tag=VPSF506071629460 
Max-Forwards: 70 
Record-Route: <sip:174.37.45.134;lr=on;ftag=VPSF506071629460>, <sip:67.228.177.9;lr=on;ftag=VPSF506071629460>, <sip:216.82.224.202;lr;ftag=VPSF506071629460>, <sip:4.79.212.229;lr;ftag=VPSF506071629460> 
To: <sip:[email protected]:5060>;tag=BYFeP7T1 
Via: SIP/2.0/UDP 174.37.45.134;branch=z9hG4bK9767.ad406992.0, SIP/2.0/UDP 67.228.177.9;rport=5060;branch=z9hG4bK9767.760c9624.0, SIP/2.0/UDP 216.82.224.202;rport=5060;received=216.82.224.202;branch=z9hG4bK9767.823f8e12.0, SIP/2.0/UDP 216.82.224.202;branch=z9hG4bK9767.723f8e12.0, SIP/2.0/UDP 4.79.212.229;branch=z9hG4bK9767.e30c5303.0, SIP/2.0/UDP 4.68.250.148:5060;branch=z9hG4bK506071629460-1256581032616 
Content-Length: 206 

v=0 
o=Zoiper_user 0 0 IN IP4 xx.xx.xxx.xx 
s=Zoiper_session 
c=IN IP4 xx.xx.xxx.xx 
t=0 0 
m=audio 8000 RTP/AVP 0 101 
a=rtpmap:0 PCMU/8000 
a=rtpmap:101 telephone-event/8000 
a=fmtp:101 0-15 
a=sendrecv 

Incoming from 174.37.45.134:5060 - 
ACK sip:[email protected]:5060;transport=udp SIP/2.0 
Record-Route: <sip:174.37.45.134;lr=on;ftag=VPSF506071629460> 
Record-Route: <sip:67.228.177.9;lr=on;ftag=VPSF506071629460> 
Record-Route: <sip:216.82.224.202;lr;ftag=VPSF506071629460> 
Via: SIP/2.0/UDP 174.37.45.134;branch=z9hG4bK9767.ad406992.2 
Via: SIP/2.0/UDP 67.228.177.9;rport=5060;branch=z9hG4bK9767.760c9624.2 
Via: SIP/2.0/UDP 216.82.224.202;rport=5060;received=216.82.224.202;branch=z9hG4bK9767.723f8e12.2 
Via: SIP/2.0/UDP 4.79.212.229;branch=z9hG4bK9767.e30c5303.2 
Via: SIP/2.0/UDP 4.68.250.148:5060;branch=z9hG4bK506071629460-1256581032653 
From: "CARRO RAMON " <sip:[email protected];isup-oli=0>;tag=VPSF506071629460 
To: <sip:[email protected]:5060>;tag=BYFeP7T1 
Call-ID: [email protected] 
CSeq: 1 ACK 
Contact: <sip:4.68.250.148:5060;transport=udp> 
Max-Forwards: 66 
Content-Length: 0 

Outgoing to yyy.yyy.yy.yyy:1024 - 
INVITE sip:[email protected] SIP/2.0 
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO 
CSeq: 1 INVITE 
Call-ID: [email protected] 
Contact: <sip:[email protected]>;transport=UDP 
Content-Type: application/sdp 
From: "(null)" <sip:[email protected]>;transport=UDP;tag=7b2add35 
Max-Forwards: 70 
To: <sip:[email protected]> 
User-Agent: Zoiper rev.4186 
Via: SIP/2.0/UDP xx.xx.xxx.xx:5060 
Content-Length: 206 

v=0 
o=Zoiper_user 0 0 IN IP4 xx.xx.xxx.xx 
s=Zoiper_session 
c=IN IP4 xx.xx.xxx.xx 
t=0 0 
m=audio 8000 RTP/AVP 0 101 
a=rtpmap:0 PCMU/8000 
a=rtpmap:101 telephone-event/8000 
a=fmtp:101 0-15 
a=sendrecv 

Incoming from yyy.yyy.yy.yyy:1024 - 
SIP/2.0 100 Trying 
To: <sip:[email protected]> 
From: "(null)" <sip:[email protected]>;transport=UDP;tag=7b2add35 
Call-ID: [email protected] 
CSeq: 1 INVITE 
Via: SIP/2.0/UDP xx.xx.xxx.xx:5060 
Server: Linksys/SPA941-5.1.8 
Content-Length: 0 


Incoming from yyy.yyy.yy.yyy:1024 - 
SIP/2.0 180 Ringing 
To: <sip:[email protected]>;tag=53cca4372c533924i0 
From: "(null)" <sip:[email protected]>;transport=UDP;tag=7b2add35 
Call-ID: [email protected] 
CSeq: 1 INVITE 
Via: SIP/2.0/UDP xx.xx.xxx.xx:5060 
Server: Linksys/SPA941-5.1.8 
Content-Length: 0 

Incoming from yyy.yyy.yy.yyy:1024 - 
SIP/2.0 200 OK 
To: <sip:[email protected]>;tag=53cca4372c533924i0 
From: "(null)" <sip:[email protected]>;transport=UDP;tag=7b2add35 
Call-ID: [email protected] 
CSeq: 1 INVITE 
Via: SIP/2.0/UDP xx.xx.xxx.xx:5060 
Contact: "3998" <sip:[email protected]:5060> 
Server: Linksys/SPA941-5.1.8 
Content-Length: 212 
Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER 
Supported: replaces 
Content-Type: application/sdp 

v=0 
o=- 49591664 49591664 IN IP4 192.168.1.121 
s=- 
c=IN IP4 192.168.1.121 
t=0 0 
m=audio 16432 RTP/AVP 0 101 
a=rtpmap:0 PCMU/8000 
a=rtpmap:101 telephone-event/8000 
a=fmtp:101 0-15 
a=ptime:30 
a=sendrecv 

Outgoing to yyy.yyy.yy.yyy:1024 - 
ACK sip:[email protected] SIP/2.0 
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO 
CSeq: 1 ACK 
Call-ID: [email protected] 
Contact: <sip:[email protected]>;transport=UDP 
From: "(null)" <sip:[email protected]>;transport=UDP;tag=7b2add35 
Max-Forwards: 70 
To: <sip:[email protected]>;tag=53cca4372c533924i0 
User-Agent: Zoiper rev.4186 
Via: SIP/2.0/UDP xx.xx.xxx.xx:5060 
Content-Length: 0 

Incoming from yyy.yyy.yy.yyy:1024 - 
BYE sip:[email protected] SIP/2.0 
Via: SIP/2.0/UDP 192.168.1.121:5060;branch=z9hG4bK-598f1319 
From: <sip:[email protected]>;tag=53cca4372c533924i0 
To: "(null)" <sip:[email protected]>;tag=7b2add35 
Call-ID: [email protected] 
CSeq: 101 BYE 
Max-Forwards: 70 
User-Agent: Linksys/SPA941-5.1.8 
Content-Length: 0 

Outgoing to 174.37.45.134:5060 - 
BYE sip:[email protected] SIP/2.0 
CSeq: 2 BYE 
Call-ID: [email protected] 
Contact: <sip:[email protected]> 
From: <sip:[email protected]:5060>;tag=BYFeP7T1 
Max-Forwards: 70 
Route: <sip:174.37.45.134;lr=on;ftag=VPSF506071629460>, <sip:67.228.177.9;lr=on;ftag=VPSF506071629460>, <sip:216.82.224.202;lr;ftag=VPSF506071629460> 
To: "CARRO RAMON " <sip:[email protected];isup-oli=0>;tag=VPSF506071629460 
Via: SIP/2.0/UDP 174.37.45.134:5060 
Content-Length: 0 

Outgoing to yyy.yyy.yy.yyy:1024 - 
SIP/2.0 200 OK 
CSeq: 101 BYE 
Call-ID: [email protected] 
From: <sip:[email protected]>;tag=53cca4372c533924i0;tag=D1EASwOG 
Max-Forwards: 70 
To: "(null)" <sip:[email protected]>;tag=7b2add35 
Via: SIP/2.0/UDP 192.168.1.121:5060;branch=z9hG4bK-598f1319 

Incoming from 174.37.45.134:5060 - 
SIP/2.0 408 Request Timeout 
CSeq: 2 BYE 
Call-ID: [email protected] 
From: <sip:[email protected]:5060>;tag=BYFeP7T1 
To: "CARRO RAMON " <sip:[email protected];isup-oli=0>;tag=VPSF506071629460 
Via: SIP/2.0/UDP 174.37.45.134:5060;rport=5060;received=xx.xx.xxx.xx 
Server: Kamailio (1.5.2-notls (x86_64/linux)) 
Content-Length: 0 
Warning: 392 67.228.177.9:5060 "Noisy feedback tells: pid=15004 req_src_ip=174.37.45.134 req_src_port=5060 in_uri=sip:[email protected] out_uri=sip:[email protected] via_cnt==1092" 

回答

3

您可能想要檢查警告標題的值是什麼。 有一些自定義消息「嘈雜的反饋告訴」...這是非常特定於應用程序。 請求超時消息通常在事務超時過期時由堆棧模擬。這可能意味着您的BYE請求到達174.37.45.134:5060無法到達目的地。 這也可能是原始的BYE請求格式錯誤而其他方忽略它的情況。

您是否嘗試過使用SIPp在本地調試服務器?
您也可以運行Ethereal(Wireshark)來檢查您的流量。

+0

使用數據包嗅探器實際上可以解決我的問題,因爲我使用的是C字符串,所以我發送的數據超過了\ 0,因爲它沒有被打印出來。我在嘗試一個數據包嗅探器之前解決了它,但那不是你的錯。 – 2009-11-04 19:12:44

0

「via_cnt == 1092」也非常可疑。

順便說一句,你似乎在建立一個B2BUA,因爲你甚至在向本地電話發送邀請(1234)之前接受來自外部的呼叫。如果本地電話接受不同的參數,則接受不同的編解碼器等,因爲您告訴本地電話將媒體直接發送給原始呼叫者。他們真的應該都將他們的媒體發送到您的服務器,這將中繼(或如果需要轉碼)。

如果你不想這樣做(即你不想作爲媒體中繼和可能的轉碼器),你需要轉發INVITE到本地電話,然後轉發任何響應等。基本上行動更多的是作爲SIP代理服務器而不是SIP B2BUA。

+0

我的服務器實際上充當媒體中繼 – 2009-11-04 19:10:42

0

我建議檢查呼叫支路是否接受BYE請求(看起來它接受但是...)以及它如何處理這個請求。你真正需要的是類似的日誌從174.37.45.134。看起來問題在於.134(超時由.134生成)。

順便說一句,作爲第一次看我看你打破它可以讓你在這麼麻煩的幾個基本呼叫處理規則: - 你缺少始發呼叫站試圖響應。如果發起人的SIP堆棧真的等待這個,它可能導致電話ID沒有真正記錄。是的,這是錯誤行爲,但我們生活在現實世界中。標準表示,儘快嘗試迴應(甚至在進行路由之前,只是在呼叫認證之後) - 在與被叫方建立呼叫會話之前,甚至在發起向被叫方發出INVITE之前,這是錯誤的邏輯。至少因爲失敗的傳出呼叫始發者徵收

如果你能做到這一點快,我建議修復首先調用設置序列 反正你將需要這一點,有可能這將解決呼叫終止:。

INVITE -> 
TRYING <- 
     -> INVITE 
     <- TRYING 
     <- RINGING 
RINGING <- 
     <- OK 
OK  <- 
ACK  -> 
     -> ACK 
0

如果您希望符合RFC 3261,則要求您發送的「Via」頭包含可選的(!)「麩皮ch「參數。

參見RFC3261 ss 20。42:

儘管本說明書中的任務,所述分支參數是 存在於所有請求,所述BNF用於報頭字段指示 它是可選的。這允許與不需要插入分支參數的RFC 2543元素 互操作。

0

RFC 3261規定,在To和From字段相關聯的數字(URI)保持相同。如果涉及NAT,IP可以改變,但數字必須保持不變。如果您注意到,BYE標頭中的「收件人」和「發件人」字段會被交換,使其成爲格式錯誤的數據包。