Matching * at end of Caller Name

Asterisk 13 with FreePBX ’

I’ve been struggling for some hours trying to test whether the caller’s name (retrieved from the phonebook) ends in an asterisk. Would appreciate some help please. I’ve tried 2 methods:

  1. REGEX
same => n,GotoIf($[${REGEX(${pattern} ${CALLERID(name)})}]?day:accept)

For this I’ve tried various permutations of enclosing items within “” but to no avail. All fail the test and branch to accept. I know the pattern works by using an online testing tool (I’m presuming Asterisk REGEX works like Python etc). For the benefit of doubt, my log shows the caller’s name has been correctly retrieved.

  1. Extracting and matching the last letter

same => n,GotoIf($["${CALLERID(name):${LEN(${CALLERID(name)})}-1:1}"="*"]?day:accept)

B TW. Is there anyway to reduce the log to show just my dialplan execution steps? It would help find the errors amidst 1000s of log lines that get generated on just one call.

Thanks for reading

Please mark up your code as pre-formatted text, for the forum.

The ways of escaping special characters in Posix regular expressions are to prefix them with \ or to turn them into a single character character class, by enclosing them in [].

1 Like

Whilst searching for a solution I discovered the following retrieves the last character in a string:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.