Also, $ct.fields(expires) is always null<br><br>xlog("---- contact expires=$ct.fields(expires) ; header expires = $hdr(Expires) \n");<br><u><br>OUTPUT:</u><br>During Registration:<br> ---- contact expires=<null> ; header expires =1800 <br>
<br>During De-Registration:<br> ---- contact expires=<null> ; header expires = 0<br><br><div class="gmail_quote">On Fri, Jul 9, 2010 at 1:47 PM, Premalatha Kuppan <span dir="ltr"><<a href="mailto:premalatha@ngintech.com">premalatha@ngintech.com</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;"><span style="font-family: georgia,serif;">Thanks Bogdan.</span><br style="font-family: georgia,serif;">
<br style="font-family: georgia,serif;"><span style="font-family: georgia,serif;">It was throwing me errors. </span><br style="font-family: georgia,serif;">
<span style="font-family: georgia,serif;">Now i used the following to check de-registration. It works.</span><br><br>if( is_present_hf("Expires") && $(hdr(Expires){<a href="http://s.int" target="_blank">s.int</a>})==0)<br style="font-family: georgia,serif;">
<br>BTW, how to differentiate registration and RE-registration request ?<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Fri, Jul 9, 2010 at 1:01 PM, Bogdan-Andrei Iancu <span dir="ltr"><<a href="mailto:bogdan@voice-system.ro" target="_blank">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;">Try:<br>
<br>
<br>
xlog("---- contact expire=$ct.fields(expires) ; header expire =<br>
$hdr(Expires) \n");<br>
if ($ct.fields(expires)) == '0' || $hdr(Expires)=="0")<br>
<div> xlog("L_ERR", "De-registration\n");<br>
<br>
</div>Regards,<br>
Bogdan<br>
<div><br>
Premalatha Kuppan wrote:<br>
> I couldn't understand.<br>
><br>
> I used $ct.fields(expires).<br>
><br>
> if ($ct.fields(expires)) == '0')<br>
> xlog("L_ERR", "De-registration\n");<br>
><br>
> else<br>
> perform some operation<br>
> exit;<br>
><br>
> But its not working though.<br>
><br>
> I want to differentiate register and de-register SIP request. Thought<br>
> expires field in contact header would hold good. Is there any other way?<br>
><br>
> What is the mistake iam doing ?<br>
><br>
> On Fri, Jul 9, 2010 at 2:49 AM, Richard Revels <<a href="mailto:rrevels@bandwidth.com" target="_blank">rrevels@bandwidth.com</a><br>
</div><div><div></div><div>> <mailto:<a href="mailto:rrevels@bandwidth.com" target="_blank">rrevels@bandwidth.com</a>>> wrote:<br>
><br>
> Ha! Never thought about both being present when I wrote that.<br>
> Thank you.<br>
><br>
><br>
> On Jul 8, 2010, at 4:47 PM, Bogdan-Andrei Iancu wrote:<br>
><br>
> > Hi Richard,<br>
> ><br>
> > actually the logic should be the other way around - the "per<br>
> contact"<br>
> > expire (if present) has higher priority over the header Expire.<br>
> ><br>
> > Regards,<br>
> > Bogdan<br>
> ><br>
> > Richard Revels wrote:<br>
> >> #this next part logs an error if the message has no expires<br>
> >> info (scanner messages sent directly to proxy for instance)<br>
> >> if(is_present_hf("Expires"))<br>
> >> $avp(i:10) := $hdr(Expires);<br>
> >> else<br>
> >> $avp(i:10) := $ct.fields(expires);<br>
> >> if( $avp(i:10) == "0" )<br>
> >> {<br>
> >> ...<br>
> >><br>
> >><br>
> >> Speaking of this, using a min_expires param to the registrar module<br>
> >> seems to defeat allowing users to unregister by sending a<br>
> expires of<br>
> >> zero. I seem to remember it gets bumped to the min value. If<br>
> true, I<br>
> >> think there should be a check added in the minimum time check<br>
> to let<br>
> >> zero sneak through as is and remove the user from userloc table.<br>
> >><br>
> >> Richard<br>
> >><br>
> >><br>
> >> On Jul 8, 2010, at 5:33 AM, Premalatha Kuppan wrote:<br>
> >><br>
> >>> Hi,<br>
> >>><br>
> >>> How do i check expiration for user, meaning to identify<br>
> de-registration.<br>
> >>> When user is de-registred; then the request comes with<br>
> expires=0; how<br>
> >>> to get this field and check in opensips.cfg file ?<br>
> >>><br>
> >>> Any help ?<br>
> >>><br>
> >>> Thanks,<br>
> >>> Prem<br>
> >>><br>
> >>><br>
> >>> On Wed, Jul 7, 2010 at 7:42 PM, Premalatha Kuppan<br>
> >>> <<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a>><br>
</div></div><div>> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a>>>><br>
> wrote:<br>
> >>><br>
</div><div>> >>> 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<br>
> (xxx,yyy,zzz)<br>
> >>><br>
> 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<br>
> de-registration.<br>
> >>><br>
> >>> Thanks,<br>
> >>> Prem<br>
> >>><br>
> >>><br>
> >>><br>
> >>> On Wed, Jul 7, 2010 at 5:05 PM, Bogdan-Andrei Iancu<br>
> >>> <<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a> <mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>><br>
</div>> <mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a> <mailto:<a href="mailto:bogdan@voice-system.ro" target="_blank">bogdan@voice-system.ro</a>>>><br>
<div><div></div><div>> wrote:<br>
> >>><br>
> >>> Premalatha Kuppan wrote:<br>
> >>>> Thanks. Corrected teh opensips.cfg file<br>
> >>>><br>
> >>>> But the problem was due to this. by default DB URL was<br>
> >>> 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<br>
> >>> location?<br>
> >>><br>
> >>> In REGISTER requests, the RURI has only domain part<br>
> >>> (sip:<a href="http://opensips.org" target="_blank">opensips.org</a> <<a href="http://opensips.org" target="_blank">http://opensips.org</a>><br>
> <<a href="http://opensips.org/" target="_blank">http://opensips.org/</a>>)<br>
> >>> so it is normal to have $rU NULL. If you need to<br>
> identity of<br>
> >>> the user<br>
> >>> who registered, according to SIP, you have to look at<br>
> the TO<br>
> >>> URI - so<br>
> >>> use $tu to get TO uri and use the URI transformation if you<br>
> >>> 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>
> >>><br>
> >>>> I want the userpart e.g: sip:userpart@domain is the<br>
> >>> request uri; i<br>
> >>>> need only userpart . I believe that would be stored in $rU;<br>
> >>> but tis<br>
> >>>> coming as NULL. Which variable or where should i place this<br>
> >>> command<br>
> >>>> for registration and de-registration.<br>
> >>>><br>
> >>>> Any Idea ?<br>
> >>>><br>
> >>>> On Wed, Jul 7, 2010 at 4:13 PM, mayamatakeshi<br>
> >>> <<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a><br>
> <mailto:<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a>> <mailto:<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a><br>
> <mailto:<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a>>><br>
> >>>> <mailto:<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a> <mailto:<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a>><br>
> >>> <mailto:<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a><br>
> <mailto:<a href="mailto:mayamatakeshi@gmail.com" target="_blank">mayamatakeshi@gmail.com</a>>>>> wrote:<br>
> >>>><br>
> >>>><br>
> >>>><br>
> >>>> On Wed, Jul 7, 2010 at 7:32 PM, Premalatha Kuppan<br>
> >>>> <<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a>><br>
> >>> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a><br>
> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a>>><br>
> >>> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a><br>
> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a>><br>
> >>> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a><br>
> <mailto:<a href="mailto:premalatha@ngintech.com" target="_blank">premalatha@ngintech.com</a>>>>> wrote:<br>
> >>>><br>
> >>>> Hi,<br>
> >>>><br>
> >>>> Iam using avp_db_query, but opensips is dead with<br>
> >>> following error,<br>
> >>>><br>
> >>>> During Registration, when the user is registered. I<br>
> >>> have to<br>
> >>>> parse and store th value in DB. So, included the<br>
> >>> avp_db_query<br>
> >>>> in this loop. Is this right one to do. I assume the<br>
> >>> 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",<br>
> >>> "subscriber"))<br>
> >>>> {<br>
> >>>><br>
> >>> www_challenge("10.140.1.110", "0");<br>
> >>>> exit;<br>
> >>>> }<br>
> >>>><br>
> >>>> # if (!db_check_to())<br>
> >>>> # {<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>
> >>>><br>
> >>><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<br>
> >>> /usr/local/sbin/opensips[17791]:<br>
> >>>> ERROR:avpops:fixup_db_query_avp: no db url defined<br>
> >>> to be used<br>
> >>>> by this function<br>
> >>>> Jul 7 06:25:16 204548-4<br>
> >>> /usr/local/sbin/opensips[17791]:<br>
> >>>> *ERROR:core:fix_actions: fixing failed (code=-6) at<br>
> >>> cfg line 351*<br>
> >>>> Jul 7 06:25:16 204548-4<br>
> >>> /usr/local/sbin/opensips[17791]:<br>
> >>>> ERROR:core:main: failed to fix configuration with<br>
> >>> 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>
> >>>> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>><br>
> >>> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>>><br>
> >>> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>><br>
> >>> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">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>
> >>><br>
> ------------------------------------------------------------------------<br>
> >>>><br>
> >>>> _______________________________________________<br>
> >>>> Users mailing list<br>
> >>>> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>><br>
> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">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>
> >>> --<br>
</div></div><div>> >>> 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> <<a href="http://www.voice-system.ro" target="_blank">http://www.voice-system.ro</a>><br>
> <<a href="http://www.voice-system.ro/" target="_blank">http://www.voice-system.ro/</a>><br>
> >>><br>
> >>><br>
> >>> _______________________________________________<br>
> >>> Users mailing list<br>
> >>> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
</div><div><div></div><div>> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">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>
> >>> _______________________________________________<br>
> >>> Users mailing list<br>
> >>> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>><br>
> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">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>
> >><br>
> >> _______________________________________________<br>
> >> Users mailing list<br>
> >> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">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>
> > --<br>
> > 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> <<a href="http://www.voice-system.ro" target="_blank">http://www.voice-system.ro</a>><br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > Users mailing list<br>
> > <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">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>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">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>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org" target="_blank">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>
--<br>
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>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">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>
</div></div></blockquote></div><br>