<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><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>&nbsp;&nbsp;&nbsp; if (method=="REGISTER") {<br>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; t_on_reply("2");<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; };<br><br>&nbsp;&nbsp;&nbsp; if (method=="INVITE") {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cache_fetch("local","variable_name_1",$avp(new_hdr));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp; };<br>}<br><br>onreply_route[2] {<br>&nbsp;&nbsp;&nbsp; if (t_check_status("200")) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cache_store("local","variable_name_1","$hdr(header_name)",7200);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; 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;nick.altmann@gmail.com&gt;<br>&gt; Subject: Re: [OpenSIPS-Users] Store values of the REGISTER and<br>&gt;         Retrieve them in the INVITE<br>&gt; To: OpenSIPS users mailling list &lt;users@lists.opensips.org&gt;<br>&gt; Message-ID:<br>&gt;         &lt;CAJOe1EMWtp_K=-FOm6qQFwBa2fRkZeMddGcGzukd=BU-mnGAHw@mail.gmail.com&gt;<br>&gt; Content-Type: text/plain; charset="utf-8"<br>&gt; <br>&gt; You cat getting null value only if "$hdr(header_name)" and "$avp(new_hdr)"<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;marwan_sadek@hotmail.com&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>&gt; &gt; ------------------------------<br>&gt; &gt; From: marwan_sadek@hotmail.com<br>&gt; &gt; To: users@lists.opensips.org<br>&gt; &gt; CC: marwan_sadek@hotmail.com<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's.<br>&gt; &gt;<br>&gt; &gt; I'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'm not able<br>&gt; &gt; to use it for other subsequent calls for the same user, I'm getting an null<br>&gt; &gt; value.<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; cache_store("local","variable_name_1","$hdr(header_name)",$ct.fields(expires));<br>&gt; &gt; cache_fetch("local","variable_name_1",$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; Users@lists.opensips.org<br>&gt; &gt; http://lists.opensips.org/cgi-bin/mailman/listinfo/users<br>&gt; &gt;<br>&gt; &gt;<br>&gt; -------------- next part --------------<br>&gt; An HTML attachment was scrubbed...<br>&gt; URL: &lt;http://lists.opensips.org/pipermail/users/attachments/20121002/87365553/attachment-0001.htm&gt;<br>&gt; <br><br></div>                                               </div></body>
</html>