[OpenSIPS-Users] media_exchange_from_uri

M S medeanwz at gmail.com
Sun Sep 7 17:03:53 UTC 2025


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/a3ae7d6a/attachment.html>


More information about the Users mailing list