Dialplan help multiple users sharing one hardphone

Client has one phone in a particular office used by a 2 clerks and the janitor.
Clerk 1 needs access to diaplan contexts [local] [national] & [international].
Clerk 2 needs access to diaplan contexts [local] & [national].
Janitor needs access to diaplan context [local].
The phone registers with context [8001]. Lets allocate extensions [8002] for clerk2 and [8003] for janitor.
In dialplan i would like to be able to use vmauthenticate() in such a way that if clerk1 authenticates dialplan execution begins in context [8001] clerk2 in [8002] and janitor in [8003]
Then i could use
include => local
include => national
include => international
include => local
include => nationall
include => local

What i need is as way to make asterisk drop the user in the dialplan at the context 8001, 8002 or 8003 according to which auth username was used. Basically equivalent to the context = in the sip or iax.conf. The username is the same as the desired start context.

Anyone have any suggestions.
Mysql is available either in realtime or as a look tool if required.


set up an access code for each of them. they dial it, and that goes to DISA() which asks for a password. They put that in, and then get a fake dialtone to dial their destination number at.

If you want to make it stick, you can use VMAuthenticate or something and a global variable. Depending on who last VMAuthenticated, it will be set to a number like 1,2,3 etc. Then use ExecIf’s like

exten => (localpattern),1,ExecIf($[${Phone1AccessLevel}>1]?Dial,SIP/provider/${EXTEN})

exten => (ldpattern),1,ExecIf($[${Phone1AccessLevel}>2]?Dial,SIP/provider/${EXTEN})

exten => _011.,1,ExecIf($[${Phone1AccessLevel}>3]?Dial,SIP/provider/${EXTEN})

now just make a few lines of VMAuthenticate that set Phone1AccessLevel as a global variable…