[SR-Users] execute only on INITIAL INVITE

Alex Balashov abalashov at evaristesys.com
Tue Mar 20 19:50:46 CET 2018


Yes, the presence of a To tag differentiates in-dialog requests from initial ones.

-- Alex

> On Mar 20, 2018, at 8:03 PM, David Villasmil <david.villasmil.work at gmail.com> wrote:
> 
> Hello guys,
> 
> I want to execute an sql only for INITIAL INVITEs, I'm trying like:
> 
> #!ifdef WITH_DID_VALIDATE
>         if(!has_totag()) {
>             sql_query("acd", "select * from did_numbers where didNumber = '$tU' and active = 'Y'", "ra");
>             xlog("L_ERR", "[REQUEST_ROUTE] number of rows in table domain: $dbr(ra=>rows)\n");
>             if( $dbr(ra=>rows)==0 ) {
>                 xlog("L_ERR", "[REQUEST_ROUTE] DID Number validation returned [$dbr(ra=>rows)], not responding to this request\n");
>                 exit;
>             }
>             sql_result_free("ra");
>         }
> #!endif
> 
> But, say I remove the DID from the allowed list while a call is going on. Then responses to the allowed INVITE would not be processed.
> 
> How would I limit that to ONLY the INITIAL INVITE? Should I use has_totag?
> 
> Thanks!
> 
> David
> 
> Regards,
> 
> David Villasmil
> email: david.villasmil.work at gmail.com
> phone: +34669448337
>> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180320/b1ba2893/attachment.html>


More information about the sr-users mailing list