[Asterisk-Dev] [patch] Function to check passcode against vmpasscode
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Wed Jan 18 19:18:36 MST 2006
On Wednesday 18 January 2006 13:37, Gil Kloepfer wrote:
> Okay, here is an updated patch against trunk/8190
> asterisk/apps/app_voicemail.c that adds passcode checking for an
> already-known passcode to app VMAuthenticate.
>
> I also rewrote much of VMAuthenticate to utilize the Asterisk
> arg/option parsing library rather than doing its own parsing.
> This makes it easier to add additional options later on if needed.
>
> It works as follows: If you have a passcode in variable "passvar"
> that you want to check against the passcode for mailbox 1234, you
> would execute code as follows:
>
> VMAuthenticate(1234,p(${passvar}))
> GotoIf(${AUTH_STATUS}?good:bad)
>
> The AUTH_STATUS variable is set to 1 for successful, 0 for failed.
>
> I also updated the descriptive text for VMAuthenticate to include
> these changes.
I know I'm a little late to this thread, but I think your original
patch was a bit closer to what was needed. I saw your original patch
as attempting to avoid getting the vm password in the clear as
notable, but possibly misguided. I would suggest a read/write
function VM_PASSWORD(mailbox[@context]), which allows the dialplan to
both read the password as well as set it, which is a feature that has
been requested. In this way, your logic could be greatly simplified
as:
$[${VM_PASSWORD(1234 at default)} = ${savedpass}]
This is a lot clearer and doesn't attempt to coopt an application
which is really just trying to act like Authenticate (but with a
clear association between users and passwords -- and the ability
of a user to change his authentication password via some mechanism).
Of course, letting your function also be set would allow methods other
than the interactive VoicemailMain application to be used to change a
voicemail password.
Another (more complex) option would be a function
VM(<property>(mailbox at context)) which would allow the retrieval and
setting of multiple properties, one of which would be password. This
could even be devised to replace VMCOUNT with VM(count(mailbox)).
--
Tilghman
More information about the asterisk-dev
mailing list