[OpenSIPS-Users] Store values of the REGISTER and Retrieve them in the INVITE

Nick Altmann nick.altmann at gmail.com
Tue Oct 2 14:42:50 CEST 2012


Don't look into my 1-st answer, it's erroneous.

Try to change
if (t_check_status("200")) {
to
if ((is_method("REGISTER")) && (t_check_status("200"))) {

in onreply_route[2]. Maybe variable in your cache was rewritten by 200 OK
reply from another request? (depends on your configuration).

--
Nick

2012/10/2 Marwan El-Sadek <marwan_sadek at hotmail.com>

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


More information about the Users mailing list