我想将呼叫从一个AGI控制的上下文转移到另一个端点。
就是这样。我有一个分配给我的星号配置的cisco网关启动的呼叫,该呼叫使用AGI处理一些树逻辑,最终将呼叫转移到另一个端点(vbox)
cisco(62.15.164.62)->
asterisk(62.12.240.121)-> do some AGI then transfer to vbox
vbox(62.15.164.65)
问题是何时发生转移。由于某种原因,来自vbox的TRYING和OK SIP数据包被星号忽略了,因为它们未在CLI中显示,但通过观看udp tcpdump可以清楚地接收到。最终在我的星号重新发出邀请数据包之后,该呼叫被丢弃,就好像在实际在接口级别发送和接收请求时都没有收到尝试/确认。
星号版本15.5.0
pjsip.conf
[t-udp-m]
type=transport
protocol=udp
bind=62.12.240.121:5060
[gw1]
type=endpoint
transport=t-udp-m
context=civr
disallow=all
allow=ulaw,speex,gsm
aors=gw1
[gw1]
type=identify
endpoint=gw1
match=62.15.164.62
[gw1]
type=aor
max_contacts=2
remove_existing=yes
[vbox]
type=endpoint
transport=t-udp-m
context=civr
disallow=all
allow=ulaw,alaw,gsm,speex
aors=vbox
send_rpid=yes
[vbox]
type=identify
endpoint=vbox
match=62.15.164.65
[vbox]
type=aor
contact=sip:7011@62.15.164.65:5060
max_contacts=1
remove_existing=yes
extensions.conf
[civr]
exten => 7010,1,Answer()
same => n,Agi(/var/www/agi-bin/agi.php)
same => n,Hangup()
[call_center_altitude]
exten => 1,1,Dial(PJSIP/vbox)
same => n,Hangup()
tcpdump
IP 62.15.164.62.61396 > 62.12.240.121.sip: UDP, length 1159
INVITE sip:7010@62.12.240.121:5060 SIP/2.0
Via: SIP/2.0/UDP 62.15.164.62:5060;branch=z9hG4bK4CB8B17BE
From: <sip:0971110799@62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010@62.12.240.121>
Date: Tue, 23 Oct 2018 02:00:59 GMT
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF@62.15.164.62
Supported: 100rel,timer,replaces
Min-SE: 1800
Cisco-Guid: 1380744107-3583906280-2679701539-3944536960
User-Agent: Cisco-SIPGateway/IOS-12.x
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, COMET, REFER, SUBSCRIBE, NOTIFY, INFO, UPDATE, REGISTER
CSeq: 101 INVITE
Max-Forwards: 70
Remote-Party-ID: <sip:0971110799@62.15.164.62>;party=calling;screen=yes;privacy=off
Timestamp: 1540260059
Contact: <sip:0971110799@62.15.164.62:5060>
Call-Info: <sip:62.15.164.62:5060>;method="NOTIFY;Event=telephone-event;Duration=2000"
Expires: 180
Allow-Events: telephone-event
Content-Type: application/sdp
Content-Length: 247
v=0
o=CiscoSystemsSIP-GW-UserAgent 1066 6200 IN IP4 62.15.164.62
s=SIP Call
c=IN IP4 62.15.164.62
t=0 0
m=audio 16658 RTP/AVP 0 101
c=IN IP4 62.15.164.62
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
IP 62.12.240.121.sip > 62.15.164.62.61396: UDP, length 326
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 62.15.164.62:5060;rport=61396;received=62.15.164.62;branch=z9hG4bK4CB8B17BE
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF@62.15.164.62
From: <sip:0971110799@62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010@62.12.240.121>
CSeq: 101 INVITE
Server: Asterisk PBX 15.5.0
Content-Length: 0
IP 62.12.240.121.sip > 62.15.164.62.61396: UDP, length 818
SIP/2.0 200 OK
Via: SIP/2.0/UDP 62.15.164.62:5060;rport=61396;received=62.15.164.62;branch=z9hG4bK4CB8B17BE
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF@62.15.164.62
From: <sip:0971110799@62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010@62.12.240.121>;tag=3780211b-39df-482f-8b48-b0ca039a65b2
CSeq: 101 INVITE
Server: Asterisk PBX 15.5.0
Contact: <sip:62.12.240.121:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length: 227
v=0
o=- 1066 6202 IN IP4 62.12.240.121
s=Asterisk
c=IN IP4 62.12.240.121
t=0 0
m=audio 26188 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
IP 62.15.164.62.61396 > 62.12.240.121.sip: UDP, length 371
ACK sip:62.12.240.121:5060 SIP/2.0
Via: SIP/2.0/UDP 62.15.164.62:5060;branch=z9hG4bK4CB8CF50
From: <sip:0971110799@62.15.164.62>;tag=BD15CD5C-FC6
To: <sip:7010@62.12.240.121>;tag=3780211b-39df-482f-8b48-b0ca039a65b2
Date: Tue, 23 Oct 2018 02:00:59 GMT
Call-ID: 524DB3FB-D59E11E8-AAA1E790-46F000BF@62.15.164.62
Max-Forwards: 70
CSeq: 101 ACK
Content-Length: 0
!!!! The problem starts here.....
IP 62.12.240.121.sip > 62.15.164.65.sip: UDP, length 1068
INVITE sip:7011@62.15.164.65:5060 SIP/2.0
Via: SIP/2.0/UDP 62.12.240.121:5060;rport;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89
From: <sip:00008577751000971110799@62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011@62.15.164.65>
Contact: <sip:asterisk@62.12.240.121:5060>
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Remote-Party-ID: <sip:00008577751000971110799@62.12.240.121>;privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0
Content-Type: application/sdp
Content-Length: 312
v=0
o=- 272899537 272899537 IN IP4 62.12.240.121
s=Asterisk
c=IN IP4 62.12.240.121
t=0 0
m=audio 21388 RTP/AVP 0 8 3 110 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:110 speex/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:60
a=sendrecv
IP 62.15.164.65.sip > 62.12.240.121.58140: UDP, length 564
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 62.12.240.121:5060;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89;received=62.12.240.121;rport=58140
From: <sip:00008577751000971110799@62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011@62.15.164.65>
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Server: Altitude vBox
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:7011@62.15.164.65:5060>
Content-Length: 0
IP 62.15.164.65.sip > 62.12.240.121.58140: UDP, length 859
SIP/2.0 200 OK
Via: SIP/2.0/UDP 62.12.240.121:5060;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89;received=62.12.240.121;rport=58140
From: <sip:00008577751000971110799@62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011@62.15.164.65>;tag=as1dce0520
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Server: Altitude vBox
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Session-Expires: 1800;refresher=uas
Contact: <sip:7011@62.15.164.65:5060>
Content-Type: application/sdp
Content-Length: 251
v=0
o=root 140358089 140358089 IN IP4 62.15.164.65
s=Altitude vBox
c=IN IP4 62.15.164.65
t=0 0
m=audio 25364 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
!!!! As you can see, the last 2 packets were ignored by my asterisk configuration and so it re-issued the INVITE packets...
IP 62.12.240.121.sip > 62.15.164.65.sip: UDP, length 1068
INVITE sip:7011@62.15.164.65:5060 SIP/2.0
Via: SIP/2.0/UDP 62.12.240.121:5060;rport;branch=z9hG4bKPj702bedc6-b346-44b2-8cc1-bbdffcb75a89
From: <sip:00008577751000971110799@62.12.240.121>;tag=b2e6cd02-127c-42ca-a51a-f98cb26329aa
To: <sip:7011@62.15.164.65>
Contact: <sip:asterisk@62.12.240.121:5060>
Call-ID: 6de2b47c-8264-452a-9656-d7d4ed6b731f
CSeq: 11604 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Remote-Party-ID: <sip:00008577751000971110799@62.12.240.121>;privacy=off;screen=no
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0
Content-Type: application/sdp
Content-Length: 312
v=0
o=- 272899537 272899537 IN IP4 62.12.240.121
s=Asterisk
c=IN IP4 62.12.240.121
t=0 0
m=audio 21388 RTP/AVP 0 8 3 110 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:110 speex/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:60
a=sendrecv
最终导致通话中断。
CLI输出
<--- Received SIP request (1159 bytes) from UDP:62.15.164.62:61396 --->
<INVITE data same as in tcpdump>
== Setting global variable 'SIPDOMAIN' to '62.12.240.121'
<--- Transmitting SIP response (326 bytes) to UDP:62.15.164.62:61396 --->
<TRYING data same as in tcpdump>
-- Executing [7010@civr:1] Answer("PJSIP/gw1-00000022", "") in new stack
> 0x7f707c019640 -- Strict RTP learning after remote address set to: 62.15.164.62:16658
<--- Transmitting SIP response (818 bytes) to UDP:62.15.164.62:61396 --->
<OK data same as in tcpdump>
<--- Received SIP request (371 bytes) from UDP:62.15.164.62:61396 --->
<ACK data same as in tcpdump>
> 0x7f707c019640 -- Strict RTP switching to RTP target address 62.15.164.62:16658 as source
-- Executing [7010@civr:8] AGI("PJSIP/gw1-00000022", "/var/www/agi-bin/agi.php") in new stack
-- Launched AGI Script /var/www/agi-bin/agi.php
<PJSIP/gw1-00000022>AGI Tx >> agi_request: /var/www/agi-bin/agi.php
<PJSIP/gw1-00000022>AGI Tx >> agi_channel: PJSIP/gw1-00000022
<PJSIP/gw1-00000022>AGI Tx >> agi_language: en
<PJSIP/gw1-00000022>AGI Tx >> agi_type: PJSIP
<PJSIP/gw1-00000022>AGI Tx >> agi_uniqueid: 1540257639.63
<PJSIP/gw1-00000022>AGI Tx >> agi_version: 15.5.0
<PJSIP/gw1-00000022>AGI Tx >> agi_callerid: 0971110799
<PJSIP/gw1-00000022>AGI Tx >> agi_calleridname: unknown
<PJSIP/gw1-00000022>AGI Tx >> agi_callingpres: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_callingani2: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_callington: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_callingtns: 0
<PJSIP/gw1-00000022>AGI Tx >> agi_dnid: 7010
<PJSIP/gw1-00000022>AGI Tx >> agi_rdnis: unknown
<PJSIP/gw1-00000022>AGI Tx >> agi_context: civr
<PJSIP/gw1-00000022>AGI Tx >> agi_extension: 7010
<PJSIP/gw1-00000022>AGI Tx >> agi_priority: 8
<PJSIP/gw1-00000022>AGI Tx >> agi_enhanced: 0.0
<PJSIP/gw1-00000022>AGI Tx >> agi_accountcode:
<PJSIP/gw1-00000022>AGI Tx >> agi_threadid: 140122966906624
<PJSIP/gw1-00000022>AGI Tx >>
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-yVABhE ""
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-yVABhE.slin' (escape_digits=) (sample_offset 0) (language 'en')
> 0x7f707c019640 -- Strict RTP learning complete - Locking on source address 62.15.164.62:16658
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0 endpos=47554
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-9pPsxq "1234"
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-9pPsxq.slin' (escape_digits=1234) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=50 endpos=21920
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-zztyOj "12"
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-zztyOj.slin' (escape_digits=12) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=49 endpos=12320
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-FyUq0g "#*0123456789"
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-FyUq0g.slin' (escape_digits=#*0123456789) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=56 endpos=13440
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=53
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=55
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=55
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=55
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=53
<PJSIP/gw1-00000022>AGI Rx << WAIT FOR DIGIT 2000
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << SET CONTEXT call_center_altitude
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << SET CALLERID 00008577751000971110799
<PJSIP/gw1-00000022>AGI Tx >> 200 result=1
<PJSIP/gw1-00000022>AGI Rx << SET EXTENSION 1
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << SET PRIORITY 1
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0
<PJSIP/gw1-00000022>AGI Rx << STREAM FILE /tmp/fest-e3ELZu ""
-- <PJSIP/gw1-00000022> Playing '/tmp/fest-e3ELZu.slin' (escape_digits=) (sample_offset 0) (language 'en')
<PJSIP/gw1-00000022>AGI Tx >> 200 result=0 endpos=34697
-- <PJSIP/gw1-00000022>AGI Script /var/www/agi-bin/agi.php completed, returning 0
-- Executing [1@call_center_altitude:1] Dial("PJSIP/gw1-00000022", "PJSIP/vbox") in new stack
-- Called PJSIP/vbox
<--- Transmitting SIP request (1068 bytes) to UDP:62.15.164.65:5060 --->
<INVITE same as in tcpdump>
!!!如tcpdump所示,TRYING和OK SIP数据包未在CLI中显示!!!
我的星号vbox端点配置中可能存在某些错误。
tcpdump命令为tcpdump -nqt -s 0 -A -i eth0 port 5060
,其中eth0
是未在CLI 62.12.240.121上收到尝试/确认的星号
我的...如果您能在这里帮助我,我会付钱给您。
答案 0 :(得分:-1)
我读错了tcpdump日志。它表明正在进行NAT。
IP 62.12.240.121.sip > 62.15.164.65.sip: UDP, length 1068
IP 62.15.164.65.sip > 62.12.240.121.58140: UDP, length 564
所以我的星号配置在端口58140而不是5060上接收了SIP数据包