<div dir="ltr"><div dir="ltr"><div dir="ltr">Hi list,<div>I am trying to use media_exchange_from_uri to play hold music. I use the sample code from opensips blog:</div><div><br></div><div><pre class="gmail-wp-block-code"><code>if (has_totag() && is_method("INVITE")) {
# catch the on-hold re-invite
if(is_audio_on_hold()) {
if (media_exchange_from_uri("sip:moh@media.server.ip"))
exit;
} else {
# call has resumed - terminate any ongoing media played
media_terminate();
}
}</code></pre><pre class="gmail-wp-block-code"><code><br></code></pre><pre class="gmail-wp-block-code">But the behaviour is strange. </pre><pre class="gmail-wp-block-code">A invite comes to proxy B, rtpproxy is engaged and invite is sent to C</pre><pre class="gmail-wp-block-code">A,Aport <=> B,Bport1 - B,Bport2 <=> C,Cport</pre><pre class="gmail-wp-block-code">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).</pre><pre class="gmail-wp-block-code">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).</pre><pre class="gmail-wp-block-code">While C expects to receive RTP from D directly, D has exchanged SDP with B and therefore sends RTP to B!</pre><pre class="gmail-wp-block-code">Why is this happening?</pre><pre class="gmail-wp-block-code"><br></pre><pre class="gmail-wp-block-code">Thank you :)</pre></div></div></div></div>