SIP/2.0 603 已拒绝,无法实现正常的呼叫清除

SIP/2.0 603 Declined, Not able to acheive normal call clearing

我正在开发一个应用程序,在这个应用程序中,我必须在 2-3 次响铃后断开呼叫,这个应用程序的拨号方案如下所述

[public]
exten => BB12345,1,Goto(vivek_star,BB12345,1)

[vivek_star]
exten => BB12345,1,Ringing()
exten => BB12345,n,Wait(7)
exten => BB12345,n,Hangup()
exten => h,1,NoOp("call dropped")

现在我面临的问题是,我无法实现正常的呼叫清除,在响了两声后,播放了来自 operator msc 的自动语音 "The number you are calling is busy",当我开始调试 sip 日志时,我来了知道它是由于 SIP 响应 603 而发生的。请你指导我如何在上述情况下实现正常的呼叫清除。

PS 相同的拨号方案适用于 PRI。

如有任何帮助,我们将不胜感激

[May 22 15:37:04] VERBOSE[1920] chan_sip.c: 
<--- SIP read from UDP:10.52.102.31:5060 --->
ACK sip:BB12345@10.52.151.211;transport=UDP;user=phone;callmode=voice SIP/2.0
From: Vision <sip:30548013597032@10.52.102.31;transport=UDP>;tag=9cf25a88-1f66340a-13c4-50029-782773-a88579d-782773
To: UAS<sip:BB12345@10.52.151.211;transport=UDP;user=phone>;tag=as36f482dd
Call-ID: 9ce87088-1f66340a-13c4-50029-782773-3ff6c107-782773
CSeq: 1 ACK
Via: SIP/2.0/UDP 10.52.102.31:5060;branch=z9hG4bK-782773-d55a1c81-68f38a62
Max-Forwards: 70
Contact: <sip:30548013597032@10.52.102.31:5060;transport=UDP>
Content-Length: 0

<------------->
[May 22 15:37:04] VERBOSE[1920] chan_sip.c: --- (9 headers 0 lines) ---
[May 22 15:37:36] VERBOSE[1920] chan_sip.c: Really destroying SIP dialog '9ce87088-1f66340a-13c4-50029-782773-3ff6c107-782773' Method: ACK
[May 22 15:48:01] VERBOSE[1920] chan_sip.c: 
<--- SIP read from UDP:10.52.102.31:5060 --->
INVITE sip:BB12345@10.52.151.211;transport=UDP;user=phone;callmode=voice SIP/2.0
From: Vision <sip:30548013597032@10.52.102.31;transport=UDP>;tag=9ceee4e8-1f66340a-13c4-50029-782a0b-37323354-782a0b
To: UAS<sip:BB12345@10.52.151.211;transport=UDP;user=phone>
Call-ID: 9ce94dc8-1f66340a-13c4-50029-782a0b-29a57f4e-782a0b
CSeq: 1 INVITE
Via: SIP/2.0/UDP 10.52.102.31:5060;branch=z9hG4bK-782a0b-d5643be0-14c1d94d
P-Asserted-Identity: <sip:30548013597032@10.52.102.31>
Privacy: none
Max-Forwards: 70
Supported: 100rel
Allow: INVITE,ACK,CANCEL,BYE,OPTIONS,INFO,REFER,PRACK,UPDATE
Contact: <sip:30548013597032@10.52.102.31:5060;transport=UDP>
Content-Type: application/sdp
Content-Length: 317

v=0
o=vision 2890844526 2890844526 IN IP4 10.52.102.31
s=VisionSession
c=IN IP4 10.52.102.32
t=0 0
m=audio 10340 RTP/AVP 0 8 98 96
c=IN IP4 10.52.102.32
a=sendrecv
a=ptime:20
a=rtpmap:0 PCMU/8000/1
a=rtpmap:8 PCMA/8000/1
a=rtpmap:98 AMR/8000/1
a=rtpmap:96 telephone-event/8000/1
a=fmtp:98 octet-align=1
<------------->
[May 22 15:48:01] VERBOSE[1920] chan_sip.c: --- (14 headers 14 lines) ---
[May 22 15:48:01] VERBOSE[1920] chan_sip.c: Sending to 10.52.102.31:5060 (no NAT)
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Sending to 10.52.102.31:5060 (no NAT)
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Using INVITE request as basis request - 9ce94dc8-1f66340a-13c4-50029-782a0b-29a57f4e-782a0b
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: No matching peer for '30548013597032' from '10.52.102.31:5060'
[May 22 15:48:01] VERBOSE[1920][C-0000003e] netsock2.c:   == Using SIP RTP CoS mark 5
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Found RTP audio format 0
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Found RTP audio format 8
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Found RTP audio format 98
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Found RTP audio format 96
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Found audio description format PCMU for ID 0
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Found audio description format PCMA for ID 8
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Found unknown media description format AMR for ID 98
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Found audio description format telephone-event for ID 96
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Capabilities: us - (gsm|ulaw|alaw|h263|testlaw), peer - audio=(ulaw|alaw)/video=(nothing)/text=(nothing), combined - (ulaw|alaw)
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Peer audio RTP is at port 10.52.102.32:10340
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: Looking for BB12345 in public (domain 10.52.151.211)
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: list_route: hop: <sip:30548013597032@10.52.102.31:5060;transport=UDP>
[May 22 15:48:01] VERBOSE[1920][C-0000003e] chan_sip.c: 
<--- Transmitting (no NAT) to 10.52.102.31:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.52.102.31:5060;branch=z9hG4bK-782a0b-d5643be0-14c1d94d;received=10.52.102.31
From: Vision <sip:30548013597032@10.52.102.31;transport=UDP>;tag=9ceee4e8-1f66340a-13c4-50029-782a0b-37323354-782a0b
To: UAS<sip:BB12345@10.52.151.211;transport=UDP;user=phone>
Call-ID: 9ce94dc8-1f66340a-13c4-50029-782a0b-29a57f4e-782a0b
CSeq: 1 INVITE
Server: Asterisk PBX 11.16.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:BB12345@10.52.151.211:5060>
Content-Length: 0


<------------>
[May 22 15:48:01] VERBOSE[44997][C-0000003e] pbx.c:     -- Executing [BB12345@public:1] Goto("SIP/10.52.102.31-00000034", "vivek_star,BB12345,1") in new stack
[May 22 15:48:01] VERBOSE[44997][C-0000003e] pbx.c:     -- Goto (vivek_star,BB12345,1)
[May 22 15:48:01] VERBOSE[44997][C-0000003e] pbx.c:     -- Executing [BB12345@vivek_star:1] Ringing("SIP/10.52.102.31-00000034", "") in new stack
[May 22 15:48:01] VERBOSE[44997][C-0000003e] chan_sip.c: 
<--- Transmitting (no NAT) to 10.52.102.31:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.52.102.31:5060;branch=z9hG4bK-782a0b-d5643be0-14c1d94d;received=10.52.102.31
From: Vision <sip:30548013597032@10.52.102.31;transport=UDP>;tag=9ceee4e8-1f66340a-13c4-50029-782a0b-37323354-782a0b
To: UAS<sip:BB12345@10.52.151.211;transport=UDP;user=phone>;tag=as415e880a
Call-ID: 9ce94dc8-1f66340a-13c4-50029-782a0b-29a57f4e-782a0b
CSeq: 1 INVITE
Server: Asterisk PBX 11.16.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:BB12345@10.52.151.211:5060>
Content-Length: 0


<------------>
[May 22 15:48:01] VERBOSE[44997][C-0000003e] pbx.c:     -- Executing [BB12345@vivek_star:2] Wait("SIP/10.52.102.31-00000034", "7") in new stack
[May 22 15:48:08] VERBOSE[44997][C-0000003e] pbx.c:     -- Executing [BB12345@vivek_star:3] Hangup("SIP/10.52.102.31-00000034", "SIP/10.52.102.31-00000034") in new stack
[May 22 15:48:08] WARNING[44997][C-0000003e] pbx.c: Invalid cause given to Hangup(): "SIP/10.52.102.31-00000034"
[May 22 15:48:08] VERBOSE[44997][C-0000003e] pbx.c:   == Spawn extension (vivek_star, BB12345, 3) exited non-zero on 'SIP/10.52.102.31-00000034'
[May 22 15:48:08] VERBOSE[44997][C-0000003e] pbx.c:     -- Executing [h@vivek_star:1] NoOp("SIP/10.52.102.31-00000034", "vivek star test") in new stack
[May 22 15:48:08] VERBOSE[44997][C-0000003e] pbx.c:     -- Executing [h@vivek_star:2] Wait("SIP/10.52.102.31-00000034", "7") in new stack
[May 22 15:48:08] VERBOSE[44997][C-0000003e] pbx.c:   == Spawn extension (vivek_star, h, 2) exited non-zero on 'SIP/10.52.102.31-00000034'
[May 22 15:48:08] VERBOSE[44997][C-0000003e] chan_sip.c: Scheduling destruction of SIP dialog '9ce94dc8-1f66340a-13c4-50029-782a0b-29a57f4e-782a0b' in 32000 ms (Method: INVITE)
[May 22 15:48:08] VERBOSE[44997][C-0000003e] chan_sip.c: 
<--- Reliably Transmitting (no NAT) to 10.52.102.31:5060 --->
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 10.52.102.31:5060;branch=z9hG4bK-782a0b-d5643be0-14c1d94d;received=10.52.102.31
From: Vision <sip:30548013597032@10.52.102.31;transport=UDP>;tag=9ceee4e8-1f66340a-13c4-50029-782a0b-37323354-782a0b
To: UAS<sip:BB12345@10.52.151.211;transport=UDP;user=phone>;tag=as415e880a
Call-ID: 9ce94dc8-1f66340a-13c4-50029-782a0b-29a57f4e-782a0b
CSeq: 1 INVITE
Server: Asterisk PBX 11.16.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<------------>
[May 22 15:48:08] VERBOSE[1920] chan_sip.c: 
<--- SIP read from UDP:10.52.102.31:5060 --->
ACK sip:BB12345@10.52.151.211;transport=UDP;user=phone;callmode=voice SIP/2.0
From: Vision <sip:30548013597032@10.52.102.31;transport=UDP>;tag=9ceee4e8-1f66340a-13c4-50029-782a0b-37323354-782a0b
To: UAS<sip:BB12345@10.52.151.211;transport=UDP;user=phone>;tag=as415e880a
Call-ID: 9ce94dc8-1f66340a-13c4-50029-782a0b-29a57f4e-782a0b
CSeq: 1 ACK
Via: SIP/2.0/UDP 10.52.102.31:5060;branch=z9hG4bK-782a0b-d5643be0-14c1d94d
Max-Forwards: 70
Contact: <sip:30548013597032@10.52.102.31:5060;transport=UDP>
Content-Length: 0

<------------->
[May 22 15:48:08] VERBOSE[1920] chan_sip.c: --- (9 headers 0 lines) ---
[May 22 15:48:40] VERBOSE[1920] chan_sip.c: Really destroying SIP dialog '9ce94dc8-1f66340a-13c4-50029-782a0b-29a57f4e-782a0b' Method: ACK

Asterisk 挂断的可能原因很少

Congestion
Busy
Hangup
  • 直接使用拨号方案(将 return 404 未找到)

所以您只需要测试所有 3 个命令。如果没有星号重写,您不能放置任何其他代码。

感谢您的快速 response.The 上游问题 provider.Since 我们不想播放自动语音 "The number you are calling is busy",因此,我使用了 hangupcause 18。使用这个 hangupcause,我们能够实现我们的目标。