<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>I get what you say. I can map my custom logic into request route
      blocks, as long as there is no function which requires execution
      from a specific (non-request) route type. Therefore I have to make
      sure that every function which requires to be executed in a
      specific (non-request) route is still being called in the
      respective section.</p>
    <p>For example if I want to shorten my MAIN onreply_route by moving
      a part of it to another block and referencing it from the main
      block, I have to make sure that reply specific functions do not
      migrate from the onreply route.</p>
    <p>This could be done by adjust the logic so it only checks the
      conditions for a operation using non route specific functions,
      move that code to a new route block, refer to that route block
      from the onreply route, wait for the new route block to finish and
      return to the onreply route block and then calling the route
      specific functions when a certain flag was set inside the
      aforementioned new route block.</p>
    <p>incoming reply</p>
    <p>-> onreply_route[MAIN] </p>
    <p>-> route[CUST_FUNCT] </p>
    <p>    - if t_check_status("180") && hdr(xyz) then
      avp(180xyz) = 1; </p>
    <p>-> back to onreply_route[MAIN] </p>
    <p>    - if avp(180xyz) then change_reply_status(181, "test");</p>
    <p><br>
    </p>
    <p>My initial idea was to shorten my onreply_route to make it more
      easily understandable by my colleagues. Although I like this
      reinterpretation of the route block - how it’s used and how it can
      be used - I think its hard to explain why some reply operations
      are done in a request route and some not. Therefore I for now just
      keep my block as long as it is, but keep the possibilities in
      mind.</p>
    <p><br>
    </p>
    <p>Thank you all for your suggestions!</p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 10/04/2026 16:12, Ben Newlin via
      Users wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:PH7PR10MB7850087220F2174F14061C0A95592@PH7PR10MB7850.namprd10.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div
style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        The solution proposed by Richard works and it is working in your
        case, in the sense that the called route is being executed.</div>
      <div
style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div
style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        However, this method does not remove any conditions of specific
        functions on which routes they can be called from, and the
        called route is not a reply route it is a basic route. So the
        error is valid.</div>
      <div
style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div
style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        This mechanism can be used generally to break up processing in
        large routes, but any functions which require execution from a
        specific route type cannot be moved to the nested route. What
        you need is something like this:</div>
      <div
style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div
style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div
style="direction: ltr; font-family: monospace; font-size: 12pt; color: rgb(0, 0, 0);">
        <span style="background-color: rgb(255, 255, 255);"> 
          route[reply_processing_1] {</span></div>
      <div
style="direction: ltr; font-family: monospace; font-size: 12pt; color: rgb(0, 0, 0);">
        <span style="background-color: rgb(255, 255, 255);">    # do
          general reply processing step 1</span></div>
      <div
style="direction: ltr; font-family: monospace; font-size: 12pt; color: rgb(0, 0, 0);">
        <span style="background-color: rgb(255, 255, 255);">  }</span></div>
      <div
style="direction: ltr; font-family: monospace; font-size: 12pt; color: rgb(0, 0, 0);">
        <span style="background-color: rgb(255, 255, 255);"><br>
        </span></div>
      <div style="direction: ltr; font-family: monospace;"><span
style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"> 
          r</span>oute[reply_processing_2] {</div>
      <div
style="direction: ltr; font-family: monospace; color: rgb(0, 0, 0);">   
        # do general reply processing step 2</div>
      <div
style="direction: ltr; font-family: monospace; color: rgb(0, 0, 0);">  }</div>
      <div
style="direction: ltr; font-family: monospace; color: rgb(0, 0, 0);"><br>
      </div>
      <div
style="direction: ltr; font-family: monospace; font-size: 12pt; color: rgb(0, 0, 0);">
        <span style="background-color: rgb(255, 255, 255);"> 
          onreply_route[MAIN] {</span></div>
      <div style="direction: ltr; font-family: monospace;"><span
style="font-size: 16px; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"> 
            r</span><span style="background-color: rgb(255, 255, 255);">oute(</span><span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">reply_processing_1</span><span
style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">);</span></div>
      <div style="direction: ltr; font-family: monospace;"><span
          style="background-color: rgb(255, 255, 255);">    </span></div>
      <div style="direction: ltr; font-family: monospace;"><span
          style="background-color: rgb(255, 255, 255);">    # Perform
          reply_route specific processing here</span></div>
      <div style="direction: ltr; font-family: monospace;"><span
          style="background-color: rgb(255, 255, 255);">   
        </span><span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">change_reply_status(181,
          "test</span><span
          style="background-color: rgb(255, 255, 255);">”</span><span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">);</span></div>
      <div style="direction: ltr; font-family: monospace;"><span
          style="background-color: rgb(255, 255, 255);"><br>
        </span><span
style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"> 
            route(reply_processing_2);</span></div>
      <div
style="direction: ltr; font-family: monospace; font-size: 12pt; color: rgb(0, 0, 0);">
        <span style="background-color: rgb(255, 255, 255);">  }</span></div>
      <div
style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
        <br>
      </div>
      <div id="ms-outlook-mobile-signature"
        style="color: inherit; background-color: inherit;">
        <p class="MsoNormal"
style="margin: 0in; font-family: Aptos, sans-serif; font-size: 11pt;">
          <span style="color: black;">Ben Newlin</span></p>
        <p class="MsoNormal"
style="margin: 0in; font-family: Aptos, sans-serif; font-size: 11pt;">
          <span style="color: black;"><br>
          </span></p>
      </div>
      <div id="mail-editor-reference-message-container"
        style="color: inherit; background-color: inherit;">
        <div class="ms-outlook-mobile-reference-message skipProofing"
          style="direction: ltr;">
        </div>
        <div class="ms-outlook-mobile-reference-message skipProofing"
style="text-align: left; padding: 3pt 0in 0in; border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; font-family: Aptos; font-size: 12pt; color: black;">
          <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 Malte <a class="moz-txt-link-rfc2396E" href="mailto:spce@lard.at"><spce@lard.at></a><br>
          <b>Date: </b>Friday, April 10, 2026 at 5:33 AM<br>
          <b>To: </b><a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>
          <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a><br>
          <b>Subject: </b>Re: [OpenSIPS-Users] Nested reply_routes</div>
        <div
style="background-color: rgb(255, 255, 255); height: auto; display: block;">
          <div class="mc-ip-hide"
style="direction: ltr; text-align: left; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
            <br>
          </div>
          <hr style="direction: ltr; text-align: left;">
        </div>
        <p class="ms-outlook-mobile-reference-message skipProofing">Hi,</p>
        <p class="ms-outlook-mobile-reference-message skipProofing">this
          approach unfortunately doesn't work. Does somebody else know
          of a solution to neaten up big reply routes?</p>
        <p class="ms-outlook-mobile-reference-message skipProofing">My
          code and the following error:</p>
        <div class="ms-outlook-mobile-reference-message skipProofing"
          style="margin: 0em 40px; font-family: monospace;">
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  367 
            route[test] {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  368         
            xlog("now in test route");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  369         
            change_reply_status(181, "test");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  370 
            }</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  371</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);"> 
            372  onreply_route[MAIN] {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  373  
                   # For fr_inv_timeout handling</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  374     
                if (t_check_status("180")) {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  375        
                     $var(180_in_trans)=1;</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  376           
                  route(test);</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  377             
                xlog("back to reply route");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  378         
            }</span><br>
          <br>
        </div>
        <div class="ms-outlook-mobile-reference-message skipProofing"
style="margin: 0em 40px; font-family: monospace; color: rgb(255, 84, 84);">
          <span style="background-color: rgb(255, 255, 255);"><b>CRITICAL:core:yyerror:
              parse error in /etc/opensips/opensips.cfg:369:29-30:
              Command <change_reply_status> cannot be used in the
              block</b></span></div>
        <p class="ms-outlook-mobile-reference-message skipProofing">Doing
          it in a reply route:</p>
        <div class="ms-outlook-mobile-reference-message skipProofing"
          style="margin: 0em 40px; font-family: monospace;">
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  367 
            onreply_route[test] {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  368         
            xlog("now in test route");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  369         
            change_reply_status(181, "test");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  370 
            }</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  371</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  372 
            onreply_route[MAIN] {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  373         
            # For fr_inv_timeout handling</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  374         
            if (t_check_status("180")) {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  375                 
            $var(180_in_trans)=1;</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  376                 
            t_on_reply("test");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  377                 
            xlog("back to MAIN reply route");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  378         
            }</span><br>
          <br>
        </div>
        <div class="ms-outlook-mobile-reference-message skipProofing"
style="margin: 0em 40px; font-family: monospace; color: rgb(255, 84, 84);">
          <span style="background-color: rgb(255, 255, 255);"><b>ERROR:sipmsgops:change_reply_status_f:
              the class of provisional or positive final replies cannot
              be changed</b></span></div>
        <div class="ms-outlook-mobile-reference-message skipProofing"
          style="direction: ltr;">
          <br>
        </div>
        <p class="ms-outlook-mobile-reference-message skipProofing">Jump
          to secondary reply route via proxy route:</p>
        <div class="ms-outlook-mobile-reference-message skipProofing"
          style="margin: 0em 40px; font-family: monospace;">
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  367 
            route[test] {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  368         
            xlog("now in test route");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  369         
            t_on_reply("test");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  370 
            }</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  371</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  372 
            onreply_route[test] {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  373         
            xlog("now in test reply route");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  374         
            change_reply_status(181, "test");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  375 
            }</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  376</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  377 
            onreply_route[MAIN] {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  378         
            # For fr_inv_timeout handling</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  379         
            if (t_check_status("180")) {</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  380                 
            $var(180_in_trans)=1;</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  381                 
            route(test);</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  382                 
            xlog("back to MAIN reply route");</span><br>
          <span
style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">  383         
            }</span><br>
          <br>
        </div>
        <div class="ms-outlook-mobile-reference-message skipProofing"
style="margin: 0em 40px; font-family: monospace; color: rgb(255, 84, 84);">
          <span style="background-color: rgb(255, 255, 255);"><b>ERROR:sipmsgops:change_reply_status_f:
              the class of provisional or positive final replies cannot
              be changed</b></span></div>
        <p class="ms-outlook-mobile-reference-message skipProofing">I
          must note that change_reply_status works flawlessly when
          executing directly in MAIN reply route.</p>
        <p class="ms-outlook-mobile-reference-message skipProofing"><br>
        </p>
        <p class="ms-outlook-mobile-reference-message skipProofing">Thanks,</p>
        <p class="ms-outlook-mobile-reference-message skipProofing">Malte<span
            style="font-family: monospace;">
          </span></p>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre wrap="" class="moz-quote-pre">_______________________________________________
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>