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

Binan AL Halabi binanalhalabi at yahoo.com
Tue Oct 2 13:19:02 CEST 2012


Hi,

See  cachedb_redis instead.

cache_store and cache_fetch

//Binan




________________________________
 From: Marwan El-Sadek <marwan_sadek at hotmail.com>
To: users at lists.opensips.org 
Cc: Marwan El-Sadek <marwan_sadek at hotmail.com> 
Sent: Tuesday, October 2, 2012 12:59 PM
Subject: Re: [OpenSIPS-Users] Store values of the REGISTER and Retrieve them in the INVITE
 

 
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/d351c81f/attachment.htm>


More information about the Users mailing list