<div dir="ltr"><div>I ain't sure about UPDATEs though. Can they be sent without a to-tag as well? I believe they can, as one can theoretically immediately follow an initial INVITE... If that's the case, perhaps you shouldn't check for those as well:<br><br><span style="color:rgb(0,0,0)"><span style="font-family:monospace,monospace">if ( !has_totag() && !is_method("UPDATE") )<br><br></span></span></div><span style="color:rgb(0,0,0)"><span style="font-family:arial,helvetica,sans-serif">Perhaps a list member with more insight into the UPDATE method could shed some more light on this...</span><span style="font-family:monospace,monospace"><br></span></span></div><div class="gmail_extra"><br><div class="gmail_quote">On 20 March 2018 at 20:16, George Diamantopoulos <span dir="ltr"><<a href="mailto:georgediam@gmail.com" target="_blank">georgediam@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hello David,<br><br></div>First of all your checking for a to-tag is correct. In-dialog requests should have a to-tag, and therefore the block you pasted here won't execute at all for those.<br><br>If you're worrying about provisional (1xx) replies sent from the UAS for the initial INVITE, then indeed some of them might also not have a to-tag set. However, if the code block you pasted is in the request_route() "main" route, then it won't be executed anyway. For responses to be specially processed via the configuration script, you either have to have a reply_route() set, or an onreply_route() set if you're doing stateful processing with the tm module.<br><br></div>BR,<br></div>George<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On 20 March 2018 at 20:03, David Villasmil <span dir="ltr"><<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.<wbr>com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hello guys,</div><div><br></div><div>I want to execute an sql only for INITIAL INVITEs, I'm trying like:</div><div><br></div><div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-weight:normal;font-size:12px;line-height:18px;white-space:pre-wrap"><div><span style="color:rgb(212,212,212)">#</span><span style="color:rgb(212,212,212)">!</span><span style="color:rgb(212,212,212)">ifdef WITH_DID_VALIDATE</span></div><div><span style="color:rgb(212,212,212)">        </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(212,212,212)">(</span><span style="color:rgb(212,212,212)">!</span><span style="color:rgb(212,212,212)">has_totag()) {</span></div><div><span style="color:rgb(212,212,212)">            sql_query(</span><span style="color:rgb(206,145,120)">"acd"</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(206,145,120)">"select * from did_numbers where didNumber = '$tU' and active = 'Y'"</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(206,145,120)">"ra"</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">            xlog(</span><span style="color:rgb(206,145,120)">"L_ERR"</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(206,145,120)">"[REQUEST_ROUTE] number of rows in table domain: $dbr(ra=>rows)</span><span style="color:rgb(215,186,125)">\n</span><span style="color:rgb(206,145,120)">"</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">            </span><span style="color:rgb(197,134,192)">if</span><span style="color:rgb(212,212,212)">( </span><span style="color:rgb(156,220,254)">$dbr</span><span style="color:rgb(212,212,212)">(ra</span><span style="color:rgb(212,212,212)">=></span><span style="color:rgb(212,212,212)">rows)</span><span style="color:rgb(212,212,212)">==</span><span style="color:rgb(181,206,168)">0</span><span style="color:rgb(212,212,212)"> ) {</span></div><div><span style="color:rgb(212,212,212)">                xlog(</span><span style="color:rgb(206,145,120)">"L_ERR"</span><span style="color:rgb(212,212,212)">, </span><span style="color:rgb(206,145,120)">"[REQUEST_ROUTE] DID Number validation returned [$dbr(ra=>rows)], not responding to this request</span><span style="color:rgb(215,186,125)">\n</span><span style="color:rgb(206,145,120)">"</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">                </span><span style="color:rgb(197,134,192)">exit</span><span style="color:rgb(212,212,212)">;</span></div><div><span style="color:rgb(212,212,212)">            }</span></div><div><span style="color:rgb(212,212,212)">            sql_result_free(</span><span style="color:rgb(206,145,120)">"r<wbr>a"</span><span style="color:rgb(212,212,212)">);</span></div><div><span style="color:rgb(212,212,212)">        }</span></div><div><span style="color:rgb(212,212,212)">#</span><span style="color:rgb(212,212,212)">!</span><span style="color:rgb(212,212,212)">endif</span></div><div><span style="color:rgb(212,212,212)"></span></div></div><br></div><div>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.</div><div><br></div><div>How would I limit that to ONLY the INITIAL INVITE? Should I use has_totag?</div><div><br></div><div>Thanks!</div><div><br></div><div>David</div><br clear="all"><div><div class="m_-6246753267023037999m_-3758022030887414456gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: <a href="tel:+34%20669%2044%2083%2037" value="+34669448337" target="_blank">+34669448337</a></div></div></div></div>
</div><div hspace="streak-pt-mark" style="max-height:1px"><img alt="" style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=aZGF2aWQudmlsbGFzbWlsLndvcmtAZ21haWwuY29t&type=zerocontent&guid=0981219f-1dba-4c2e-a589-162f36d408a0"><font color="#ffffff" size="1">ᐧ</font></div>
<br></div></div>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>