<div>Don&#39;t look into my 1-st answer, it&#39;s erroneous.</div><div><br></div>Try to change<div>if (t_check_status(&quot;200&quot;)) {</div><div>to</div><div>if ((is_method(&quot;REGISTER&quot;)) &amp;&amp; (t_check_status(&quot;200&quot;))) {<br>
</div><div><br></div><div>in onreply_route[2]. Maybe variable in your cache was rewritten by 200 OK reply from another request? (depends on your configuration).</div><div><br></div><div>--<br>Nick<br><br><div class="gmail_quote">
2012/10/2 Marwan El-Sadek <span dir="ltr">&lt;<a href="mailto:marwan_sadek@hotmail.com" target="_blank">marwan_sadek@hotmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div><div dir="ltr">
Hi Nick,<br><br>Thanks for the replying.<br><br>It&#39;s working for the first INVITE but it&#39;s giving the null value for any subsequent requests! I will post part of the script:<br><br>The scenario is the following:<br>
1 - User A register and I store the value of the header from the 200OK response of the REGISTER.<br>2 - User A make a call, I retrieve the previously stored value from the cache and append it to the INVITE.<br>3 - Until now the call is successfully established.<br>
4 - User A attempt a second call (after hanging the first) and before the cache expiration time, it sends an INVITE, but I get a null value.<br><br>To overcome this problem, I need, for each call, to re-register the user!<br>
<br>What I&#39;m trying to do is whenever a user register, only one time, I want to retrieve the header value from the 200Ok, store it somewhere, and then retrieve for each new request.<br><br>route{<br><br>    if (method==&quot;REGISTER&quot;) {<br>
         t_on_reply(&quot;2&quot;);<br>        return;<br>    };<br><br>    if (method==&quot;INVITE&quot;) {<div class="im"><br>        cache_fetch(&quot;local&quot;,&quot;variable_name_1&quot;,$avp(new_hdr));<br></div>        return;<br>
    };<br>}<br><br>onreply_route[2] {<br>    if (t_check_status(&quot;200&quot;)) {<br>        cache_store(&quot;local&quot;,&quot;variable_name_1&quot;,&quot;$hdr(header_name)&quot;,7200);<br>    }<br>    exit;<br>}<br><br>
Thank you in advance.<br><br>Regards,<br>Marwan<br><br>&gt; Message: 2<br><div>&gt; Date: Tue, 2 Oct 2012 14:34:02 +0400<br>&gt; From: Nick Altmann &lt;<a href="mailto:nick.altmann@gmail.com" target="_blank">nick.altmann@gmail.com</a>&gt;<br>
&gt; Subject: Re: [OpenSIPS-Users] Store values of the REGISTER and<div class="im"><br>&gt;         Retrieve them in the INVITE<br></div>&gt; To: OpenSIPS users mailling list &lt;<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>&gt;<br>
&gt; Message-ID:<br>&gt;         &lt;CAJOe1EMWtp_K=-FOm6qQFwBa2fRkZeMddGcGzukd=<a href="mailto:BU-mnGAHw@mail.gmail.com" target="_blank">BU-mnGAHw@mail.gmail.com</a>&gt;<br>&gt; Content-Type: text/plain; charset=&quot;utf-8&quot;<div class="im">
<br>&gt; <br>&gt; You cat getting null value only if &quot;$hdr(header_name)&quot; and &quot;$avp(new_hdr)&quot;<br>&gt; are not the same. Check it.<br>&gt; <br>&gt; --<br>&gt; Nick<br>&gt; <br>&gt; <br>&gt; 2012/10/2 Marwan El-Sadek &lt;<a href="mailto:marwan_sadek@hotmail.com" target="_blank">marwan_sadek@hotmail.com</a>&gt;<br>
&gt; <br>&gt; &gt;<br>&gt; &gt; Hello,<br>&gt; &gt;<br>&gt; &gt; Can anyone please help me with this point?<br>&gt; &gt;<br>&gt; &gt; Regards,<br>&gt; &gt; Marwan<br>&gt; &gt;<br>&gt; &gt;<br></div>&gt; &gt; ------------------------------<div class="im">
<br>&gt; &gt; From: <a href="mailto:marwan_sadek@hotmail.com" target="_blank">marwan_sadek@hotmail.com</a><br>&gt; &gt; To: <a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a><br>&gt; &gt; CC: <a href="mailto:marwan_sadek@hotmail.com" target="_blank">marwan_sadek@hotmail.com</a><br>
&gt; &gt; Subject: Store values of the REGISTER and Retrieve them in the INVITE<br>&gt; &gt; Date: Fri, 28 Sep 2012 12:08:33 +0300<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;  Hello,<br>&gt; &gt;<br>&gt; &gt; I am trying, once I receive the first REGISTER, to store a specific header<br>
&gt; &gt; and then retrieve its value in the subsequent requests, like the following<br>&gt; &gt; INVITE&#39;s.<br>&gt; &gt;<br>&gt; &gt; I&#39;m currently using the cache memory, but for some reason its not working<br>&gt; &gt; properly, the value cannot be used after only one INVITE and I&#39;m not able<br>
&gt; &gt; to use it for other subsequent calls for the same user, I&#39;m getting an null<br>&gt; &gt; value.<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; cache_store(&quot;local&quot;,&quot;variable_name_1&quot;,&quot;$hdr(header_name)&quot;,$ct.fields(expires));<br>
&gt; &gt; cache_fetch(&quot;local&quot;,&quot;variable_name_1&quot;,$avp(new_hdr));<br>&gt; &gt;<br>&gt; &gt; Is there a better way to do this? Thank you in advance.<br>&gt; &gt;<br>&gt; &gt; Thanks,<br>&gt; &gt; Marwan<br>
&gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; Users mailing list<br>&gt; &gt; <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>&gt; &gt; <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
&gt; &gt;<br>&gt; &gt;<br></div>&gt; -------------- next part --------------<br>&gt; An HTML attachment was scrubbed...<br>&gt; URL: &lt;<a href="http://lists.opensips.org/pipermail/users/attachments/20121002/87365553/attachment-0001.htm" target="_blank">http://lists.opensips.org/pipermail/users/attachments/20121002/87365553/attachment-0001.htm</a>&gt;<br>
&gt; <br><br></div>                                               </div></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>