Possible bug in voicemail module

I’m using Elastix 0.8.4. On a clean install, dialing *97 (My Voicemail) to get to voicemail prompts for a mailbox number as though I dialed *98 (Dial Voicemail.) After digging in config files and php code, I found a possible reason:

file /var/www/html/admin/modules/voicemail/functions.inc.php
starting at line 42

[code:1]
/* TODO: once depends functionality gets fixed in core this should be put back
$ext->add($id, $c, ‘check’, new ext_vmexists(’${CALLERID(num)}@${VMCONTEXT}’)); // n,VoiceMailMain(${VMCONTEXT})
*/
$ext->add($id, $c, ‘check’, new extension(‘MailBoxExists(${CALLERID(num)}@${VMCONTEXT})|j’)); // n,VoiceMailMain(${VMCONTEXT})
$ext->add($id, $c, ‘’, new ext_vmmain(’’)); // n,VoiceMailMain(${VMCONTEXT})
$ext->add($id, $c, ‘’, new ext_macro(‘hangupcall’)); // $cmd,n,Macro(user-callerid)
$ext->add($id, $c, ‘’, new ext_vmmain(’${CALLERID(num)}@${VMCONTEXT}’),‘check’,101); // n,VoiceMailMain(${VMCONTEXT})
[/code:1]

In line 46 where it has ext_vmmain(’’); it looks like (judging by the comments) it should be

[code:1]
ext_vmmain(’${CALLERID(num)}@${VMCONTEXT}’);
[/code:1]

Adding this and making a change to something in the GUI so that it rewrites the asterisk extensions config file fixes the problem, allowing me to dial *97 and get a password prompt for my extension’s voicemail.

the way the code is written, if the mailbox exists (with that context) then it branches to the priority+101 (which is the call below with the check 101 in it), otherwise it follows through and that call purposely has no context.

If you are having issues, it may be related to Asterisk 1.4 in which case you should file a bug against the 2.3 beta code (even though I realize you are not running that). You should do a test and look at the CLI and see if a mailbox that does exist is NOT branching to the proper line where it would include the context information. If you find that is the case, paste your CLI trace as part of the bug and make sure you include the version of asterisk and all you are running.

btw - here is a patch you may want to try. If it works, paste the CLI output to review and I can review it on Astrerisk 1.2 as well, since the jump to priority+101 is getting dated, deprecated and has always been a bad idea.

[code:1]Index: functions.inc.php

— functions.inc.php (revision 4600)
+++ functions.inc.php (working copy)
@@ -42,10 +42,11 @@
/* TODO: once depends functionality gets fixed in core this should be put back
$ext->add($id, $c, ‘check’, new ext_vmexists(’${CALLERID(num)}@${VMCONTEXT}’)); // n,VoiceMailMain(${VMCONTEXT})
*/

  •   $ext->add($id, $c, 'check', new extension('MailBoxExists(${CALLERID(num)}@${VMCONTEXT})|j')); // n,VoiceMailMain(${VMCONTEXT})
    
  •   $ext->add($id, $c, 'check', new extension('MailBoxExists(${CALLERID(num)}@${VMCONTEXT})')); // n,VoiceMailMain(${VMCONTEXT})
    
  •   $ext->add($id, $c, '', new ext_gotoif('$["${VMBOXEXISTSSTATUS}" = "SUCCESS"]', 'mbexist'));
      $ext->add($id, $c, '', new ext_vmmain('')); // n,VoiceMailMain(${VMCONTEXT})
      $ext->add($id, $c, '', new ext_macro('hangupcall')); // $cmd,n,Macro(user-callerid)
    
  •   $ext->add($id, $c, '', new ext_vmmain('${CALLERID(num)}@${VMCONTEXT}'),'check',101); // n,VoiceMailMain(${VMCONTEXT})
    
  •   $ext->add($id, $c, 'mbexist', new ext_vmmain('${CALLERID(num)}@${VMCONTEXT}'),'check',101); // n,VoiceMailMain(${VMCONTEXT})
      $ext->add($id, $c, '', new ext_macro('hangupcall')); // $cmd,n,Macro(user-callerid)
    

}
[/code:1]
You will have to apply the patch against the original version

Patch worked. :smiley: Thanks for the help.