<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>In on_reply_route all pseudo-variables are evaluated by default in the context of the reply, but in failure_route they are evaluated by default in the context of the request. I think you are probably getting a different value for $si than you are expecting
in the failure_route case and there is no entry in the cache so it returns <null>. You can check this by printing your key values ("bran$ci$rd” and "bran$ci$si”)before each use to see if they are all the same. I think they will be different.</div>
<div><br>
</div>
<div>You can use the <reply> context, but I’m not sure if it will work for $si. See this: <a href="http://www.opensips.org/Documentation/Script-CoreVar-2-1">http://www.opensips.org/Documentation/Script-CoreVar-2-1</a></div>
<div>
<div id="MAC_OUTLOOK_SIGNATURE">
<div><br>
</div>
<div>Ben Newlin</div>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span><<a href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>> on behalf of Arsen <<a href="mailto:arsen.semionov@gmail.com">arsen.semionov@gmail.com</a>><br>
<span style="font-weight:bold">Reply-To: </span>OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>><br>
<span style="font-weight:bold">Date: </span>Tuesday, March 29, 2016 at 11:08 AM<br>
<span style="font-weight:bold">To: </span>OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>><br>
<span style="font-weight:bold">Subject: </span>[OpenSIPS-Users] cache_fetch on failure route issue<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">Hi guys,
<div><br>
</div>
<div>We have an issue with cache_fetch function. </div>
<div><br>
</div>
<div>In the per_branch_route I store destination numbers as following (we have multiple choice gateways here):</div>
<div><br>
</div>
<div>cache_store("local","bran$ci$rd","$rU",90);</div>
<div><br>
</div>
<div>In the on_reply_route in case of 200-OK I can successfully fetch the destination number:</div>
<div><br>
</div>
<div>cache_fetch("local","bran$ci$si", $avp(cached_dst));</div>
<div><br>
</div>
<div>But in case of the failed call the same function always return <null><br clear="all">
<div><br>
</div>
<div>failure_route[FAILURE_REDIR] {</div>
<div><br>
</div>
<div> if (!t_check_status("[1|2|3][0-9][0-9]")) {<br>
</div>
<div><br>
</div>
<div> cache_fetch("local","bran$ci$si", $avp(cached_dst));</div>
<div><br>
</div>
<div> }</div>
<div><br>
</div>
<div>}</div>
<div><br>
</div>
<div>Can we use cache_fetch in the on_failure route? </div>
<div><br>
</div>
<div>Please advice</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
-- <br>
<div class="gmail_signature">Regards,<br>
Arsen.<br>
</div>
</div>
</div>
</div>
</div>
</span>
</body>
</html>