我在 Asterisk 中遇到了以下情况,想知道您是否可以提供帮助:
- Asterisk 源 IP 发送呼叫到目标信令 IP
- 目标信令IP应答呼叫,指定目标媒体IP
- 目标信令 IP 随后向 Asterisk 源 IP 发送重新邀请,要求更改目标媒体 IP
- Asterisk 源 IP 接受重新邀请
200 OK
,但由于某种原因,继续向原始目标媒体 IP 发送 RTP
因此,问题基本上在于 Asterisk 似乎没有更改它发送 RTP 的媒体 IP,尽管它在 SIP 级别接受请求。我在底部包含了一个适当编辑的示例呼叫的 SIP 跟踪以进行说明。我chan_sip
在 Asterisk 13.23.1 中使用。我查看了directmedia
中的设置sip.conf
,但它似乎不相关,因为这是关于更改目标媒体 IP。我也尝试了strictrtp
中的各种设置rtp.conf
,但它们都无法解决问题。
以下是 的内容sip.conf
:
[general]
language=en
useragent=iConsole
bindaddr=0.0.0.0
udpbindaddr=0.0.0.0
bindport=5060
port=5060
context=from-sip
directmedia=no
nat=force_rport,comedia
dtmfmode=rfc2833
rtptimeout=300
rtpholdtimeout=300
disallow=all
allow=ulaw
allow=alaw
allow=gsm
allowoverlap=no
srvlookup=yes
ignoresdpversion=yes
t38pt_udptl=yes
session-timers=originate
insecure=port,invite
以下是 SIP 跟踪示例:
U 2019/04/18 10:32:20.129798 [Source signalling IP]:5060 -> [Destination signalling IP]:5060
INVITE sip:[Destination number]@[Destination signalling IP] SIP/2.0.
Via: SIP/2.0/UDP [Source signalling IP]:5060;branch=z9hG4bK5b1be354;rport.
Max-Forwards: 70.
From: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
To: <sip:[Destination number]@[Destination signalling IP]>.
Contact: <sip:[Source number]@[Source signalling IP]:5060>.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 102 INVITE.
User-Agent: iConsole.
Date: Thu, 18 Apr 2019 09:32:20 GMT.
Session-Expires: 1800.
Min-SE: 90.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE.
Supported: replaces, timer.
P-Asserted-Identity: "[Source number]" <sip:[Source number]@[Source signalling IP]>.
Content-Type: application/sdp.
Content-Length: 299.
.
v=0.
o=root 2043154992 2043154992 IN IP4 [Source media IP].
s=Asterisk PBX 13.23.1.
c=IN IP4 [Source media IP].
t=0 0.
m=audio 41738 RTP/AVP 0 8 3 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:3 GSM/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.
a=maxptime:150.
a=sendrecv.
U 2019/04/18 10:32:20.167590 [Destination signalling IP]:5060 -> [Source signalling IP]:5060
SIP/2.0 100 Trying.
Via: SIP/2.0/UDP [Source signalling IP]:5060;branch=z9hG4bK5b1be354;rport.
From: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
To: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 102 INVITE.
Content-Length: 0.
.
U 2019/04/18 10:32:20.221067 [Destination signalling IP]:5060 -> [Source signalling IP]:5060
SIP/2.0 180 Ringing.
Via: SIP/2.0/UDP [Source signalling IP]:5060;branch=z9hG4bK5b1be354;rport.
From: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
To: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 102 INVITE.
Contact: <sip:[Destination number]@[Destination signalling IP]:5060>.
Content-Length: 0.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REFER, PRACK, INFO, UPDATE, MESSAGE.
Record-Route: <sip:[Destination signalling IP]:5060;lr>.
Supported: replaces, 100rel.
.
U 2019/04/18 10:32:20.225010 [Destination signalling IP]:5060 -> [Source signalling IP]:5060
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP [Source signalling IP]:5060;branch=z9hG4bK5b1be354;rport.
From: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
To: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 102 INVITE.
Contact: <sip:[Destination number]@[Destination signalling IP]:5060>.
Content-Type: application/sdp.
Content-Length: 259.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REFER, PRACK, INFO, UPDATE, MESSAGE.
Record-Route: <sip:[Destination signalling IP]:5060;lr>.
Supported: replaces, 100rel.
.
v=0.
o=aculab-00ACF801 30597 30597 IN IP4 [Initial destination media IP].
s=-.
c=IN IP4 [Initial destination media IP].
t=0 0.
m=audio 21082 RTP/AVP 8 101.
c=IN IP4 [Initial destination media IP].
a=rtpmap:8 PCMA/8000.
a=ptime:20.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.
a=ptime:20.
U 2019/04/18 10:32:20.225181 [Source signalling IP]:5060 -> [Destination signalling IP]:5060
ACK sip:[Destination number]@[Destination signalling IP]:5060 SIP/2.0.
Via: SIP/2.0/UDP [Source signalling IP]:5060;branch=z9hG4bK22c119c0;rport.
Route: <sip:[Destination signalling IP]:5060;lr>.
Max-Forwards: 70.
From: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
To: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
Contact: <sip:[Source number]@[Source signalling IP]:5060>.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 102 ACK.
User-Agent: iConsole.
Content-Length: 0.
.
U 2019/04/18 10:32:40.612245 [Destination signalling IP]:5060 -> [Source signalling IP]:5060
INVITE sip:[Source number]@[Source signalling IP]:5060 SIP/2.0.
Via: SIP/2.0/UDP [Destination signalling IP];rport;branch=z9hG4bK1a78edfd6fbc9c8b659a4ef56fe54765.
Max-Forwards: 70.
From: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
To: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 103 INVITE.
Contact: <sip:[Destination number]@[Destination signalling IP]:5060>.
Content-Type: application/sdp.
Content-Length: 211.
Supported: replaces, 100rel.
.
v=0.
o=C3PCALL0 1555579960 1555579960 IN IP4 [New destination media IP].
s=-.
c=IN IP4 [New destination media IP].
t=0 0.
m=audio 20020 RTP/AVP 8 101.
a=rtpmap:8 PCMA/8000.
a=ptime:20.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
U 2019/04/18 10:32:40.612444 [Source signalling IP]:5060 -> [Destination signalling IP]:5060
SIP/2.0 100 Trying.
Via: SIP/2.0/UDP [Destination signalling IP];branch=z9hG4bK1a78edfd6fbc9c8b659a4ef56fe54765;received=[Destination signalling IP];rport=5060.
From: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
To: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 103 INVITE.
Server: iConsole.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE.
Supported: replaces, timer.
Session-Expires: 1800;refresher=uas.
Contact: <sip:[Source number]@[Source signalling IP]:5060>.
Content-Length: 0.
.
U 2019/04/18 10:32:40.612496 [Source signalling IP]:5060 -> [Destination signalling IP]:5060
SIP/2.0 200 OK.
Via: SIP/2.0/UDP [Destination signalling IP];branch=z9hG4bK1a78edfd6fbc9c8b659a4ef56fe54765;received=[Destination signalling IP];rport=5060.
From: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
To: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 103 INVITE.
Server: iConsole.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE.
Supported: replaces, timer.
Session-Expires: 1800;refresher=uas.
Contact: <sip:[Source number]@[Source signalling IP]:5060>.
Content-Type: application/sdp.
Content-Length: 299.
.
v=0.
o=root 2043154992 2043154993 IN IP4 [Source media IP].
s=Asterisk PBX 13.23.1.
c=IN IP4 [Source media IP].
t=0 0.
m=audio 41738 RTP/AVP 8 0 3 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:3 GSM/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.
a=maxptime:150.
a=sendrecv.
U 2019/04/18 10:32:40.623395 [Destination signalling IP]:5060 -> [Source signalling IP]:5060
ACK sip:[Source number]@[Source signalling IP]:5060 SIP/2.0.
Via: SIP/2.0/UDP [Destination signalling IP];rport;branch=z9hG4bK1a78edfd6fbc9c8b659a4ef56fe54765.
Max-Forwards: 70.
From: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
To: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 103 ACK.
Contact: <sip:[Destination number]@[Destination signalling IP]:5060>.
Content-Length: 0.
Supported: replaces, 100rel.
.
U 2019/04/18 10:32:52.168069 [Source signalling IP]:5060 -> [Destination signalling IP]:5060
BYE sip:[Destination number]@[Destination signalling IP]:5060 SIP/2.0.
Via: SIP/2.0/UDP [Source signalling IP]:5060;branch=z9hG4bK589b107e;rport.
Route: <sip:[Destination signalling IP]:5060;lr>.
Max-Forwards: 70.
From: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
To: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 103 BYE.
User-Agent: iConsole.
X-Asterisk-HangupCause: Normal Clearing.
X-Asterisk-HangupCauseCode: 16.
Content-Length: 0.
.
U 2019/04/18 10:32:52.182326 [Destination signalling IP]:5060 -> [Source signalling IP]:5060
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP [Source signalling IP]:5060;branch=z9hG4bK589b107e;rport.
From: "[Source number]" <sip:[Source number]@[Source signalling IP]>;tag=as52fa238f.
To: <sip:[Destination number]@[Destination signalling IP]>;tag=1b10d58e81c1742e.
Call-ID: 1a78edfd6fbc9c8b659a4ef56fe54765@[Source signalling IP]:5060.
CSeq: 103 BYE.
Content-Length: 0.
.
任何建议将不胜感激!
答案1
也许你应该
directmedia=yes
directrtpsetup=yes
canreinvite=yes
或者要求您的提供商不要重新邀请。
答案2
发生这种情况的原因通常是,当 Asterisk 收到 reINVITE 时,SDP 版本与第一个 INVITE(v = 0)中的版本相同,因此 Asterisk 会识别出它未听到 SDP 更改,并且不会应用新参数。对于 Asterisk 来说,要完全重新应用会话中触发的每个 INVITE 的所有 SDP 参数,这将取决于 SIP 中继设置中的参数:
ignoresdpversion=yes
这应该可以解决你的问题。