Hello,
We want to check if the number in a REFER's Refer-To header begins with 011, and if so reject the request as not allowed. What would be the most effective way to do that?
Thanks in advance,
Have you looked at comparing a header with a string? like;
if($hdr(Refer-To)=~"^011.*") { do something}
Have you also looked at how to reply? maybe something like:
sl_send_reply("603", "Decline");
then exiting further processing, like:
exit;
Then put it all together, and you got what you're looking for.
or maybe instead of replying with an error, just stop processing if these are attacks?
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Mon, Aug 14, 2023 at 3:41 AM David Cunningham dcunningham@voisonics.com wrote:
Hello,
We want to check if the number in a REFER's Refer-To header begins with 011, and if so reject the request as not allowed. What would be the most effective way to do that?
Thanks in advance,
-- David Cunningham, Voisonics Limited http://voisonics.com/ USA: +1 213 221 1092 New Zealand: +64 (0)28 2558 3782 __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hello,
If I'm not mistaken, Refer-To is a name-address pair, so the best way to access the user part of the URI is:
$(hdr(Refer-To){nameaddr.uri}{uri.user})
i.e.
if($(hdr(Refer-To){nameaddr.uri}{uri.user}) =~ "^011")
-- Alex
On Aug 13, 2023, at 8:57 PM, David Cunningham dcunningham@voisonics.com wrote:
Hello,
We want to check if the number in a REFER's Refer-To header begins with 011, and if so reject the request as not allowed. What would be the most effective way to do that?
Thanks in advance,
-- David Cunningham, Voisonics Limited http://voisonics.com/ USA: +1 213 221 1092 New Zealand: +64 (0)28 2558 3782 __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hello,
I think the refer-to can also have header parameters, then tobody transformation should be used, which offers directly {tobody.user}.
The name-addr is subset of to-body, in general using tobody transformation is safer when it is not sure there are header parameters or not.
Cheers, Daniel
On Mon, Aug 14, 2023 at 2:47 PM Alex Balashov abalashov@evaristesys.com wrote:
Hello,
If I'm not mistaken, Refer-To is a name-address pair, so the best way to access the user part of the URI is:
$(hdr(Refer-To){nameaddr.uri}{uri.user})
i.e.
if($(hdr(Refer-To){nameaddr.uri}{uri.user}) =~ "^011")
-- Alex
On Aug 13, 2023, at 8:57 PM, David Cunningham dcunningham@voisonics.com
wrote:
Hello,
We want to check if the number in a REFER's Refer-To header begins with
011, and if so reject the request as not allowed. What would be the most effective way to do that?
Thanks in advance,
-- David Cunningham, Voisonics Limited http://voisonics.com/ USA: +1 213 221 1092 New Zealand: +64 (0)28 2558 3782 __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to
the sender!
Edit mailing list options or unsubscribe:
-- Alex Balashov Principal Consultant Evariste Systems LLC Web: https://evaristesys.com Tel: +1-706-510-6800
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Thank you David, Alex, and Daniel, we'll test solutions using the examples you've provided.
On Tue, 15 Aug 2023 at 02:43, Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
I think the refer-to can also have header parameters, then tobody transformation should be used, which offers directly {tobody.user}.
The name-addr is subset of to-body, in general using tobody transformation is safer when it is not sure there are header parameters or not.
Cheers, Daniel
On Mon, Aug 14, 2023 at 2:47 PM Alex Balashov abalashov@evaristesys.com wrote:
Hello,
If I'm not mistaken, Refer-To is a name-address pair, so the best way to access the user part of the URI is:
$(hdr(Refer-To){nameaddr.uri}{uri.user})
i.e.
if($(hdr(Refer-To){nameaddr.uri}{uri.user}) =~ "^011")
-- Alex
On Aug 13, 2023, at 8:57 PM, David Cunningham <
dcunningham@voisonics.com> wrote:
Hello,
We want to check if the number in a REFER's Refer-To header begins with
011, and if so reject the request as not allowed. What would be the most effective way to do that?
Thanks in advance,
-- David Cunningham, Voisonics Limited http://voisonics.com/ USA: +1 213 221 1092 New Zealand: +64 (0)28 2558 3782 __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only
to the sender!
Edit mailing list options or unsubscribe:
-- Alex Balashov Principal Consultant Evariste Systems LLC Web: https://evaristesys.com Tel: +1-706-510-6800
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
-- Daniel-Constantin Mierla - https://www.asipto.com https://twitter.com/miconda - https://www.linkedin.com/in/miconda Kamailio Advanced Training - https://www.asipto.com/u/kat __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: