[OpenSIPS-Users] Best way to retrieve a data from location database

Bogdan-Andrei Iancu bogdan at opensips.org
Thu Jun 19 16:09:34 CEST 2014


Better try the URI transformation:
   $(du{uri.host})
 to extract the ip part of the destination URI.

Regards,
Bogdan


Sent from Samsung Mobile

-------- Original message --------
From: Miguel Oyarzo <miguelaustro at gmail.com> 
Date:19/06/2014  15:17  (GMT+02:00) 
To: Bogdan-Andrei Iancu <bogdan at opensips.org> 
Subject: Re: [OpenSIPS-Users] Best way to retrieve a data from location database 

Hi Bodgan,

I found this variable: $ds

It has the value what I need. Then, a small string subtract like
avp_subst("$avp(msg)/$avp(IP)/g","/^.*@([0-9\.]*):.*$/\1/s");

And got the IP from the location table. All good, love Opensips.

Thanks!




On Thu, Jun 19, 2014 at 8:14 PM, Bogdan-Andrei Iancu <bogdan at opensips.org> wrote:
and what is the data you are looking for ?

look at the attr_avp param too :
    http://www.opensips.org/html/docs/modules/1.11.x/registrar.html#id293909

Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 19.06.2014 12:56, Miguel Oyarzo wrote:

Hi Bodgan,

Oh yes, but this function (lookup) doesn't seems to return the data what I'm looking for inside of this specific table.
At least, the documentation you mentioned doesn't show an example.

Is there any way to retrieve data from that table? I need specifically the contact info stored into location, for the specif user.

Thanks,




On Thu, Jun 19, 2014 at 7:52 PM, Bogdan-Andrei Iancu <bogdan at opensips.org> wrote:
Hi Miguel,

Have you looked at the lookup() function from the registrar module ?
    http://www.opensips.org/html/docs/modules/1.11.x/registrar.html#id294366

Regards,
 Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 19.06.2014 12:48, Miguel Oyarzo wrote:
Hi,

What is the best way to read a data from the location database?
I'm using postgreSQL.


E.g. Assuming there is a registered user:

if (is_method("INVITE")) {
    $var(x)=read_data_from_location(" select contact where user='71000' ");
    ...
    // do something with $var(x)                      
    ..
    ..
}

Thanks,

-- 
"Efficiency is doing things right; effectiveness is doing the right things                                               (Peter Drucker)"

Miguel                                              Oyarzo
DevOps & VoIP Engineer
Linux User: # 483188 - counter.li.org
http://au.linkedin.com/in/mikeaustralia 
Melbourne, Australia


_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users




-- 
"Efficiency is doing things right; effectiveness is doing the right things (Peter Drucker)"

Miguel Oyarzo
DevOps & VoIP Engineer
Linux User: # 483188 - counter.li.org
http://au.linkedin.com/in/mikeaustralia 
Melbourne, Australia          




-- 
"Efficiency is doing things right; effectiveness is doing the right things (Peter Drucker)"

Miguel Oyarzo
DevOps & VoIP Engineer
Linux User: # 483188 - counter.li.org
http://au.linkedin.com/in/mikeaustralia 
Melbourne, Australia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140619/82780201/attachment-0001.htm>


More information about the Users mailing list