<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<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 <users-bounces@lists.opensips.org> on behalf of Malte <spce@lard.at><br>
<b>Date: </b>Friday, April 10, 2026 at 5:33 AM<br>
<b>To: </b>users@lists.opensips.org <users@lists.opensips.org><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>
</body>
</html>