Other minor issues...

Comment on Asterisk authenticate using voicemail passwords
Joined: Wed 20 of Apr, 2005

Other minor issues...

Posted:Mon 20 of Jun, 2005 (17:02 UTC)
I'm not sure about your ARGV parsing issue: try using something like this:
exten => *122, 6, agi(check_vm_pwd.agi,/etc/asterisk/voicemail.conf ${ext_num} ${ext_pwd})

Even like this, the three space-delimited arguments may be passed as one ARGV, which you may need to parse out yourself. I haven't used more than one arg for an agi before.

You can avoid all of these issues by just using asterisk channel variables passed via AGI, instead of command line parameters for these. You may find you already have ext_num and ext_pwd in your %input hash.

Other issues:
- this doesn't handle multiple voicemail contexts. That's a bit tricky the way it is now, but other potential users may want to consider this. If a voicemail box is in multiple vm contexts, the last one in the file will be used.
- instead of reading all the lines into @vmconf_lines, try something like

open my $VMCONF, "<$vmconf"
or error_msg("can't open $vmconf read only");
while (<$VMCONF>) {
close $VMCONF;

This saves memory during use, especially for large conf files.

- "$_ =~" isn't necessary, you can just "s/\s//g;"
- you should probably strip whitespace before skipping lines that don't start with \d
- since almost everyone keeps their voicemail.conf in the same place, make that parameter optional

I hope this helps :)

Also "use strict" is your friend.