[OpenSIPS-Users] URI PARSING
Premalatha Kuppan
premalatha at ngintech.com
Thu Jul 8 11:33:05 CEST 2010
Hi,
How do i check expiration for user, meaning to identify de-registration.
When user is de-registred; then the request comes with expires=0; how to get
this field and check in opensips.cfg file ?
Any help ?
Thanks,
Prem
On Wed, Jul 7, 2010 at 7:42 PM, Premalatha Kuppan
<premalatha at ngintech.com>wrote:
> Thanks to all.
>
> Its working now using $tu and avp_db_query.
>
> $var(x)=$(tu{uri.user});
> 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,_})')");
>
> Now, have to look how to remove these entries during de-registration.
>
> Thanks,
> Prem
>
>
>
> On Wed, Jul 7, 2010 at 5:05 PM, Bogdan-Andrei Iancu <
> bogdan at voice-system.ro> wrote:
>
>> Premalatha Kuppan wrote:
>> > Thanks. Corrected teh opensips.cfg file
>> >
>> > But the problem was due to this. by default DB URL was NULL. Now i
>> > have added the DB URL for avpops.
>> > # default URL
>> > modparam("avpops","db_url","mysql://user:passwd@host/database")
>> >
>> >
>> >
>> > But the value of $rU is NULL..am i placing it in wrong location?
>>
>> In REGISTER requests, the RURI has only domain part (sip:opensips.org)
>> so it is normal to have $rU NULL. If you need to identity of the user
>> who registered, according to SIP, you have to look at the TO URI - so
>> use $tu to get TO uri and use the URI transformation if you want to
>> split in in username and domain (see
>> http://www.opensips.org/Resources/DocsCoreTran16#toc17 ).
>>
>>
>> Regards,
>> Bogdan
>>
>> > I want the userpart e.g: sip:userpart at domain is the request uri; i
>> > need only userpart . I believe that would be stored in $rU; but tis
>> > coming as NULL. Which variable or where should i place this command
>> > for registration and de-registration.
>> >
>> > Any Idea ?
>> >
>> > On Wed, Jul 7, 2010 at 4:13 PM, mayamatakeshi <mayamatakeshi at gmail.com
>> > <mailto:mayamatakeshi at gmail.com>> wrote:
>> >
>> >
>> >
>> > On Wed, Jul 7, 2010 at 7:32 PM, Premalatha Kuppan
>> > <premalatha at ngintech.com <mailto:premalatha at ngintech.com>> wrote:
>> >
>> > 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
>> >
>> >
>> > Clearly you misplaced the parenthesis:
>> >
>> >
>> > $(var(x){s.select,0,_})',
>> > '$var(x)({s.select,1,_})',
>> > '$(var(x){s.select,2,_})'
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > Users mailing list
>> > Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> >
>> >
>> > ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > Users mailing list
>> > Users at lists.opensips.org
>> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> >
>>
>>
>> --
>> Bogdan-Andrei Iancu
>> OpenSIPS Bootcamp
>> 20 - 24 September 2010, Frankfurt, Germany
>> www.voice-system.ro
>>
>>
>> _______________________________________________
>> 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/20100708/74aa39de/attachment.htm
More information about the Users
mailing list