Playing with shared voicemail

Re: the above post, where the poster setups a virtual extension with voicemail and setups all the desk phones within a team with a BLF of *98XXX to access the extension’s mailbox.

I’m curious if it’s possible to ever access any mailbox other than your own without inputting a password, or if there’s a way of passing that password as part of the number. Or by accessing a custom context. Or some other method.

Basically my use case is this:-

Thanks to @Dicko I’ve got a way that cron checks for a new voicemail in an extension’s mailbox every minute. If there’s a new voicemail, Asterisk calls the user back. What I’m trying to setup is for it to IDEALLY say “Would you like to listen to the voicemail, if so press ‘1’” failing that, if it just autoplayed the new voicemail or seamlessly entered that user’s voicemail, that would be pretty cool!

I guess another option (thinking here as I type) I could have the user asked to press 1 if they want the voicemail moving to their mailbox so they can access it easily from their phone…

Thanks all for any help with this “icing on the cake” issue. FreePBX is awesome!!

P.S. One oddity is that I’ve been dialling *98201 (where 201 is another extension and I’m on extension 203) now a few times, it ran me through the “record a busy message”, “record an unavailable message” and “change your password” bits…but now when I call *98201 it KEEPS asking me to change my password even though I sort of have. I say sort of, I just set the password to the same value because I didn’t want to change it! Is FreePBX/Asterisk smart enough to know I’m trying to resist it?!


set forcename and forcegreeting in your voicemail.conf file

(remind me of my script also please)

The answer will be in your , Just use a custom-context after extracting NNNN if you used a wild card there. perhaps post your

The answer to how to access another mailbox without inputting a password? looks like this:-

cp /var/spool/asterisk/tmp/ /var/spool/asterisk/tmp/
mv /var/spool/asterisk/tmp/ /var/spool/asterisk/outgoing looks like this:-

Channel: Local/[email protected]
Callerid: "New voicemail has been left"
MaxRetries: 5
RetryTime: 300
WaitTime: 45
Context: newvoicemail
Extension: s
Priority: 1

The newvoicemail context looks like this, cos this is kinda where I get stuck!

exten => s,1,Background(en/custom/messagefile)         ; "play a message"

exten =>  s,1,Read(ANSWER,en/custom/messagefile,1,,2,2)
pseudo from here

exten => s,n,If ${ANSWER} = 1 ? playback(/var/spool/asterisk/voicemail/default/203/INBOX/msg0000):hangup)
exten => s,n,Read(DELETE,en/custom/wannadelete,1,,2,2)
exten => s,n,IF $(DELETE} = 1? system(rm /var/spool/asterisk/voicemail/default/203/INBOX/msg0000*)

exten => HAngup()

Thanks, dicko, and that ‘direct’ approach using a customcontext will allow me to bypass any passwords on the other user’s mailbox e.g. ext 201? Huge thanks.

Ok Dicko! :slight_smile:

Well, I’ve got this far:

exten => s,1,playback(/var/spool/asterisk/voicemail/default/203/INBOX/msg0000
exten => s,2,system(rm /var/spool/asterisk/voicemail/default/203/INBOX/msg0000.txt)

which is working amazingly well, HOWEVER, instead of just deleting the unread flag, that final command seems to delete the voicemail too?

Once “I’ve” got this bit working, was going to add in a confirmatory delete!

Thanks all! FreePBX is fun!

There is no “unread flag”, if you want to mark them as ‘read’ rather than delete them you will need to move them, renamed to one higher than the last one there already, into


(hint: printf msg%04d.  $((  $(ls -rt /var/spool/asterisk/voicemail/default/203/Old/*.txt 2>/dev/null|tail -1|sed 's|.*msg0*\([0-9]*\)\(.txt\)|\1|')  + 1 )) )

On a reread, there is more to a voicemail, the msgnnn.txt file exists for every message there will ALWAYS be at least one other file msgnnn.wav msgnnn.WAV msgnnn.gsm etc. these are the mail message itself in various formats as configured, you will need to handle ALL these files en-masse as you ‘mark read’ or ‘erase’ or you will screw up the voicemail structure as known to comedian mail.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.