Hi,
I want to limit Kamailios accepted methods to REGISTER, INVITE and their related methods like BYE and CANCEL. How to do this in Kamailio? Is there a standard way or I should use is_method function?
Regards
Hi,
We use the is_method function to enforce this. You can specify multiple method names in the function arguments. For instance:
if(is_method("SUBSCRIBE|NOTIFY|PUBLISH|INFO|MESSAGE")) { sl_send_reply("405", "Method Not Allowed"); exit; }
Regards,
Grant Bagdasarian
Senior Developer
+31765727054tel:+31765727054
cm.comhttps://cm.com
[cid:image002.png@01D3D273.275C78C0]
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Gholamreza Sabery Sent: donderdag 12 april 2018 14:47 To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: [SR-Users] Limiting Kamailios accepted methods
Hi, I want to limit Kamailios accepted methods to REGISTER, INVITE and their related methods like BYE and CANCEL. How to do this in Kamailio? Is there a standard way or I should use is_method function?
Regards
Dear Grant
Thank you very much!
On Thu, Apr 12, 2018 at 6:00 PM, Grant Bagdasarian gb@cm.nl wrote:
Hi,
We use the is_method function to enforce this. You can specify multiple method names in the function arguments.
For instance:
if(is_method("SUBSCRIBE|NOTIFY|PUBLISH|INFO|MESSAGE")) {
sl_send_reply("405", "Method Not Allowed"); exit; }
Regards,
Grant Bagdasarian
Senior Developer
+31765727054
cm.com
*From:* sr-users sr-users-bounces@lists.kamailio.org * On Behalf Of *Gholamreza Sabery *Sent:* donderdag 12 april 2018 14:47 *To:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Subject:* [SR-Users] Limiting Kamailios accepted methods
Hi,
I want to limit Kamailios accepted methods to REGISTER, INVITE and their related methods like BYE and CANCEL. How to do this in Kamailio? Is there a standard way or I should use is_method function?
Regards
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello,
pointed in another response, is_method(...) is good solution, I just wanted to add that you should be careful with what you reject and when, because part of an INVITE dialog can be more than just ACK, BYE and CANCEL, you can get REFER, UPDATE, INFO, NOTIFY...
So I would allow all requests that have a To-tag (see has_totag() and Route header added by kamailio (loose_route() should return true).
Cheers, Daniel
On 12.04.18 14:47, Gholamreza Sabery wrote:
Hi,
I want to limit Kamailios accepted methods to REGISTER, INVITE and their related methods like BYE and CANCEL. How to do this in Kamailio? Is there a standard way or I should use is_method function?
Regards
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Thank you very much Daniel.
Regards
On Thu, Apr 12, 2018 at 9:11 PM, Daniel-Constantin Mierla <miconda@gmail.com
wrote:
Hello,
pointed in another response, is_method(...) is good solution, I just wanted to add that you should be careful with what you reject and when, because part of an INVITE dialog can be more than just ACK, BYE and CANCEL, you can get REFER, UPDATE, INFO, NOTIFY...
So I would allow all requests that have a To-tag (see has_totag() and Route header added by kamailio (loose_route() should return true). Cheers, Daniel
On 12.04.18 14:47, Gholamreza Sabery wrote:
Hi,
I want to limit Kamailios accepted methods to REGISTER, INVITE and their related methods like BYE and CANCEL. How to do this in Kamailio? Is there a standard way or I should use is_method function?
Regards
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierlawww.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com