Telephone operator test case

Hello,

The scenario is: I have one extension, D, which can only be called from user A (and a few other users). For example, if user B wants wo call D, it was to go through A, and this one will transfer the call to D.
Now, I’ve trying to solve this with the GotoIF and a database (using func_odbc) but I’m not sure if this is the best approach.
My dialplan is as follows.

exten => D,1,NoOp()
same => n,SET(PRIV_USER=${ODBC_GET_PRIV(${CALLERID(name)})})
same => n,GotoIF(${PRIV_USER}?allow:notallow)
same => n(allow),SET(ODBC_REM_TEMP()=${CALLERID(name)})
same => n,Dial(SIP/D,20)
same => n,Playback(number-not-answering)
same => n,VoiceMail(D@default,u)
same => n,Hangup()
same => n(notallow),Dial(SIP/A,20)
same => n,SET(ODBC_ADD_TEMP()=${CALLERID(name)})
same => n,Playback(number-not-answering)
same => n,VoiceMail(A@default,u)
same => n,Hangup()

Of course, this one is not working. Basically, I first check if a privileged user is calling D and if it’s not, A extension will ring. After this the normal user will be added to the database so it can call D. It’s a bad approach, I know, nut I’m still testing.

Any other ideas?

Thanks!

This seems a little complex, You use what’s called ‘ex-girlfriend’ logic to match specific caller ID’s on an extension, no database needed.

exten => D/A,1,Dial(SIP/${EXTEN})
exten => D/A,2,Voicemail(D@default,u)
exten => D,1,Dial(SIP/A)
exten => D,2,Voicemail(A@default,u)