Pattern matching for Anonymous

I have created an IVR menu where I want to send callers to specific locations based on their calling number. I however can’t get it to work if the A-number is Anonymous.

exten => s,1,NoOp(Entering IVR)
exten => s,n,Goto(${CALLERID(num)},1)
exten => _Anonymous!,1,NoOp(Anonymous caller)
exten => _Anonymous!,n,Hangup()
exten => _+45!,1,NoOp(Danish number)
exten => _+45!,n,Hangup()
exten => i,1,NoOp(No match)
exten => i,n,Hangup()

It works fine when the A-number is ex. +4524252627 - then I hit the _+45! pattern
When A-number is Anonymous then no match is found, and I hit the i extension.

Am I doing something wrong or are alphabetical strings not supported?

On Tuesday 05 November 2024 at 13:50:19, Soelvberg via Asterisk Community
wrote:

I have created an IVR menu where I want to send callers to specific
locations based on their calling number. I however can’t get it to work if
the A-number is Anonymous.

Am I doing something wrong or are alphabetical strings not supported?

Alphabetic strings are definitely supported. Show us what ${EXTEN} contains at
this point in the dialplan.

Antony.


Schrödinger’s rule of data integrity: the condition of any backup is unknown
until a restore is attempted.

                                               Please reply to the list;
                                                     please *don't* CC me.

Why can’t you do an exact match?

If you really need wild card suffixes, you may need to give the letters as single character character classes, otherwise some will be treated as meta-characters: [A]]n][o]…

Hi Antony and David

I probably have found the solution.
What I had was this

[ZyIncoming]
exten => aaaa,1,NoOp(********** START ***********)
exten => aaaa,n,Goto(ivrtest,s,1)

[ivrtest]
exten => s,1,NoOp(****** In IVR*******)
exten => s,n,Goto(${CALLERID(num)},1)
exten => _Anonymous!,1,NoOp(Anonymous caller***)
exten => _Anonymous!,n,Hangup()
exten => _+45!,1,NoOp(*********** Danish number*******************)
exten => _+45!,n,Hangup()
exten => i,1,NoOp(********* NO MATCH ****************)
exten => i,n,Hangup()

And my the first lines of my INVITE was this

INVITE sip:aaaa@novus.zylinc.cloud:5090 SIP/2.0
From: “Loadtest” sip:Anonymous@10.0.0.4;tag=a4ee714d-3542-4526-9a9f-6927b0fff668

I just found that if I change the anonymous pattern to
exten => _[Anonymous]!,1,NoOp(works)
Then it works as expected.

One question still: if I also change the Danish extension to exten => _[+45]!,1,NoOp(Danish)
Then i get a match no matter what number I use - except for Anonymous

Tried calling in with number 54912345678, and for some reason it matched matched _[+45]!
Executing [54912345678@ivrtest:1] NoOp(“PJSIP/anonymous-00000039”, “*********** Danish number*******************”)

So what i need to know is when the extension should be enclosed in brackets.
Is it when it contains any letters that is not + or numeric?

On Tuesday 05 November 2024 at 14:36:27, Soelvberg via Asterisk Community
wrote:

I just found that if I change the anonymous pattern to
exten => _[Anonymous]!,1,NoOp(works)
Then it works as expected.

This looks absolutely terrible.

It’s a pattern match (starts with underscore) for any letter in the word
“Anonymous” (so, any of A m n o s y) and will end on the first match (ends with
exclamation).

Please read about Asterisk patterns before implementing this sort of thing for
real.

https://docs.asterisk.org/Configuration/Dialplan/Pattern-Matching/

Antony.


It is also possible that putting the birds in a laboratory setting
inadvertently renders them relatively incompetent.

  • Daniel C Dennett

                                                Please reply to the list;
                                                      please *don't* CC me.
    

I changed the script to this:

[ZyIncoming]
exten => aaaa,1,NoOp(********** START ***********)
exten => aaaa,n,Goto(ivrtest,s,1)

[ivrtest]
exten => s,1,NoOp(****** In IVR*******)
exten => s,n,Goto(${CALLERID(num)},1)
exten => _[A][n][o][n][y][m][o][u][s]!,1,NoOp(Anonymous caller***)
exten => _[A][n][o][n][y][m][o][u][s]!,n,Hangup()
exten => _[+][4][5]!,1,NoOp(*********** Danish number*******************)
exten => _[+][4][5]!,n,Hangup()
exten => i,1,NoOp(********* NO MATCH ****************)
exten => i,n,Hangup()

Then everything works as expected.
Thank you so much for your hints

On Tuesday 05 November 2024 at 14:56:10, Soelvberg via Asterisk Community
wrote:

exten => _[A][n][o][n][y][m][o][u][s]!,1,NoOp(Anonymous
caller
***)
exten => _[A][n][o][n][y][m][o][u][s]!,n,Hangup()
exten => _[+][4][5]!,1,NoOp(*********** Danish number*******************)
exten => _[+][4][5]!,n,Hangup()

PLEASE read Pattern Matching - Asterisk Documentation

Antony.


A committee is a group of people who keep minutes and waste hours.

  • Milton Berle

                                                Please reply to the list;
                                                      please *don't* CC me.