<div dir="ltr">Now that I've corrected my silly xlog() lines I've got it partially working, transcoding is working (correct codecs passed in either direction).<div><br></div><div>However the connection & origin IP addresses are incorrect. I tried reversing the in-face & out-face flags but that made no difference.</div><div><br></div><div>Nearly there, any idea why I have the IP issue?</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 25 Mar 2020 at 11:06, Mark Farmer <<a href="mailto:farmorg@gmail.com">farmorg@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Bogdan, thanks for the reply.<div><br></div><div>That was what I ended up trying to do, hence the other question about deleting a line from a pvar but that's another thread.</div><div><br></div><div>However, I do have a related question.</div><div>Does the body modification also apply to a reply? The issue I have now is that when I try to apply modifications to the reply, they are not applied.</div><div><br></div><div>I set $avp(CallFlow) before sending the INVITE and check it in the reply route in order to apply the rtpengine() flags but the outgoing reply has the wrong media IP & codec,</div><div><br></div><div><div>onreply_route[DROUTING_RTPENGINE] {</div><div><br></div><div> ...</div><div><br></div><div> if ($rs=~"(2[0-9][0-9])|(183)" && has_body("application/sdp")) {</div><div> xlog("CUSTOM_LOG: Processing reply $fU Gateway Attribues: $var(gw_attrs)");</div><div> fix_nated_contact();</div><div> if (is_from_gw("2") && $avp(CallFlow)=="TPTY_PSTN") {</div><div> xlog("CUSTOM_LOG: Reply from PSTN to TPTY");</div><div> setflag(R_PSTN_TPTY);</div><div> } else if (is_from_gw("2") && $avp(CallFlow)=="PBX_PSTN") {</div><div> xlog("CUSTOM_LOG: Reply from PSTN to PBX");</div><div> setflag(R_PSTN_PBX);</div><div> } else if (is_from_gw("3") && $avp(CallFlow)=="PBX_TPTY") {</div><div> xlog("CUSTOM_LOG: Reply from TPTY to PBX");</div><div> setflag(R_TPTY_PBX);</div><div> } else if (is_from_gw("3") && $avp(CallFlow)=="PSTN_TPTY") {</div><div> xlog("CUSTOM_LOG: Reply from MSDR to PSTN");</div><div> setflag(R_TPTY_PSTN);</div><div> } else if (is_from_gw("1") && $avp(CallFlow)=="PSTN_PBX") {</div><div> xlog("CUSTOM_LOG: Reply from PBX to PSTN");</div><div> setflag(R_PBX_PSTN);</div><div> } else if (is_from_gw("1") && $avp(CallFlow)=="TPTY_PBX") {</div><div> xlog("CUSTOM_LOG: Reply from PBX to MSDR");</div><div> setflag(R_PBX_TPTY);</div><div> } else xlog("CUSTOM_LOG: No match in on_reply route!");</div><div> }</div><div><br></div><div> $var(R_PSTN_TPTY) = "RTP AVP ICE=remove in-face=external out-face=internal codec-mask-PCMA transcode-G722 replace-session-connection replace-origin";</div><div> $var(R_PSTN_PBX) = "RTP AVP ICE=remove in-face=external out-face=internal replace-session-connection replace-origin";</div><div> $var(R_TPTY_PBX) = "RTP AVP ICE=remove in-face=internal out-face=internal replace-session-connection replace-origin";</div><div> $var(R_TPTY_PSTN) = "RTP AVP ICE=remove in-face=internal out-face=external codec-mask-G722 transcode-PCMA replace-session-connection replace-origin";</div><div> $var(R_PBX_PSTN) = "RTP AVP ICE=remove in-face=internal out-face=external replace-session-connection replace-origin";</div><div> $var(R_PBX_TPTY) = "RTP AVP ICE=remove in-face=internal out-face=internal codec-mask-PCMA transcode-G722 replace-session-connection replace-origin";</div><div><br></div><div> if (isflagset(R_PSTN_TPTY)) {</div><div> xlog("CUSTOM_LOG: Setting up media on reply using variable $$R_PSTN_TPTY $R_PSTN_TPTY");</div><div> rtpengine_answer("$var(R_PSTN_TPTY)");</div><div> } else if (isflagset(R_PSTN_PBX)) {</div><div> xlog("CUSTOM_LOG: Setting up media on reply using variable $$R__PSTN_PBX $R_PSTN_PBX");</div><div> rtpengine_answer("$var(R_PSTN_PBX)");</div><div> } else if (isflagset(R_TPTY_PBX)) {</div><div> xlog("CUSTOM_LOG: Setting up media on reply using variable $$R_TPTY_PBX $R_TPTY_PBX");</div><div> rtpengine_answer("$var(R_TPTY_PBX)");</div><div> } else if (isflagset(R_TPTY_PSTN)) {</div><div> xlog("CUSTOM_LOG: Setting up media on reply using variable $$R_TPTY_PSTN $R_TPTY_PSTN");</div><div> rtpengine_answer("$var(R_TPTY_PSTN)");</div><div> } else if (isflagset(R_PBX_PSTN)){</div><div> xlog("CUSTOM_LOG: Setting up media on reply using variable $$R_PBX_PSTN $R_PBX_PSTN");</div><div> rtpengine_answer("$var(R_PBX_PSTN)");</div><div> } else if (isflagset(R_PBX_TPTY)) {</div><div> xlog("CUSTOM_LOG: Setting up media on reply using variable $$R_PBX_TPTY $R_PBX_TPTY");</div><div> rtpengine_answer("$var(R_PBX_TPTY)");</div><div> }</div><div>}</div></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 20 Mar 2020 at 11:04, Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<tt>Hi Mark,<br>
<br>
You mentioned calling rtpengine before? if so, note that you
cannot have more than one change over the same part of the body.
And rtpengine is replacing the whole body, so you cannot change a
prev change.<br>
What you have to do is to tell </tt><tt>rtpengine_offer() to
provide the new body into a variable (rather then changing the
msg), so you can change the value of the variable and push it into
the msg afterwards.<br>
<br>
PS: why do you do record_route_set() + record_route() in the same
time ???<br>
<br>
Regards,<br>
</tt>
<pre cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a>
OpenSIPS Summit, Amsterdam, May 2020
<a href="https://www.opensips.org/events/Summit-2020Amsterdam/" target="_blank">https://www.opensips.org/events/Summit-2020Amsterdam/</a>
</pre>
<div>On 3/19/20 1:21 PM, Mark Farmer wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Hi everyone<br clear="all">
<div><br>
</div>
<div>I am trying to remove a line from the SDP resulting
from rtpengine_offer() but it's not working for me.
Can anyone tell me what I am doing wrong please?</div>
<div><br>
</div>
<div>
<div>
<div>if (is_from_gw("2")) {</div>
<div> remove_hf("Contact","g");</div>
<div> insert_hf("Contact:
<a><sip:$fU@$var(fqdn):5061;did=$DLG_did></a>\r\n");</div>
<div> xlog("CUSTOM_LOG: Call to
Microsoft - Adjusting SIP Headers & SDP");</div>
<div>
set_advertised_address("$var(fqdn)");</div>
<div>
record_route_preset("my.fqdn:5061;transport=tls",
"XXX.XXX.XXX.XXX:5060");</div>
<div> add_rr_param(";r2=on");</div>
<div> record_route();</div>
<div> if
(replace_body("a=setup:actpass","")) {</div>
<div> xlog("CUSTOM_LOG:
Removed a=setup:actpass line from SDP");</div>
<div> }</div>
<div>}</div>
</div>
</div>
<div><br>
</div>
<div>I have also tried:</div>
<div><br>
</div>
<div><font face="arial, sans-serif"><span style="color:rgb(0,0,0)">if
(replace_body("a=setup:actpass\r",""))</span><br>
</font></div>
<div><font face="arial, sans-serif" color="#000000"><span>and</span></font></div>
<div><span style="color:rgb(0,0,0)"><font face="arial,
sans-serif">if
(replace_body("a=setup:actpass\r\n",""))</font></span><font size="3" face="-webkit-standard" color="#000000"><span><br>
</span></font></div>
<div><span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium"><br>
</span></div>
<div>Many thanks</div>
<div>Mark.</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr">Mark Farmer<br><a href="mailto:farmorg@gmail.com" target="_blank">farmorg@gmail.com</a></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Mark Farmer<br><a href="mailto:farmorg@gmail.com" target="_blank">farmorg@gmail.com</a></div>