<head><title></title></head>
<body><div class="iw_mail" dir="ltr">Hello,<div><br></div>
<div>I have an opensips server that I use for routing.  I receive a call and will attempt multiple carriers to complete the call.  My understanding is that in 2.2 I had to use branch_route to be able to make multiple attempts.  What I am running into now is that when I get a SIP response that indicates that I don't want to try another carrier, or I have tried as many as I want to try, then I want to send a SIP response (ether the response from the last carrier or a response of my own) and end the call.  When I t_reply I get the following error </div>
<div>            "CRITICAL:tm:w_t_reply: unsupported route_type (8)".</div>
<div><br></div>
<div>In a nutshell, the flow is</div>
<div><br></div>
<div>1)  Call flow leads to RELAY_TO_EGRESS to make the first call.</div>
<div>2)  RELAY_TO_EGRESS sets up the call information by calling OUTBOUND_SETUP (which will attempt to terminate the call if there are errors or no more carriers) and then creates a branch to handle the attempt (BRANCH_TO_EGRESS)</div>
<div>3)  BRANCH_TO_EGRESS does some final setup (setting up headers, etc) and sets the t_on_failure to "egress_failed"</div>
<div>4)  If the call attempt fails, "egress_failed" is called which may want to terminate the call (send_reply...) or attempt again by calling TRY_CARRIER_FAILOVER</div>
<div>5) TRY_CARRIER_FAILOVER will start the process again by calling RELAY_TO_EGRESS (which usually ends in the call to OUTBOUND_SETUP because that is where it determines when no more attempts are going to be made).</div>
<div><br></div>
<div>In 1.11 without branching this worked fine.</div>
<div><br></div>
<div>
<div>What is the correct way to architect the code.  Here is the general structure I have now.</div>
<div><br></div>
</div>
<div>...</div>
<div><br></div>
<div>
<div>route[RELAY_TO_EGRESS] {</div>
<div>    route(OUTBOUND_SETUP);</div>
<div>    t_on_branch("BRANCH_TO_EGRESS");</div>
<div><br></div>
<div>    if (!t_relay("0x01")) {</div>
<div>        send_reply("500","Internal Error");</div>
<div>        exit;</div>
<div>    }</div>
<div>}</div>
<div><br></div>
<div>
<div>route[OUTBOUND_SETUP] {</div>
<div>...</div>
<div>                if ($avp(current_carrier_idx) == $avp(out_routes_no)) {</div>
<div>                    route(NO_ROUTES_AVAILABLE, "No more routes available.");</div>
<div>                }</div>
<div>...</div>
</div>
<div>    if (!route(VALIDATE_CARRIER)) {</div>
<div>        route(TRY_CARRIER_FAILOVER, "503", "In supplemental exclusion.");</div>
<div>        return(1);</div>
<div>    }</div>
<div>}</div>
<div><br></div>
<div><div>branch_route[BRANCH_TO_EGRESS] {</div></div>
<div>...</div>
<div>    t_on_failure("egress_failed");</div>
<div>...</div>
<div>}</div>
<div><br></div>
<div>route[NO_ROUTES_AVAILABLE] {</div>
<div>    xlog("L_WARN", "$rU SCRIPT:EGRESS:WARN: No carriers to route to.  Ending the call \n");</div>
<div>    $avp(error_reason) := $avp(error_reason) + $param(1);</div>
<div>    t_reply("503","Service not available.");</div>
<div>    exit;</div>
<div>}</div>
<div><br></div>
<div>
<div>failure_route[egress_failed] {</div>
<div>...</div>
<div>    if (t_was_cancelled()) {</div>
<div>        route(ADD_STATUS_ERROR_REASON_TO_HISTORY, $(<reply>rs), $(<reply>rr));</div>
<div>        xlog("L_WARN", "$rU SCRIPT:RADVANCE:WARN: Do not route advance replying with $(<reply>rs) - $(<reply>rr) \n");</div>
<div>        $avp(error_reason) := $avp(error_reason) + "Call Terminated with " + $(<reply>rs) + ".";</div>
<div>        t_reply("487","Request cancelled");</div>
<div>        exit;</div>
<div>    }</div>
<div><br></div>
<div>    if ($(<reply>rs) != null) {</div>
<div>        route(TRY_CARRIER_FAILOVER, $(<reply>rs), $(<reply>rr));</div>
<div>    } else {</div>
<div>        $avp(error_reason) := $avp(error_reason) + "Server Error V2 - empty response (rs).";</div>
<div>        route(TRY_CARRIER_FAILOVER, "503", "Server Error");</div>
<div>    }</div>
<div><br></div>
<div>    exit;</div>
<div>}</div>
</div>
<div><br></div>
<div><div>route[TRY_CARRIER_FAILOVER] {</div></div>
<div>....</div>
<div>
<div>   route(RELAY_TO_EGRESS);</div>
<div>}</div>
</div>
<div>}</div>
<div><br></div>
<div>Thanks,</div>
<div>Pat Burke</div>
<div class="signature"><div style="font-family: arial, helvetica, sans-serif; font-size: 16px;">
<br><div><br></div>
</div></div>
</div>
</div></body>