ha-plugins icon indicating copy to clipboard operation
ha-plugins copied to clipboard

Wildcard in number lists

Open cefranco76 opened this issue 1 year ago • 6 comments

Hi!!

First of all, congratulations to this addon. I'm new in SIP World but already building wonders with that. It's not an issue, but I'd like to know if is it possible to implement wildcard (*) in number lists.

I'd like to use for example "55319*" to block all incoming calls started with "55319" instead of adding all of them on a list.

Thanks in advance!

cefranco76 avatar Apr 11 '23 00:04 cefranco76

The problem is, that * is a valid character in phone numbers, so can't be used as a wildcard. I would suggest something like

allowed_numbers:
    - "startswith:55319"

Would that solve your use-case?

arnonym avatar Apr 11 '23 16:04 arnonym

Hi, sure!

Actually, any character representing a wildcard would be great.

  • "55319$"
  • "55319%"

So I could write a stdin to addon asking to "hangup" any incoming call starting with "3030%", for example.

cefranco76 avatar Apr 11 '23 23:04 cefranco76

I just released a version which wildcard support for the block and allow list in incoming yaml. See the docs for details. No support for wildcards in stdin service, yet.

arnonym avatar Apr 13 '23 09:04 arnonym

OK, thank you!

I'll wait for stdin implement, cause "blocked_numbers" in incoming file just avoid the calling to be answered not the phone to ring. I have so much spam callers that I need to hangup them before my phone ring.

cefranco76 avatar Apr 13 '23 10:04 cefranco76

You could use the second SIP account for that: Put all the blocked numbers in allowed_numbers and do something like this for the incoming sip file config for that account:

allowed_numbers:
    - "55555555555"
    - "6666{*}"
answer_after: 0
menu:
    post_action: hangup

arnonym avatar Apr 13 '23 14:04 arnonym

You could use the second SIP account for that: Put all the blocked numbers in allowed_numbers and do something like this for the incoming sip file config for that account:

allowed_numbers:
    - "55555555555"
    - "6666{*}"
answer_after: 0
menu:
    post_action: hangup

Did you mention that solution using the two sip configs with the same sip number, right? For some reason, there are conflits avoiding the behavior that I'm trying to reproduce that is: sip_1 config managing accepted calls and sip_2 config blocking other numbers.

cefranco76 avatar Apr 17 '23 00:04 cefranco76