[OpenSIPS-Users] media_exchange_from_uri

M S medeanwz at gmail.com
Sun Sep 7 18:34:42 UTC 2025


A(caller) <=> B(opensips) <=> C(callee)
                      B(opensips) <=> D(media server)

I tried it with the "callee" leg in media_exchange_from_uri too.
technically, the B machine in the middle should send the ip/port of A and D
to each other in SDPs to make sure media is direct between A and D - but B
to D invite always has the B's ip/port in it. It should be due to something
in my script, but what could it be?

On Sun, Sep 7, 2025 at 7:03 PM M S <medeanwz at gmail.com> wrote:

> Hi list,
> I am trying to use media_exchange_from_uri to play hold music. I use the
> sample code from opensips blog:
>
> if (has_totag() && is_method("INVITE")) {
>     # catch the on-hold re-invite
>     if(is_audio_on_hold()) {
>         if (media_exchange_from_uri("sip:moh at media.server.ip"))
>             exit;
>     } else {
>         # call has resumed - terminate any ongoing media played
>         media_terminate();
>     }
> }
>
>
> But the behaviour is strange.
>
> A invite comes to proxy B, rtpproxy is engaged and invite is sent to C
>
> A,Aport <=> B,Bport1 - B,Bport2 <=> C,Cport
>
> A pressing hold: Invite with a=sendonly is received. With the above configuration, B sends an INVITE (B ip and Bport1) to media.server.ip (D).
>
> Media server D responds with 200 OK (D ip and Dport). Opensips B2B sends D,Dport SDP to C (so C expects to receive RTP from D port).
>
> While C expects to receive RTP from D directly, D has exchanged SDP with B and therefore sends RTP to B!
>
> Why is this happening?
>
>
> Thank you :)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20250907/c7e85e21/attachment.html>


More information about the Users mailing list