<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi, William!</p>
    <p><br>
    </p>
    <p>Make sure you call rtpengine_manage() in branch route, not in the
      request route, otherwise all the changes will be inherited
      throughout all the branches further created.</p>
    <p><br>
    </p>
    <p>Best regards,</p>
    <p>Răzvan</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 6/9/20 7:04 AM, William Jin wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:SG2PR06MB2409E6637F569783051D3B6C9B820@SG2PR06MB2409.apcprd06.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);">
        <span>Below is a short config example.</span></div>
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);">
        <span><br>
        </span></div>
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);">
        <span>route {<br>
        </span>
        <div>...<br>
        </div>
        <div>setflag(CallFWD);<br>
        </div>
        <div>rtpengine_manage();  #say the first call attempt need
          rtpengine<br>
        </div>
        <div>t_on_failure("handle_failure");<br>
        </div>
        <div>r_relay();<br>
        </div>
        <div>...<br>
        </div>
        <div>}<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>failure_route[handle_failure] {<br>
        </div>
        <div>...<br>
        </div>
        <div>if (isflagset(CallFWD)){route(handle_callfwd);}<br>
        </div>
        <div>...<br>
        </div>
        <div>}<br>
        </div>
        <div><br>
        </div>
        <div>route[handle_callfwd]{<br>
        </div>
        <div>...<br>
        </div>
        <div>xlog("L_INFO","RB=$rb(application/sdp)");<br>
        </div>
        <div>if (t_relay()){<br>
        </div>
        <div>xlog("L_INFO","Stateful relay done.
          RB=$rb(application/sdp)");<br>
        </div>
        <div>}<br>
        </div>
        <div>...<br>
        </div>
        <span>}</span><br>
      </div>
      <div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <br>
        </div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          Looks like the t_relay in the handle_callfwd will inherit the
          SDP info that rtpengine_manage entered in the first attempt.</div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <br>
        </div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          Also, another interesting fact is that the SDP info is added
          while the t_relay is called. Looks like the t_relay is using
          its data in memory and re-write the SDP. the  <span
            style="font-family: Calibri, Arial, Helvetica, sans-serif;
            background-color: rgb(255, 255, 255); display: inline
            !important">$rb(application/sdp) is not changed until the
            t_relay is called.</span></div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <br>
        </div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <div style="margin: 0px; font-size: 12pt; font-family:
            Calibri, Arial, Helvetica, sans-serif; background-color:
            rgb(255, 255, 255)">
            How can I, for example, remove the rtpengine related SDP for
            the second INVITE generated by the failure_route? </div>
          <div style="margin: 0px; font-size: 12pt; font-family:
            Calibri, Arial, Helvetica, sans-serif; background-color:
            rgb(255, 255, 255)">
            I tried rtpengine_delete() in handle_callfwd or
            rtpengine_manage() in the failure_route which suppose to do
            rtpengine_delete also, but they don't work as expected.</div>
          <br>
        </div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          Thanks in advance.</div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <br>
        </div>
        <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
          font-size: 12pt; color: rgb(0, 0, 0);">
          <br>
        </div>
        <div id="Signature">
          <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:12pt; color:rgb(0,0,0)">
            --</div>
          <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:12pt; color:rgb(0,0,0)">
            Regards,</div>
          <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:12pt; color:rgb(0,0,0)">
            William Jin<br>
          </div>
        </div>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
          face="Calibri, sans-serif" color="#000000"><b>From:</b> Users
          <a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org"><users-bounces@lists.opensips.org></a> on behalf of William
          Jin <a class="moz-txt-link-rfc2396E" href="mailto:williamj@exetel.com.au"><williamj@exetel.com.au></a><br>
          <b>Sent:</b> Tuesday, 9 June 2020 9:09 AM<br>
          <b>To:</b> OpenSIPS users mailling list
          <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a><br>
          <b>Subject:</b> [OpenSIPS-Users] question about
          rtpengine_manage() in failure_route</font>
        <div> </div>
      </div>
      <style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
      <div dir="ltr">
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          Hi All</div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          <br>
        </div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          May I know how can I rewrite the SDP (rtpengine) in the
          failure route?</div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          <br>
        </div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          The scenario is we use rtpengine_manage() in the first call
          attempt, if it fails, it uses failure_route, however, we want
          to change the SDP info.</div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          <br>
        </div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          For example, the call's first attempt is to an ipv6 UAC, when
          failed, we try ipv4 UAC. We need to change the rtpengine
          address-family to IP4 so the c= line can follow with an IPv4
          address.</div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          <br>
        </div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          We tried to use rtpengine_manage("address-family=IP4"), but
          looks like the SDP still not changed.</div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          <br>
        </div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          Does anyone have any idea about this? Or is there any other
          way to achieve this?</div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          <br>
        </div>
        <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
          font-size:12pt; color:rgb(0,0,0)">
          <br>
        </div>
        <div>
          <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:12pt; color:rgb(0,0,0)">
            <br>
          </div>
          <div id="x_Signature">
            <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
              font-size:12pt; color:rgb(0,0,0)">
              --</div>
            <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
              font-size:12pt; color:rgb(0,0,0)">
              Regards,</div>
            <div style="font-family:Calibri,Arial,Helvetica,sans-serif;
              font-size:12pt; color:rgb(0,0,0)">
              William Jin<br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
  </body>
</html>