On Wed, 5 Jan 2022, Dovid Bender wrote:

I thought of this but that would mean I would need to add this to the beginning of every context which I can do, but I was trying to avoid.

Every extension in every context.

Or maybe get funky with a wildcard extension with priority = 1 and starting all of your real extensions with priority = 3. Something like this (which uses gosub() just for ease of testing):

; test wildcard extension
        same = n,                       gosub(wildcard-extension,1234,1)
        same = n,                       gosub(wildcard-extension,s,1)
        same = n,                       gosub(wildcard-extension,testing,1)
        same = n,                       hangup()

[wildcard-extension]
; save the current context so it can be used in the hangup handler
        exten = _!.,1,                  verbose(1,[${EXTEN}@${CONTEXT}])
        same = n,                       set(LAST-CONTEXT=${CONTEXT})
        same = 4,                       return

; note all the 'real' extensions start with priority = 3
        exten = 1234,3,                 
verbose(1,[${EXTEN}@${CONTEXT}!${PRIORITY}])

        exten = s,3,                    
verbose(1,[${EXTEN}@${CONTEXT}!${PRIORITY}])

        exten = testing,3,              
verbose(1,[${EXTEN}@${CONTEXT}!${PRIORITY}])

; be explicit with 'h' so it doesn't get handled by the wildcard extension
        exten = h,1,                    verbose(1,[${EXTEN}@${CONTEXT}])
        same = n,                       hangup()

Hopefully somebody else has a more elegant solution.

--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwa...@sedwards.com      Voice: +1-760-468-3867 PST
            https://www.linkedin.com/in/steve-edwards-4244281

--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
     https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to