Thanks to all.<br><br>Its working now using $tu and avp_db_query.<br><br> $var(x)=$(tu{uri.user});<br> 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,_})')");<br>
<br>Now, have to look how to remove these entries during de-registration.<br><br>Thanks,<br>Prem<br><br><br><div class="gmail_quote">On Wed, Jul 7, 2010 at 5:05 PM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro">bogdan@voice-system.ro</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">Premalatha Kuppan wrote:<br>
> Thanks. Corrected teh opensips.cfg file<br>
><br>
> But the problem was due to this. by default DB URL was NULL. Now i<br>
> have added the DB URL for avpops.<br>
> # default URL<br>
> modparam("avpops","db_url","mysql://user:passwd@host/database")<br>
><br>
><br>
><br>
> But the value of $rU is NULL..am i placing it in wrong location?<br>
<br>
</div>In REGISTER requests, the RURI has only domain part (sip:<a href="http://opensips.org" target="_blank">opensips.org</a>)<br>
so it is normal to have $rU NULL. If you need to identity of the user<br>
who registered, according to SIP, you have to look at the TO URI - so<br>
use $tu to get TO uri and use the URI transformation if you want to<br>
split in in username and domain (see<br>
<a href="http://www.opensips.org/Resources/DocsCoreTran16#toc17" target="_blank">http://www.opensips.org/Resources/DocsCoreTran16#toc17</a> ).<br>
<br>
<br>
Regards,<br>
Bogdan<br>
<div class="im"><br>
> I want the userpart e.g: sip:userpart@domain is the request uri; i<br>
> need only userpart . I believe that would be stored in $rU; but tis<br>
> coming as NULL. Which variable or where should i place this command<br>
> for registration and de-registration.<br>
><br>
> Any Idea ?<br>
><br>
> On Wed, Jul 7, 2010 at 4:13 PM, mayamatakeshi <<a href="mailto:mayamatakeshi@gmail.com">mayamatakeshi@gmail.com</a><br>
</div><div class="im">> <mailto:<a href="mailto:mayamatakeshi@gmail.com">mayamatakeshi@gmail.com</a>>> wrote:<br>
><br>
><br>
><br>
> On Wed, Jul 7, 2010 at 7:32 PM, Premalatha Kuppan<br>
</div><div><div></div><div class="h5">> <<a href="mailto:premalatha@ngintech.com">premalatha@ngintech.com</a> <mailto:<a href="mailto:premalatha@ngintech.com">premalatha@ngintech.com</a>>> wrote:<br>
><br>
> Hi,<br>
><br>
> Iam using avp_db_query, but opensips is dead with following error,<br>
><br>
> During Registration, when the user is registered. I have to<br>
> parse and store th value in DB. So, included the avp_db_query<br>
> in this loop. Is this right one to do. I assume the value of<br>
> rU is NULL over here, probably its failing. Not sure :(<br>
><br>
> Any insight ?<br>
><br>
> if (is_method("REGISTER"))<br>
> {<br>
> # authenticate the REGISTER requests<br>
> (uncomment to enable auth)<br>
> if (!www_authorize("10.140.1.110", "subscriber"))<br>
> {<br>
> www_challenge("10.140.1.110", "0");<br>
> exit;<br>
> }<br>
><br>
> # if (!db_check_to())<br>
> # {<br>
> # sl_send_reply("403","Forbidden auth ID");<br>
> # exit;<br>
> # }<br>
><br>
> if (!save("location"))<br>
> sl_reply_error();<br>
><br>
> $var(x) = $rU ;<br>
> avp_db_query("INSERT INTO TESTTABLE<br>
> (xxx,yyy,zzz)<br>
> VALUES('$(var(x){s.select,0,_})','$var(x)({s.select,1,_})','$(var(x){s.select,2,_})'");<br>
> exit;<br>
> }<br>
><br>
><br>
> Jul 7 06:25:16 204548-4 /usr/local/sbin/opensips[17791]:<br>
> ERROR:avpops:fixup_db_query_avp: no db url defined to be used<br>
> by this function<br>
> Jul 7 06:25:16 204548-4 /usr/local/sbin/opensips[17791]:<br>
> *ERROR:core:fix_actions: fixing failed (code=-6) at cfg line 351*<br>
> Jul 7 06:25:16 204548-4 /usr/local/sbin/opensips[17791]:<br>
> ERROR:core:main: failed to fix configuration with err code -6<br>
><br>
><br>
> Clearly you misplaced the parenthesis:<br>
><br>
><br>
> $(var(x){s.select,0,_})',<br>
> '$var(x)({s.select,1,_})',<br>
> '$(var(x){s.select,2,_})'<br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
</div></div>> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>><br>
<div class="im">> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
><br>
</div>> ------------------------------------------------------------------------<br>
<div class="im">><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
><br>
<br>
<br>
</div>--<br>
<div class="im">Bogdan-Andrei Iancu<br>
OpenSIPS Bootcamp<br>
20 - 24 September 2010, Frankfurt, Germany<br>
<a href="http://www.voice-system.ro" target="_blank">www.voice-system.ro</a><br>
<br>
<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br>