[OpenSIPS-Users] URI PARSING

Premalatha Kuppan premalatha at ngintech.com
Wed Jul 7 12:32:41 CEST 2010


Hi,

Iam using avp_db_query, but opensips is dead with following error,

During Registration, when the user is registered. I have to parse and store
th value in DB. So, included the avp_db_query in this loop. Is this right
one to do. I assume the value of rU is NULL over here, probably its failing.
Not sure :(

Any insight  ?

if (is_method("REGISTER"))
        {
                # authenticate the REGISTER requests (uncomment to enable
auth)
                if (!www_authorize("10.140.1.110", "subscriber"))
                {
                        www_challenge("10.140.1.110", "0");
                        exit;
                }

             #  if (!db_check_to())
             #  {
             #          sl_send_reply("403","Forbidden auth ID");
             #          exit;
             #  }

                if (!save("location"))
                        sl_reply_error();

                $var(x) = $rU ;
                avp_db_query("INSERT INTO TESTTABLE (xxx,yyy,zzz)
VALUES('$(var(x){s.select,0,_})','$var(x)({s.select,1,_})','$(var(x){s.select,2,_})'");
                exit;
        }


Jul  7 06:25:16 204548-4 /usr/local/sbin/opensips[17791]:
ERROR:avpops:fixup_db_query_avp: no db url defined to be used by this
function
Jul  7 06:25:16 204548-4 /usr/local/sbin/opensips[17791]:
*ERROR:core:fix_actions:
fixing failed (code=-6) at cfg line 351*
Jul  7 06:25:16 204548-4 /usr/local/sbin/opensips[17791]: ERROR:core:main:
failed to fix configuration with err code -6

Thanks,
Prem



On Tue, Jul 6, 2010 at 7:57 PM, Brett Nemeroff <brett at nemeroff.com> wrote:

> On Tue, Jul 6, 2010 at 9:19 AM, Premalatha Kuppan <premalatha at ngintech.com
> > wrote:
>
>> My Purpose:
>>
>> 1. At Opensips, iam getting registration request as sip:aaa_bbb_cc at domain.
>> So, i need to parse this "username: aaa_bbb_ccc" and store it in MySQL DB
>> as aaa,bbb,ccc against the coulmn a,b,c.
>>
>> 2. When user is registred, the URL has to be parsed and stored. During
>> de-registration corresponding entries from the MYSQL table should be
>> deleted.
>>
>> 3. In test.sh: iam parsing the username e.g "aaa_bbb_ccc" and rewriting it
>> as "aaa","bbb","ccc" and storing it in MySQL DB.
>>
>> Now to integrate with OpenSIPS as a fisrt step during registration , iam
>> using exec_msg to execute this test.sh.
>>
>> Is there any other solution, i can do it. ?
>>
>>
> Ok, well the registrar module has a lot of mechanism to store registrations
> already. So I'd definitely look at using those. For your custom parsing
> needs, I'd look at using the "select" pseudo-var transformation.... You'll
> need to check on the exact syntax, but it'll be something like:
>
> $(rU{s.select,1,_})  # is bbb
>
> Then you can use avp_db_query to push that direct to the database like:
>
> avp_db_query("INSERT INTO MyFunnyRegistration
> VALUES($(rU{s.select,0,_}),$(rU{s.select,1,_}),$(rU{s.select,2,_}));
>
>
> That should get you going on something. :)
> -Brett
>
>
> _______________________________________________
> 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/20100707/3db36b0b/attachment.htm 


More information about the Users mailing list