<div>Don't look into my 1-st answer, it's erroneous.</div><div><br></div>Try to change<div>if (t_check_status("200")) {</div><div>to</div><div>if ((is_method("REGISTER")) && (t_check_status("200"))) {<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"><<a href="mailto:marwan_sadek@hotmail.com" target="_blank">marwan_sadek@hotmail.com</a>></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's working for the first INVITE but it'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'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=="REGISTER") {<br>
t_on_reply("2");<br> return;<br> };<br><br> if (method=="INVITE") {<div class="im"><br> cache_fetch("local","variable_name_1",$avp(new_hdr));<br></div> return;<br>
};<br>}<br><br>onreply_route[2] {<br> if (t_check_status("200")) {<br> cache_store("local","variable_name_1","$hdr(header_name)",7200);<br> }<br> exit;<br>}<br><br>
Thank you in advance.<br><br>Regards,<br>Marwan<br><br>> Message: 2<br><div>> Date: Tue, 2 Oct 2012 14:34:02 +0400<br>> From: Nick Altmann <<a href="mailto:nick.altmann@gmail.com" target="_blank">nick.altmann@gmail.com</a>><br>
> Subject: Re: [OpenSIPS-Users] Store values of the REGISTER and<div class="im"><br>>         Retrieve them in the INVITE<br></div>> To: OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>><br>
> Message-ID:<br>>         <CAJOe1EMWtp_K=-FOm6qQFwBa2fRkZeMddGcGzukd=<a href="mailto:BU-mnGAHw@mail.gmail.com" target="_blank">BU-mnGAHw@mail.gmail.com</a>><br>> Content-Type: text/plain; charset="utf-8"<div class="im">
<br>> <br>> You cat getting null value only if "$hdr(header_name)" and "$avp(new_hdr)"<br>> are not the same. Check it.<br>> <br>> --<br>> Nick<br>> <br>> <br>> 2012/10/2 Marwan El-Sadek <<a href="mailto:marwan_sadek@hotmail.com" target="_blank">marwan_sadek@hotmail.com</a>><br>
> <br>> ><br>> > Hello,<br>> ><br>> > Can anyone please help me with this point?<br>> ><br>> > Regards,<br>> > Marwan<br>> ><br>> ><br></div>> > ------------------------------<div class="im">
<br>> > From: <a href="mailto:marwan_sadek@hotmail.com" target="_blank">marwan_sadek@hotmail.com</a><br>> > To: <a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a><br>> > CC: <a href="mailto:marwan_sadek@hotmail.com" target="_blank">marwan_sadek@hotmail.com</a><br>
> > Subject: Store values of the REGISTER and Retrieve them in the INVITE<br>> > Date: Fri, 28 Sep 2012 12:08:33 +0300<br>> ><br>> ><br>> > Hello,<br>> ><br>> > I am trying, once I receive the first REGISTER, to store a specific header<br>
> > and then retrieve its value in the subsequent requests, like the following<br>> > INVITE's.<br>> ><br>> > I'm currently using the cache memory, but for some reason its not working<br>> > properly, the value cannot be used after only one INVITE and I'm not able<br>
> > to use it for other subsequent calls for the same user, I'm getting an null<br>> > value.<br>> ><br>> ><br>> > cache_store("local","variable_name_1","$hdr(header_name)",$ct.fields(expires));<br>
> > cache_fetch("local","variable_name_1",$avp(new_hdr));<br>> ><br>> > Is there a better way to do this? Thank you in advance.<br>> ><br>> > Thanks,<br>> > Marwan<br>
> ><br>> > _______________________________________________<br>> > Users mailing list<br>> > <a href="mailto:Users@lists.opensips.org" target="_blank">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>> ><br></div>> -------------- next part --------------<br>> An HTML attachment was scrubbed...<br>> URL: <<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>><br>
> <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>