2017-03-07 77 views
0

不知道是否應該問我這個問題。Asterisk在掛斷時返回481

我正在開發一個簡單的voip應用程序。我可以打給其他用戶,但不能掛斷電話。當客戶端發送BYE請求時,服務器回答481 - 呼叫段交易不存在。 下面是客戶端日誌:

INVITE sip:[email protected]:51110;transport=UDP SIP/2.0 
Via: SIP/2.0/UDP 172.20.4.7:5060;branch=z9hG4bK06952c7a;rport 
Max-Forwards: 70 
From: "First" <sip:[email protected]>;tag=as746cc61d 
To: <sip:[email protected]:51110;transport=UDP> 
Contact: <sip:[email protected]:5060> 
Call-ID: [email protected]:5060 
CSeq: 102 INVITE 
User-Agent: FPBX-AsteriskNOW-12.0.76.4(11.16.0) 
Date: Tue, 07 Mar 2017 11:52:32 GMT 
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE 
Supported: replaces, timer 
P-Asserted-Identity: "First" <sip:[email protected]> 
Content-Type: application/sdp 
Content-Length: 310 

v=0 
o=root 2015785808 2015785808 IN IP4 172.20.4.7 
s=Asterisk PBX 11.16.0 
c=IN IP4 172.20.4.7 
t=0 0 
m=audio 13952 RTP/AVP 0 8 3 111 101 
a=rtpmap:0 PCMU/8000 
a=rtpmap:8 PCMA/8000 
a=rtpmap:3 GSM/8000 
a=rtpmap:111 G726-32/8000 
a=rtpmap:101 telephone-event/8000 
a=fmtp:101 0-16 
a=ptime:20 
a=sendrecv 
SIP/2.0 180 Ringing 
Via: SIP/2.0/UDP 172.20.4.7:51110;branch=z9hG4bKnCqg 
Contact: <sip:[email protected]:51110;transport=UDP> 
To: <sip:[email protected];transport=UDP>;tag=YU2R 
From: <sip:[email protected];transport=UDP>;tag=as746cc61d 
Call-ID: [email protected]:5060 
CSeq: 102 INVITE 
Allow-Events: presence, kpml, talk 
Content-Length: 0 

SIP/2.0 200 OK 
Via: SIP/2.0/UDP 172.20.4.7:51110;branch=z9hG4bK06952c7a;rport 
Contact: <sip:[email protected]:51110;transport=UDP> 
To: <sip:[email protected];transport=UDP>;tag=YU2R 
From: "First" <sip:[email protected];transport=>;tag=as746cc61d 
Call-ID: [email protected]:5060 
CSeq: 102 INVITE 
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE 
Accept: application/sdp, application/sdp 
Accept-Language: en 
Content-Type: application/sdp 
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri 
Allow-Events: presence, kpml, talk 
Content-Length: 247 

v=0 
o=Z 13 13 IN IP4 95.86.129.80 
s=Test 
c=IN IP4 95.86.129.80 
t=0 0 
m=audio 50000 RTP/AVP 3 110 8 0 97 101 
a=rtpmap:110 speex/8000 
a=rtpmap:97 iLBC/8000 
a=fmtp:97 mode = 30 
a=rtpmap:101 telephone-event/8000 
a=fmtp:101 0-16 
a=sendrecv 
ACK sip:[email protected]:51110;transport=UDP SIP/2.0 
Via: SIP/2.0/UDP 172.20.4.7:5060;branch=z9hG4bK54ba94a0;rport 
Max-Forwards: 70 
From: "First" <sip:[email protected]>;tag=as746cc61d 
To: <sip:[email protected]:51110;transport=UDP>;tag=YU2R 
Contact: <sip:[email protected]:5060> 
Call-ID: [email protected]:5060 
CSeq: 102 ACK 
User-Agent: FPBX-AsteriskNOW-12.0.76.4(11.16.0) 
Content-Length: 0 

BYE sip:[email protected];transport=UDP SIP/2.0 
Via: SIP/2.0/UDP 172.20.4.7:51110;branch=z9hG4bKAZsQ 
Max-Forwards: 70 
From: <sip:[email protected];transport=UDP>;tag=as746cc61d 
To: <sip:[email protected];transport=UDP>;tag=YU2R 
Contact: <sip:[email protected]:51110;transport=UDP> 
CSeq: 2 BYE 
User-Agent: TestSoftphone 
Call-ID: [email protected]:5060 
Content-Length: 0 

SIP/2.0 481 Call leg/transaction does not exist 
Via: SIP/2.0/UDP 172.20.4.7:51110;branch=z9hG4bKAZsQ;received=172.20.1.40;rport=51110 
From: <sip:[email protected];transport=UDP>;tag=as746cc61d 
To: <sip:[email protected];transport=UDP>;tag=YU2R 
Call-ID: [email protected]:5060 
CSeq: 2 BYE 
Server: FPBX-AsteriskNOW-12.0.76.4(11.16.0) 
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE 
Supported: replaces, timer 
Content-Length: 0 

我讀,如果To標籤或From標籤或Call-ID是對話外,但看起來像標籤和IDS都ok 481可能發生。我沒有收到To的標籤,所以我生成Ringing數據包,其中To標籤已設置,這可能是問題所在。

編輯。我在sip_custom.conf中添加了「pedantic = no」,現在它可以工作。雖然我不知道這個對話框有什麼問題。

+0

不清楚什麼答案481?它是星號嗎?基於kamailio的軟交換?什麼?這是openser系列的錯誤配置(kamailio,opensips)的常見錯誤。您應該始終在源代碼中包含源IP,否則很難閱讀,而且沒有人會這樣做。 – arheops

+0

是的,它是星號,日誌來自我的客戶。我編輯了這個問題。 Zoiper(SIP軟電話)可以正常使用此星號服務器,但發送BYE請求時遇到問題。答案481是日誌中的最後一個答案,正如我理解的那樣,服務器通知我它不知道該呼叫,即我用ID標記了一些東西。 – Jamil

+0

這意味着它無法識別該BYE的對話框。或者,也許已經發送BYE到其他IP。問題需要調試,沒辦法回答這個問題。調試在SO上是不重要的。 – arheops

回答

1

我很確定聯繫人標題在BYE中不是必需的。瞭解什麼是錯誤的最快方法是檢查與其他SIP客戶端的完整對話。正如你悲傷,這可能與收件人或發件人標題相關

+0

我用Zoiper檢查了完整的對話框。 Zoiper在BYE中發送Contact頭文件,所以即使沒有必要,也不會導致問題。 – Jamil

+0

大多數軟件都使用聯繫人標頭來將BYE數據包與預先設定的對話框進行匹配。 – arheops

0

請比較初始INVITE和BYE消息中Via頭的內容 - 值不同:Via:SIP/2.0/UDP 172.20.4.7:5060和Via:SIP /2.0/UDP 172.20.4.7:51110。 Asterisk創建對話框並根據Via頭中地址和端口的組合在內部標記它(在它的頭腦中)。它期望實際的對話從相同的地址和端口被取消,因此來自不同來源的所有請求被認爲是「不對話」並被拒絕。 實際問題很普遍,並且由於安裝在客戶端網絡邊緣的路由器/防火牆的行爲不正確而導致。嘗試在提及的設備上禁用ALG功能。