Exten evaluation fails when using multiple priorities

We have a context that evaluates the caller ID, changes it and then needs to continue with other contexts which are included.

When I use a single priority for setting the caller ID it works, but when it’s across multiple priorities, it then doesn’t continue with the dial plan.

Working config:
exten => _X.,1,ExecIf($["${CALLERID(num)}" = “310”]?Set(CALLERID(num)=789):Set(CALLERID(num)=456))

Failing config:
exten => _X.,1,NoOp(Rewrite CallerID)
same => n,Verbose(Rewriting CALLERID for ${CALLERID(num)})
same => n,ExecIf($["${CALLERID(num)}" = “310”]?Set(CALLERID(num)=789):Set(CALLERID(num)=456))

This is the complete extension configuration:

exten => _X.,1,ExecIf($["${CALLERID(num)}" = “310”]?Set(CALLERID(num)=789):Set(CALLERID(num)=456))
include => ext-other

exten => _123,1,Macro(dial-provider,${EXTEN})

This is what shows up in the log:
– Executing [123@from-client:1] ExecIf(“SIP/techops-linsrv3-00000bfe”, “0?Set(CALLERID(num)=789):Set(CALLERID(num)=456)”) in new stack
– Auto fallthrough, channel ‘SIP/client-00000bfe’ status is ‘UNKNOWN’

I noticed similar behaviour in other sections, does anyone have any clues?

First off _123 isn’t a valid pattern match.

Secondly your dialplan isn’t going to continue because you have two priority 1’s.

Try making your extension in ext-other be priority ‘2’ and I think it’ll do what you want.

kiniston-dev01*CLI> dialplan show 123@from-client
[ Context 'from-client' created by 'pbx_config' ]
  '_X.' =>          1. ExecIf($["${CALLERID(num)}" = "310"]?Set(CALLERID(num)=789):Set(CALLERID(num)=456)) [pbx_config]
[ Included context 'ext-other' created by 'pbx_config' ]
  '_X.' =>          2. Macro(dial-provider,${EXTEN})              [pbx_config]

_123 is a valid pattern, although it is equivalent to just 123, so it isn’t normal.

It is perfectly valid to have multiple priority 1’s, as long as they have different patterns. However, included contexts are only used if there is no match in the including context, so, whereas _123 would be more specific than _X if in the same context, _X. will match 123 and the included context will be ignored, in this case.

The full dialplan and logs don’t seem to match what you had in the first part of the question.

Funny thing is, when I added a NoOp as first priority, it did work?!

It now does walk through the extensions as configured.