Had a need to route a lot of DID and did not ant to make routes. Fine, that is what [from-did-direct]
can be used for, along with a custom destination.
Problem. You cannot return from the custom destination if the DID does not match. Granted not every one would care to do this. But some do. In this case they want to play an announcement and then dump the call to the non-DID call flow.
If you simply make a Custom Destination as noted in the linked post, the call is rejected, even if you have the Custom destination set to return to some other location. The [from-did-direct]
context rejects it some place in there if there is no match. I did not bother to try and find where.
This forced me to create my own contexts to get around this.
[match-ext-to-did]
include => from-did-direct
include => match-ext-to-did-failed
exten => _.,1,NoOp(Entered [match-ext-to-did] with DID ending in ${EXTEN}, attempting to match)
[match-ext-to-did-failed]
exten => _.,1,NoOp()
exten => _.,n,NoOp(Entered [match-ext-to-did-failed] with DID ending in ${EXTEN}, returning to custom destination)
exten => _.,n,Return()
Then the custom destination is built as linked above. Failing to my extension for faster testing.
This is what a failed match looks like in the log.
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx.c: Executing [NPANXX3997@from-pstn:20] Goto("PJSIP/Spectrum-00004967", "customdests,dest-1,1") in new stack
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx_builtins.c: Goto (customdests,dest-1,1)
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx.c: Executing [dest-1@customdests:1] NoOp("PJSIP/Spectrum-00004967", "Entering Custom Destination Try to match DID to Extenstion") in new stack
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx.c: Executing [dest-1@customdests:2] Gosub("PJSIP/Spectrum-00004967", "match-ext-to-did,997,1()") in new stack
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx.c: Executing [997@match-ext-to-did:1] NoOp("PJSIP/Spectrum-00004967", "Entered [match-ext-to-did] with DID ending in 997, attempting to match") in new stack
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx.c: Executing [997@match-ext-to-did:2] NoOp("PJSIP/Spectrum-00004967", "Entered [match-ext-to-did-failed] with DID ending in 997, returning to custom destination") in new stack
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx.c: Executing [997@match-ext-to-did:3] Return("PJSIP/Spectrum-00004967", "") in new stack
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx.c: Executing [dest-1@customdests:3] NoOp("PJSIP/Spectrum-00004967", "Returned from Custom Destination Try to match DID to Extenstion") in new stack
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx.c: Executing [dest-1@customdests:4] Goto("PJSIP/Spectrum-00004967", "from-did-direct,219,1") in new stack
[2020-04-21 23:58:58] VERBOSE[158207][C-00002e41] pbx_builtins.c: Goto (from-did-direct,219,1)
This is works just fine, but I would really prefer to not need to create custom contexts just to return like this. Every bit of custom dial plan is another break point.
So is there anything that would do this already that I am missing?