ARI mixing bridge media disable Asterisk Re-INVITE

Hi All,

I have an Asterisk 15 in Centos 7 configured with 2 SIP trunk. It receives the first INVITE from first network, hold it and wait until it receive the second INVITE to bridge both of those channels using an ARI application.

I have configured ARI application for the extension. when my ARI Application receives the STASIS_START event of the second channels creation it bridge them. Then Asterisk send a new (RE-)INVITE to one of those Trunk.

We want to disable that invite from happening so we have tried to change the endpoints configuration in the pjsip and disable direct media setup but nothing change, until we force the code list in the trunks configuration to support only one code, in that case we don’t have a reinvite.

The problem is, I want Asterisk to handle the media without sending an RE-INVITE in any case. Basically,

I tried

direct_media=no
rtp_symmetric=no
asymmetric_rtp_codec=yes

But Asterisk send always a RE-INVITE after the bridge creation.

Thanks in advance for any help
/Ouss

Asterisk logs

https://pastebin.com/ygJjRqHv

SIP trace

U 10.156.0.8:5060 -> 10.156.0.7:5060
INVITE sip:+46844685057@hlb-01.preprod.XXXX.io SIP/2.0.
Record-Route: <sip:10.156.0.8;r2=on;lr;ftag=iOS1AFBFAC4;nat=yes>.
Record-Route: <sip:35.198.185.69:443;transport=ws;r2=on;lr;ftag=iOS1AFBFAC4;nat=yes>.
Via: SIP/2.0/UDP 10.156.0.8;branch=z9hG4bKb615.b3bb3735360f5e563119b34afebb2db7.0.
Via: SIP/2.0/WSS ios231s0d.invalid;rport=64192;received=130.211.0.203;branch=z9hG4bKCH1FMyeOOjJ3fDx.
From: 48786098683 <sip:48786098683@hlb-01.preprod.XXXXX.io>;tag=iOS1AFBFAC4.
To:  <sip:+46844685057@hlb-01.preprod.XXXXX.io>.
Call-ID: BD479E7B-F3FF-4F3F-964A-A190F6821709-1359-000006813FE42F0D.
CSeq: 101 INVITE.
Contact: <sip:48786098683@ios231s0d.invalid;alias=130.211.0.203~64192~6;alias=130.211.0.203~64192~6>;expires=3600.
Content-Type: application/sdp.
Max-Forwards: 69.
User-Agent: XXXXXiOS-v.01.
X-RebType: Rebin.
Content-Length:  860.
.
v=0.
o=- 3510382619956952172 2 IN IP4 10.156.0.8.
s=-.
t=0 0.
a=msid-semantic: WMS ARDAMS.
m=audio 16860 RTP/AVP 111 103 104 9 102 0 8 106 105 13 110 112 113 126.
c=IN IP4 10.156.0.8.
a=rtpmap:111 opus/48000/2.
a=rtcp-fb:111 transport-cc.
a=fmtp:111 minptime=10;useinbandfec=1.
a=rtpmap:103 ISAC/16000.
a=rtpmap:104 ISAC/32000.
a=rtpmap:9 G722/8000.
a=rtpmap:102 ILBC/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:106 CN/32000.
a=rtpmap:105 CN/16000.
a=rtpmap:13 CN/8000.
a=rtpmap:110 telephone-event/48000.
a=rtpmap:112 telephone-event/32000.
a=rtpmap:113 telephone-event/160

U 10.156.0.7:5060 -> 10.156.0.8:5060
SIP/2.0 100 Trying.
Via: SIP/2.0/UDP 10.156.0.8;received=10.156.0.8;branch=z9hG4bKb615.b3bb3735360f5e563119b34afebb2db7.0.
Via: SIP/2.0/WSS ios231s0d.invalid;rport=64192;received=130.211.0.203;branch=z9hG4bKCH1FMyeOOjJ3fDx.
Record-Route: <sip:10.156.0.8;lr;r2=on;ftag=iOS1AFBFAC4;nat=yes>.
Record-Route: <sip:35.198.185.69:443;transport=ws;lr;r2=on;ftag=iOS1AFBFAC4;nat=yes>.
Call-ID: BD479E7B-F3FF-4F3F-964A-A190F6821709-1359-000006813FE42F0D.
From: "48786098683" <sip:48786098683@hlb-01.preprod.XXXXX.io>;tag=iOS1AFBFAC4.
To: <sip:+46844685057@hlb-01.preprod.XXXXX.io>.
CSeq: 101 INVITE.
Server: XXXXX Media Gateway 3.
Content-Length:  0.
.


U 10.156.0.7:5060 -> 10.156.0.8:5060
SIP/2.0 180 Ringing.
Via: SIP/2.0/UDP 10.156.0.8;received=10.156.0.8;branch=z9hG4bKb615.b3bb3735360f5e563119b34afebb2db7.0.
Via: SIP/2.0/WSS ios231s0d.invalid;rport=64192;received=130.211.0.203;branch=z9hG4bKCH1FMyeOOjJ3fDx.
Record-Route: <sip:10.156.0.8;lr;r2=on;ftag=iOS1AFBFAC4;nat=yes>.
Record-Route: <sip:35.198.185.69:443;transport=ws;lr;r2=on;ftag=iOS1AFBFAC4;nat=yes>.
Call-ID: BD479E7B-F3FF-4F3F-964A-A190F6821709-1359-000006813FE42F0D.
From: "48786098683" <sip:48786098683@hlb-01.preprod.XXXXX.io>;tag=iOS1AFBFAC4.
To: <sip:+46844685057@hlb-01.preprod.XXXXX.io>;tag=157a9df0-208c-480b-8253-6e53dc915285.
CSeq: 101 INVITE.
Server: XXXXX Media Gateway 3.
Contact: <sip:10.156.0.7:5060>.
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER.
Content-Length:  0.
.


U 10.156.0.3:5080 -> 10.156.0.7:5060
INVITE sip:46844685057@35.198.186.28:5060 SIP/2.0.
Record-Route: <sip:10.156.0.3:5080;r2=on;lr=on;ftag=as7f917111>.
Record-Route: <sip:35.198.187.202;r2=on;lr=on;ftag=as7f917111>.
Record-Route: <sip:81.201.82.45;lr=on>.
Call-ID: 2EGO4B6D5RCSDG5KSYFPEMBASY@81.201.82.106.
CSeq: 102 INVITE.
From: <sip:46737451349@voxbone.com>;tag=as7f917111.
Via: SIP/2.0/UDP 10.156.0.3:5080;branch=z9hG4bK6c87.c6d19ae260b4d8963c2912d30381432d.0.
Via: SIP/2.0/UDP 81.201.82.45;branch=z9hG4bK6c87.bec363c005293f9a5eabb60e8abdeff8.0.
Via: SIP/2.0/UDP 81.201.82.106:5060;branch=z9hG4bK-333437-88ba857adbb79e1561fdd7ab92d33ccc.
Max-Forwards: 67.
Content-Type: application/sdp.
Contact: <sip:46737451349@81.201.82.106:5060;transport=udp>.
User-Agent: Vox Callcontrol.
To: <sip:46844685057@35.198.186.28:5060>.
Content-Length: 474.
.
v=0.
o=root 1316722290 1316722290 IN IP4 81.201.82.219.
s=session.
c=IN IP4 81.201.82.219.
t=0 0.
m=audio 18636 RTP/AVP 8 0 18 110 107 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:18 G729/8000.
a=fmtp:18 annexb=no.
a=rtpmap:110 speex/8000.
a=rtpmap:107 opus/48000/2.
a=maxptime:60.
a=fmtp:107 maxplaybackrate=48000; stereo=0; sprop-stereo=0; useinbandfec=0.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=silenceSupp:off - - - -.
a=ptime:20.
a=sendrecv.


U 10.156.0.7:5060 -> 10.156.0.3:5080
SIP/2.0 100 Trying.
Via: SIP/2.0/UDP 10.156.0.3:5080;rport=5080;received=10.156.0.3;branch=z9hG4bK6c87.c6d19ae260b4d8963c2912d30381432d.0.
Via: SIP/2.0/UDP 81.201.82.45;branch=z9hG4bK6c87.bec363c005293f9a5eabb60e8abdeff8.0.
Via: SIP/2.0/UDP 81.201.82.106:5060;branch=z9hG4bK-333437-88ba857adbb79e1561fdd7ab92d33ccc.
Record-Route: <sip:10.156.0.3:5080;lr;r2=on;ftag=as7f917111>.
Record-Route: <sip:35.198.187.202;lr;r2=on;ftag=as7f917111>.
Record-Route: <sip:81.201.82.45;lr>.
Call-ID: 2EGO4B6D5RCSDG5KSYFPEMBASY@81.201.82.106.
From: <sip:46737451349@voxbone.com>;tag=as7f917111.
To: <sip:46844685057@35.198.186.28>.
CSeq: 102 INVITE.
Server: XXXXX Media Gateway 3.
Content-Length:  0.
.


U 10.156.0.7:5060 -> 10.156.0.3:5080
SIP/2.0 180 Ringing.
Via: SIP/2.0/UDP 10.156.0.3:5080;rport=5080;received=10.156.0.3;branch=z9hG4bK6c87.c6d19ae260b4d8963c2912d30381432d.0.
Via: SIP/2.0/UDP 81.201.82.45;branch=z9hG4bK6c87.bec363c005293f9a5eabb60e8abdeff8.0.
Via: SIP/2.0/UDP 81.201.82.106:5060;branch=z9hG4bK-333437-88ba857adbb79e1561fdd7ab92d33ccc.
Record-Route: <sip:10.156.0.3:5080;lr;r2=on;ftag=as7f917111>.
Record-Route: <sip:35.198.187.202;lr;r2=on;ftag=as7f917111>.
Record-Route: <sip:81.201.82.45;lr>.
Call-ID: 2EGO4B6D5RCSDG5KSYFPEMBASY@81.201.82.106.
From: <sip:46737451349@voxbone.com>;tag=as7f917111.
To: <sip:46844685057@35.198.186.28>;tag=c9f1266d-f383-4403-89a8-f5559e19fab3.
CSeq: 102 INVITE.
Server: XXXXX Media Gateway 3.
Contact: <sip:10.156.0.7:5060>.
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER.
Content-Length:  0.
.


U 10.156.0.7:5060 -> 10.156.0.3:5080
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 10.156.0.3:5080;rport=5080;received=10.156.0.3;branch=z9hG4bK6c87.c6d19ae260b4d8963c2912d30381432d.0.
Via: SIP/2.0/UDP 81.201.82.45;branch=z9hG4bK6c87.bec363c005293f9a5eabb60e8abdeff8.0.
Via: SIP/2.0/UDP 81.201.82.106:5060;branch=z9hG4bK-333437-88ba857adbb79e1561fdd7ab92d33ccc.
Record-Route: <sip:10.156.0.3:5080;lr;r2=on;ftag=as7f917111>.
Record-Route: <sip:35.198.187.202;lr;r2=on;ftag=as7f917111>.
Record-Route: <sip:81.201.82.45;lr>.
Call-ID: 2EGO4B6D5RCSDG5KSYFPEMBASY@81.201.82.106.
From: <sip:46737451349@voxbone.com>;tag=as7f917111.
To: <sip:46844685057@35.198.186.28>;tag=c9f1266d-f383-4403-89a8-f5559e19fab3.
CSeq: 102 INVITE.
Server: XXXXX Media Gateway 3.
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER.
Contact: <sip:10.156.0.7:5060>.
Supported: 100rel, timer, replaces, norefersub.
Content-Type: application/sdp.
Content-Length:   367.
.
v=0.
o=- 1316722290 1316722292 IN IP4 35.198.86.207.
s=XXXXX.
c=IN IP4 35.198.86.207.
t=0 0.
m=audio 12900 RTP/AVP 107 8 0 18 110 101.
a=rtpmap:107 opus/48000/2.
a=rtpmap:8 PCMA/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:18 G729/8000.
a=fmtp:18 annexb=no.
a=rtpmap:110 speex/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.
a=maxptime:20.
a=sendrecv.


U 10.156.0.3:5080 -> 10.156.0.7:5060
ACK sip:10.156.0.7:5060 SIP/2.0.
Record-Route: <sip:81.201.82.45;lr=on>.
Call-ID: 2EGO4B6D5RCSDG5KSYFPEMBASY@81.201.82.106.
CSeq: 102 ACK.
From: <sip:46737451349@voxbone.com>;tag=as7f917111.
To: <sip:46844685057@35.198.186.28:5060>;tag=c9f1266d-f383-4403-89a8-f5559e19fab3.
Via: SIP/2.0/UDP 10.156.0.3:5080;branch=z9hG4bK6c87.329045c21c4f9ef7ca8b94451da4d7a7.0.
Via: SIP/2.0/UDP 81.201.82.45;branch=z9hG4bK6c87.cb7e2b794b68224c43f3beb124c5a439.0.
Via: SIP/2.0/UDP 81.201.82.106:5060;branch=z9hG4bK-333437-f9d29d92fa4ab45a3f259ee76e526aaf.
Max-Forwards: 67.
Contact: <sip:46737451349@81.201.82.106:5060;transport=udp>.
User-Agent: Vox Callcontrol.
Content-Length: 0.
.


U 10.156.0.7:5060 -> 10.156.0.8:5060
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 10.156.0.8;received=10.156.0.8;branch=z9hG4bKb615.b3bb3735360f5e563119b34afebb2db7.0.
Via: SIP/2.0/WSS ios231s0d.invalid;rport=64192;received=130.211.0.203;branch=z9hG4bKCH1FMyeOOjJ3fDx.
Record-Route: <sip:10.156.0.8;lr;r2=on;ftag=iOS1AFBFAC4;nat=yes>.
Record-Route: <sip:35.198.185.69:443;transport=ws;lr;r2=on;ftag=iOS1AFBFAC4;nat=yes>.
Call-ID: BD479E7B-F3FF-4F3F-964A-A190F6821709-1359-000006813FE42F0D.
From: "48786098683" <sip:48786098683@hlb-01.preprod.XXXXX.io>;tag=iOS1AFBFAC4.
To: <sip:+46844685057@hlb-01.preprod.XXXXX.io>;tag=157a9df0-208c-480b-8253-6e53dc915285.
CSeq: 101 INVITE.
Server: XXXXX Media Gateway 3.
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER.
Contact: <sip:10.156.0.7:5060>.
Supported: 100rel, timer, replaces, norefersub.
Content-Type: application/sdp.
Content-Length:   332.
.
v=0.
o=XXXXX 3762109548 4 IN IP4 10.156.0.7.
s=XXXXX.
c=IN IP4 10.156.0.7.
t=0 0.
m=audio 19788 RTP/AVP 111 8 0 9 126.
a=rtpmap:111 opus/48000/2.
a=fmtp:111 useinbandfec=1.
a=rtpmap:8 PCMA/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:9 G722/8000.
a=rtpmap:126 telephone-event/8000.
a=fmtp:126 0-16.
a=ptime:20.
a=maxptime:20.
a=sendrecv.


U 10.156.0.8:5060 -> 10.156.0.7:5060
ACK sip:10.156.0.7:5060 SIP/2.0.
Via: SIP/2.0/UDP 10.156.0.8;branch=z9hG4bKb615.b3bb3735360f5e563119b34afebb2db7.0.
Via: SIP/2.0/WSS ios231s0d.invalid;rport=64192;received=130.211.0.203;branch=z9hG4bKCH1FMyeOOjJ3fDx.
From: "48786098683" <sip:48786098683@hlb-01.preprod.XXXXX.io>;tag=iOS1AFBFAC4.
To: <sip:+46844685057@hlb-01.preprod.XXXXX.io>;tag=157a9df0-208c-480b-8253-6e53dc915285.
Call-ID: BD479E7B-F3FF-4F3F-964A-A190F6821709-1359-000006813FE42F0D.
CSeq: 101 ACK.
Max-Forwards: 69.
Content-Length: 0.
.



U 10.156.0.7:5060 -> 10.156.0.8:5060
INVITE sip:48786098683@ios231s0d.invalid;alias=130.211.0.203~64192~6;alias=130.211.0.203~64192~6 SIP/2.0.
Via: SIP/2.0/UDP 10.156.0.7:5060;rport;branch=z9hG4bKPjd45f33bf-0054-4bef-9c93-469acd4e4864.
From: <sip:+46844685057@hlb-01.preprod.XXXXX.io>;tag=157a9df0-208c-480b-8253-6e53dc915285.
To: "48786098683" <sip:48786098683@hlb-01.preprod.XXXXX.io>;tag=iOS1AFBFAC4.
Contact: <sip:10.156.0.7:5060>.
Call-ID: BD479E7B-F3FF-4F3F-964A-A190F6821709-1359-000006813FE42F0D.
CSeq: 32205 INVITE.
Route: <sip:10.156.0.8;lr;r2=on;ftag=iOS1AFBFAC4;nat=yes>.
Route: <sip:35.198.185.69:443;transport=ws;lr;r2=on;ftag=iOS1AFBFAC4;nat=yes>.
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.
Max-Forwards: 70.
User-Agent: XXXXX Media Gateway 3.
Content-Type: application/sdp.
Content-Length:   357.
.
v=0.
o=XXXXX 3762109548 5 IN IP4 10.156.0.7.
s=XXXXX.
c=IN IP4 10.156.0.7.
t=0 0.
m=audio 19788 RTP/AVP 111 8 0 18 110 126.
a=rtpmap:111 opus/48000/2.
a=rtpmap:8 PCMA/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:18 G729/8000.
a=fmtp:18 annexb=no.
a=rtpmap:110 speex/8000.
a=rtpmap:126 telephone-event/8000.
a=fmtp:126 0-16.
a=ptime:20.
a=maxptime:20.
a=sendrecv.


U 10.156.0.8:5060 -> 10.156.0.7:5060
SIP/2.0 100 trying -- your call is important to us.
Via: SIP/2.0/UDP 10.156.0.7:5060;rport=5060;branch=z9hG4bKPjd45f33bf-0054-4bef-9c93-469acd4e4864;received=10.156.0.7.
From: <sip:+46844685057@hlb-01.preprod.XXXXX.io>;tag=157a9df0-208c-480b-8253-6e53dc915285.
To: "48786098683" <sip:48786098683@hlb-01.preprod.XXXXX.io>;tag=iOS1AFBFAC4.
Call-ID: BD479E7B-F3FF-4F3F-964A-A190F6821709-1359-000006813FE42F0D.
CSeq: 32205 INVITE.
Server: kamailio (5.0.4 (x86_64/linux)).
Content-Length: 0.
.

...

Reinvites can occur for different reasons, such as to allow media to go directly or for updating connected line information. In this case it’s happening as an attempt to update connected line information but due to the configuration the re-invite doesn’t contain the information to do so. At the time the reinvite is being created this isn’t known, so one still ends up getting sent. In practice this should be fine as SIP allows reinvites to occur that may not even really do anything. Making the code not do this would require res_pjsip_session changes to try to make it more intelligent.

Is there some underlying problem that this is actually causing?

Thank you for your quick reply !
This is my endpints configuration in pjsip.conf:

[general]
useragent=Media Gateway 3

[global]
type=global
user_agent=Media Gateway 3

[system]
type=system
;timer_t1=200
timer_t1=10000
timer_b=640000

[transport-udp]
type = transport
protocol=udp
bind=0.0.0.0:5060
local_net=10.156.0.0/255.255.240.0

[sip-proxy]
type=endpoint
transport=transport-udp
context=routing
disallow=all
allow=opus
allow=alaw
allow=ulaw
; extra codecs
allow=g729
allow=speex
allow=g722

aors=sip-proxy
direct_media=no

;rtp_symmetric=no
;asymmetric_rtp_codec=yes

force_rport=yes
rewrite_contact=no
;bind_rtp_to_media_address=10.156.0.7
;media_address=10.156.0.7
bind_rtp_to_media_address=35.198.XX.XX
media_address=35.198.XX.XX

[sip-proxy]
type=identify
endpoint=sip-proxy
match=10.156.0.3,10.156.0.9

[sip-proxy]
type=aor
contact=sip:10.156.0.9:5060
contact=sip:10.156.0.3:5060

[web-proxy]
type=endpoint
transport=transport-udp
context=routing
disallow=all
allow=opus
allow=alaw
allow=ulaw
; extra codecs
allow=speex
allow=g729
allow=g722


;rtp_symmetric=yes
;asymmetric_rtp_codec=yes
;rtcp_mux=yes


aors=web-proxy
direct_media=no
force_rport=no
rewrite_contact=no
bind_rtp_to_media_address=10.156.0.7
media_address=10.156.0.7
;ice_support=no
;timers=no
;rpid_immediate=yes

[web-proxy]
type=identify
endpoint=web-proxy
srv_lookups=no
match=10.156.0.8,10.156.0.4

[web-proxy]
type=aor
contact=sip:10.156.0.4:5060
contact=sip:10.156.0.8:5060

In fact we are testing a new beta WEBRTC application, it connects Asterisk through a Kamailio WebRTC proxy, We are facing some problems to handle that Re-INVITE and updating the SDP and another problem with our backend ARI app to match the events, this is why we are looking to just disable it.

BR
/Ouss

There is no way to disable it currently.