[SR-Users] using avpops for querying an external db on kamailio 3.0.2

Daniel-Constantin Mierla miconda at gmail.com
Tue Jun 29 18:43:49 CEST 2010


Hello,

On 6/29/10 6:39 PM, yaron nahcum wrote:
> Hi Daniel,
> Thanks a lot for the quick response. I will look at it.

fyi: keep cc-ing the mailing list for any discussion that started there 
- message sent privately are usually ignored.

Daniel

> Yaron.
>
> ------------------------------------------------------------------------
> *From:* Daniel-Constantin Mierla <miconda at gmail.com>
> *To:* yaron nahcum <yaron_nachum at yahoo.com>
> *Cc:* sr-users at lists.sip-router.org
> *Sent:* Tue, June 29, 2010 6:57:53 PM
> *Subject:* Re: [SR-Users] using avpops for querying an external db on 
> kamailio 3.0.2
>
> Hello,
>
> look at sqlops module, it is more suitable for custom sql queries:
> http://kamailio.org/docs/modules/stable/modules_k/sqlops.html
>
> Cheers,
> Daniel
>
>
> On 6/29/10 5:47 PM, yaron nahcum wrote:
>> Hi,
>> I have recently installed a kamailio server with release 3.0.2.
>> I would like to use the kamilio as a redirect server that would 
>> recieve REGISTER messages from users and query a proprietary database 
>> that holds users information - if the users are registered to the 
>> service it would redirect the user to the registrar. I need it for 
>> security reasons which I can't fully explain.
>> Now, I am using the avpops module. I have been able to make it work 
>> using the following configuration:
>> modparam("avpops","db_url","mysql://user:pass@localhost/mysql")
>> modparam("avpops","avp_table","proptable")
>> modparam("avpops","db_scheme","scheme0:username_col=sipUsername;value_col=sipDomainName;table=proptable")
>> ----------
>>
>>         if (is_method("REGISTER"))
>>         {
>>                 if 
>> (avp_db_load("$fu/username","$avp(s:CONSTANT_DOMAIN)/$scheme0"))
>>                 {
>>                         append_branch("sip:registrarIP");
>>                         sl_send_reply("302","Test Redirect");
>>                 }
>>                 else
>>                 {
>>                         sl_send_reply("404","Test Not found");
>>                 }
>> --------------
>> The thing is that I don't need to match the string CENTREX against 
>> the domain- it is something I added because I couldn't find another 
>> way to do it. I would like to match only the username. I tried 
>> wildcards or leaving it empty but it didn't work. I tried not to use 
>> the scheme and instead use the table it self but again it didn't work.
>> Is it possible? Do you know a better to do it?
>> Thanks,
>> Yaron.
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>    
>
> -- 
> Daniel-Constantin Mierla
> http://www.asipto.com/
>    
>

-- 
Daniel-Constantin Mierla
http://www.asipto.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20100629/77dfb455/attachment-0001.htm>


More information about the sr-users mailing list