[asterisk-users] How to access Voicemail Password in Asteriskwithout using V

Philipp Kempgen philipp.kempgen at amooma.de
Sat Mar 10 15:15:49 MST 2007


Tzafrir Cohen wrote:

> On Sat, Mar 10, 2007 at 05:04:01PM +0100, Philipp Kempgen wrote:
>> jamshed zaidi wrote:
>>
>>> sir, i have configured voicemail already but the problem is i want a 
>>> variable which holds a value of password just like ${VM_CALLERID} variable 
>>> holds Voicemail Caller ID (Person leaving vm). i want to process password 
>>> set by the user through comedian mail. my snerio does not allow me to pick 
>>> password value from voicemail.cof file???? How do i come up with this 
>>> situation????
>> If all else fails you might use an AGI script like this (put it
>> in /var/lib/asterisk/agi-bin/):
>>
>>
>> #!/usr/bin/php -q
>> <?php
>> $mailbox = @$argv[1];
>> $pass = '';
>> if (preg_match( '/^\d*$/', $mailbox )) {
>>   $vmConf = file_get_contents( '/etc/asterisk/voicemail.conf' );
>>   if (preg_match( '/^'.$mailbox.'\s*=>\s*(\d*)/m', $vmConf, $m )) {
>>     $pass = $m[1];
>>   }
>> }
>> echo 'SET VARIABLE vm_pass ', $pass, "\n";
>> fFlush(STDOUT);
>> ?>
> 
> And what if the mailbox is separated with a mere '=', rather than a
> '=>'?
> 
> What if #include is used in voicemail.conf ?

I know this is not a generic parser for voicemail.conf but
you can use it in a "controlled environment".

> Why write Yet Another voicemail.conf parser?

I don't know what he needs this for but it provides a
(quick and dirty) solution to the problem.


Regards,
  Philipp

-- 
amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de
     Let's use IT to solve problems and not to create new ones.
           Asterisk? -> http://www.das-asterisk-buch.de

Geschäftsführer: Stefan Wintermeyer
Handelsregister: Neuwied B 14998


More information about the asterisk-users mailing list