# If I use direct\_media = yes, SDP not update on 2nd INVITE

**URL:** <https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031>\
**Category:** Asterisk SIP\
**Created:** [May 23, 2023, 4:40am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031 "2023-05-23T04:40:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrsugitani](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/mrsugitani/32/6575_2.png) [@mrsugitani](https://community.asterisk.org/u/mrsugitani)\
**Post date:** [May 23, 2023, 4:40am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/1 "2023-05-23T04:40:39Z")

</div>

I made B2BUA gateway.  
On Asterisk 18 with PJSIP, I set for direct\_media =yes.

After 200 OK and ACK, Asterisk will send 2nd INVITE to both side correctly.  
But SDP is not updated.  
So Asterisk still handle with RTP.

messages log said “media will flow directly between them” it seem working.  
Does anyone have any good ideas for this?

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [May 23, 2023, 10:39am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/2 "2023-05-23T10:39:06Z")

</div>

Are you doing something that requires Asterisk to see the media, or to see inband, or RFC 4833 DTMF?

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 23, 2023, 11:00am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/3 "2023-05-23T11:00:54Z")

</div>

Do you have external\_\* settings on the transport?

---

<div class="post-metadata">

**Author:** ![mrsugitani](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/mrsugitani/32/6575_2.png) [@mrsugitani](https://community.asterisk.org/u/mrsugitani)\
**Post date:** [May 23, 2023, 11:14am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/4 "2023-05-23T11:14:53Z")

</div>

I commented out for allow = ulaw.  
So If incoming call Asterisk respond with 488 Not Acceptable Here.  
Thank you.

---

<div class="post-metadata">

**Author:** ![mrsugitani](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/mrsugitani/32/6575_2.png) [@mrsugitani](https://community.asterisk.org/u/mrsugitani)\
**Post date:** [May 23, 2023, 11:18am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/5 "2023-05-23T11:18:07Z")

</div>

I have settings like below.  
external\_signaling\_address=20.78.xx.xx  
external\_media\_address=20.78.xx.xx

I commented out for media, SDP become local address on 1st and 2nd INVITE.  
Thank you.

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 24, 2023, 8:51am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/6 "2023-05-24T08:51:01Z")

</div>

What version of Asterisk?

---

<div class="post-metadata">

**Author:** ![mrsugitani](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/mrsugitani/32/6575_2.png) [@mrsugitani](https://community.asterisk.org/u/mrsugitani)\
**Post date:** [May 24, 2023, 11:09am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/7 "2023-05-24T11:09:23Z")

</div>

Asterisk 18.13.0

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 24, 2023, 11:11am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/8 "2023-05-24T11:11:01Z")

</div>

That’s an almost year old version of Asterisk. You should always try the latest version to ensure you aren’t chasing/experiencing issues that have already been resolved.

You can opt not to, but people may be less willing to spend time on it.

---

<div class="post-metadata">

**Author:** ![mrsugitani](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/mrsugitani/32/6575_2.png) [@mrsugitani](https://community.asterisk.org/u/mrsugitani)\
**Post date:** [May 24, 2023, 11:31am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/9 "2023-05-24T11:31:15Z")

</div>

Thank you.  
I need to connect a VoIP trunk provider of Japan.  
They provide patch for Asterisk for connect to their trunk.  
Because it’s not B2BUA trunk.  
Asterisk 18.13.0 is latest version which they provide patch for Asterisk.

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 24, 2023, 11:33am UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/10 "2023-05-24T11:33:03Z")

</div>

I don’t have anything additional to add, then.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [May 24, 2023, 12:57pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/11 "2023-05-24T12:57:18Z")

</div>

> [@mrsugitani](#):
>
> Because it’s not B2BUA trunk.

What does this mean?

---

<div class="post-metadata">

**Author:** ![TheMark](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/themark/32/4771_2.png) [@TheMark](https://community.asterisk.org/u/TheMark)\
**Post date:** [May 24, 2023, 1:17pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/12 "2023-05-24T13:17:02Z")

</div>

and more important what do the patch do !!!  
or is it just a config they provide

are you allowed to post the patch here ?

---

<div class="post-metadata">

**Author:** ![mrsugitani](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/mrsugitani/32/6575_2.png) [@mrsugitani](https://community.asterisk.org/u/mrsugitani)\
**Post date:** [May 24, 2023, 1:25pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/13 "2023-05-24T13:25:55Z")

</div>

They give permission for connect to their trunk if we use certificated PBX.  
it match for rule for their SIP trunk like headers or register interval and format.  
Patched Asterisk is match for rule of their trunk.  
In case of B2BUA SIP trunk, there is gateway(B2BUA) server in front of their SIP server.

You can download the patch:

> **[IP電話サービス対応 Asterisk修正プログラム ｜ ダウンロード ｜ オープンソースIP-PBXソフトウェア Asterisk](https://comm.rakuten.co.jp/houjin/asterisk_ip/download/patch.html)**
>
> 高価なPBXは不要！通信機器・通信費の大幅コスト削減にIP電話サービス対応 Asterisk（アスタリスク）のご案内

---

<div class="post-metadata">

**Author:** ![TheMark](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/themark/32/4771_2.png) [@TheMark](https://community.asterisk.org/u/TheMark)\
**Post date:** [May 24, 2023, 4:12pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/14 "2023-05-24T16:12:00Z")

</div>

hmm that is some hefty patching off the sip dialog handeling  
either they have a realy broken platform or they have just desided that RFC is not somthing that they need to comply with

but I will guess that you can always try apply it directly to 18.18.0 and se if the patch fails

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 24, 2023, 4:14pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/15 "2023-05-24T16:14:58Z")

</div>

I can’t/won’t look at un-CLA code, but that sounds… bad.

---

<div class="post-metadata">

**Author:** ![TheMark](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/themark/32/4771_2.png) [@TheMark](https://community.asterisk.org/u/TheMark)\
**Post date:** [May 24, 2023, 4:30pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/16 "2023-05-24T16:30:41Z")

</div>

the code is released under gpl2 but translatet to japanese :-/  
and the patch is 978 lines, so quite large

but yes it’s un-CLA code, that jcolp are’t allowed to use

and I do not see that any of it would ever be accepted

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [May 24, 2023, 4:34pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/17 "2023-05-24T16:34:36Z")

</div>

So is it possible they… broke direct media?

---

<div class="post-metadata">

**Author:** ![TheMark](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/themark/32/4771_2.png) [@TheMark](https://community.asterisk.org/u/TheMark)\
**Post date:** [May 24, 2023, 4:42pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/18 "2023-05-24T16:42:24Z")

</div>

most likely  
most of it is adding support for where it is a normal sip or rakuten-sip  
and they change a lot of timing to use milliseconds so that is that

and they also changes respons codes and they are only to be send one time  
so any aditionals are being drop

---

<div class="post-metadata">

**Author:** ![mrsugitani](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/mrsugitani/32/6575_2.png) [@mrsugitani](https://community.asterisk.org/u/mrsugitani)\
**Post date:** [May 25, 2023, 1:08pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/19 "2023-05-25T13:08:10Z")

</div>

It’s working.  
I commented out external\_media\_address=20.78.xx.xxx on pjsip.conf.

there is 2 VMs on MS Azure.  
1st one is PBX and 2nd is patched Asterisk.  
VMs are in same subnet.  
patched Asterisk is connecting to Rakuten-trunk via Internet.

If commented out for media, SDP specify local address, but it seem it will ignore SDP in case of media\_direct = yes.  
RTP is communicating between PBX and Rakuten-trunk correctly.  
Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/asterisk/original/2X/4/475d0c889911cfb84ac4881ad6df8b523e3f9105.png) [@system](https://community.asterisk.org/u/system)\
**Post date:** [June 24, 2023, 1:08pm UTC](https://community.asterisk.org/t/if-i-use-direct-media-yes-sdp-not-update-on-2nd-invite/97031/20 "2023-06-24T13:08:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
