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@gmail.com phone: +34669448337 ᐧ
Hello David,
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.
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, George
On 20 March 2018 at 20:03, David Villasmil david.villasmil.work@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@gmail.com phone: +34669448337 <+34%20669%2044%2083%2037> ᐧ
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
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:
if ( !has_totag() && !is_method("UPDATE") )
Perhaps a list member with more insight into the UPDATE method could shed some more light on this...
On 20 March 2018 at 20:16, George Diamantopoulos georgediam@gmail.com wrote:
Hello David,
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.
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, George
On 20 March 2018 at 20:03, David Villasmil <david.villasmil.work@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@gmail.com phone: +34669448337 <+34%20669%2044%2083%2037> ᐧ
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
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@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@gmail.com phone: +34669448337 ᐧ _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Many thanks to all! ᐧ
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Tue, Mar 20, 2018 at 7:50 PM, Alex Balashov abalashov@evaristesys.com wrote:
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@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@gmail.com phone: +34669448337 <+34%20669%2044%2083%2037> ᐧ
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users