How can I leave voicemail without dialing into my voicemail

How can I leave voice-mail without dialing into my voice-mail? the way it work for me now is, “A” call “B”, “B” doesn’t answer, Asterisk voice-mail server dial into 'A" and then on “A” enter 3 then 5 and prompt for extension and after i enter the extension of “B”, I was able to leave message.
Is there a way just directly leave voice message for B?

Thank you very much for help

SIP.CONF
[general]
;type=friend
port=5061
bindaddr=10.22.60.2
context=voice-mail ; Default context for incoming calls
dtmfmode=inband ; dtmf mode must be inband as we can only use G.711u
disallow=gsm ; disallow gsm as we don’t support on Metaswitch
disallow=alaw ; disallow as we don’t support on USA Metaswitch system
allow=ulaw ; only allow G.711u as no licence for g.729

[7632679190]
contex=voice-mail
canreinvite=no
type=friend
username=7632679190 ; username for TO header in NOTIFY request
host=10.22.60.20
port=5060 ; port Metaswitch is listening on
mailbox=7632679190@default ; mailbox number @ context in voicemail.conf, needed for MWI

[7632679092]
contex=voice-mail
canreinvite=no
type=friend
username=7632679092 ; username for TO header in NOTIFY request
host=198.174.216.25
port=5060 ; port Metaswitch is listening on
mailbox=7632679092@default ; mailbox number @ context in voicemail.conf, needed for MWI

extension.conf
[voice-mail]
include => vmail
include => macro-voicemail
;Main Contex
;Voicemail Server number configured on MetaSwitch = 7632679998

exten => 7632679998,1,Goto(s,1)

[vmail]

exten => s,1,GotoIf(${RDNIS}?6:2) ; is this a forwarded call (->6) or a direct call (->2)
exten => s,2,Wait(1) ; wait so front of vm message is not clipped
exten => s,3,VoicemailMain(s${CALLERID(num)}) ; Goto subscriber Voicemail box, no password needed
exten => s,4,Wait(1) ; disconnect cleanly
exten => s,5,Hangup ; goodbye
exten => s,6,Answer ; pickup line
exten => s,7,Wait(1) ; wait so front of vm message is not clipped
exten => s,8,Voicemail(u${RDNIS})
exten => s,9,Wait(1)
exten => s,10,Hangup
exten => a,1,VoicemailMain ; goto Main vm menu
exten => a,2,Wait(1) ; disconnect cleanly
exten => a,3,Hangup ; goodbye
exten => t,1,Playback(vm-goodbye) ; play goodbye vm message
exten => t,2,Wait(1) ; disconnect cleanly
exten => t,3,Hangup ; goodbye

[macro-voicemail]
exten => s,1,Dial(${ARG2}|15)
exten => s,n,Voicemail(u${ARG1})
exten => s,n,Voicemail(b${ARG1})

exten => _NXXNXXXXXX,1,Macro(voicemail| ${EXTEN} | SIP/${EXTEN})

voicemail.conf

7632679190 => 1234,7632679190,7632679190@10.22.1.19 ;voicemailbox = linenumber, password = password
7632679092 => 1234,7632679092,7632679092@10.22.1.19 ;voicemailbox = linenumber, password = password

if you just want to leave a mesage for a mailbox I use the following…

exten => 2829,1,Answer
exten => 2829,n,Playback(mailboxprompt)
exten => 2829,n,Read(Box,,4)
exten => 2829,n,VoiceMail(${Box}@myvm,u)
exten => 2829,n,Hangup

you call the number from any phone. It says, “Mailbox?”, you type in the 4 digit extension for the mailbox (extension) and it then takes a message for that person.

I noticed you created large mailbox numbers. You could make your own dial codes to leave a message for a specific mailbox and shorten up that access to get to it at the same time…

for instance…

exten => *31,1,Voicemail(u7632679190)
exten => *32,1,Voicemail(u7632679092)

Thanks Mazzic for your help,
But I don’t hear any announcement that say mailbox instead from asterisk debug, it display the following message “Executing [7632679998@voice-mail:3] Read(“SIP/7632679191-000000e2”, “Box,4”) in new stack
– Accepting a maximum of 4 digits.” and if I enter the extension, I was able to leave voice-mail. Your example bypass all unnecessary prompt. I think I am close to what I want to achieve. The following is what I am trying to do if possible.

  1. When I dial *15, I would like to access voice mail, listen to messages, and delete the mesages … etc…hear the status of that line without entering extension.
  2. When I dial from A to B, If B is not answering to goto voice-mail without entering extension… like regular voice-mail.
    is it possible to do that on asterisk?

The line playback(mailboxprompt) is what played the message that says “Mailbox?”. record your own prompt and make use of it with your system.

I use:

; record/playback sound files
exten => _*3XX,1,Answer
exten => _*3XX,n,Wait(2)
exten => _*3XX,n,Record(/tmp/${EXTEN:2}.wav)
exten => _*3XX,n,Wait(1)
exten => _*3XX,n,Playback(/tmp/${EXTEN:2})
exten => _*3XX,n,Hangup

Just dial a number like *301 and at the beep record your prompt. It will play it back. If you need to do more, use another code like *302, *303, etc. Later, I putty into the machine an move those record files to my area were I keep all of the voice prompts.


You should be able to accomplish what you want with…

exten => *15,1,VoiceMailMain(s${CALLERID(num)})

Any phone could dial *15, no password would be required and they would be at the voicemailmain menu.


exten => 3333,1,Macro(Dial,${EXTEN})
exten => 4444,1,Macro(Dial,${EXTEN})

[macro-dial]
; ARG1 - number to dial ie SIP/3222
exten => s,1,Dial(${ARG1},20)
exten => s,n,VoiceMail(u${MACRO_EXTEN})

The above should handle people calling each other and allowing you to leave their mailbox a message without having to enter any extensions. If 3333 dials 4444 and 4444 does not answer then it will go to the voicemail for 4444.


Granted these examples are simple and could be improved upon. Such as checking to see if a voicemailbox exist before trying to go the voicemail… but they should serve the purpose of being examples.

I used the sound files and it play these announcements: the person at extension is unavailable, press 5 to leave a message and it hung up. The problem that I have, it doesn’t execute the Macro commands, the only why it work is if I put the extension (one phone number) in the argument of Voicemail. For example, if I put voicemail(7632679190) without using macro and I was able to leave a voicemail directly to voicemail without entering the extension but with setup, it only work for one extension.

how can make macro works? whether I include macro context under voice-mail context or not, the result is the same. Thank you again for your help

[voice-mail]
include => macro-dial
exten => _763NXXXXXX,1,GotoIf(${RDNIS}?5:2) ;
exten => _763NXXXXXX,n,Wait(1) ;
exten => _763NXXXXXX,n,Playback(en/vm-theperson)
exten => _763NXXXXXX,n,Playback(en/vm-isunavail)
exten => _763NXXXXXX,n,Answer ;
exten => _763NXXXXXX,n,Wait(1) ;
exten => _763NXXXXXX,n,Playback(en/vm-leavemsg)
exten => _763NXXXXXX,n,Hangup

exten => *15,1,VoiceMailMain(s${CALLERID(num)})

exten => _763NXXXXXX,1,Macro(Dial,${EXTEN})

[macro-dial]
exten => s,1,Dial(${ARG1},20)
exten => s,n,VoiceMail(u${MACRO_EXTEN})

here is the output from debug
Executing [7632679998@voice-mail:1] GotoIf(“SIP/7632679191-0000025f”, “?5:2”) in new stack
– Goto (voice-mail,7632679998,2)
– Executing [7632679998@voice-mail:2] Wait(“SIP/7632679191-0000025f”, “1”) in new stack
– Executing [7632679998@voice-mail:3] Playback(“SIP/7632679191-0000025f”, “en/vm-theperson”) in new stack
– <SIP/7632679191-0000025f> Playing ‘en/vm-theperson.gsm’ (language ‘en’)
– Executing [7632679998@voice-mail:4] Playback(“SIP/7632679191-0000025f”, “en/vm-isunavail”) in new stack
– <SIP/7632679191-0000025f> Playing ‘en/vm-isunavail.gsm’ (language ‘en’)
– Executing [7632679998@voice-mail:5] Answer(“SIP/7632679191-0000025f”, “”) in new stack
– Executing [7632679998@voice-mail:6] Wait(“SIP/7632679191-0000025f”, “1”) in new stack
– Executing [7632679998@voice-mail:7] Playback(“SIP/7632679191-0000025f”, “en/vm-leavemsg”) in new stack
– <SIP/7632679191-0000025f> Playing ‘en/vm-leavemsg.gsm’ (language ‘en’)
– Executing [7632679998@voice-mail:8] GotoIf(“SIP/7632679191-0000025f”, “Hangup”) in new stack
– Auto fallthrough, channel ‘SIP/7632679191-0000025f’ status is ‘UNKNOWN’

Macro’s don’t need to be included. They are a seperate context, which is jumped to when you do the macro command.

Your dialplan logic is no good. You have two pattern matches that are the same with priority 1. Its starting with the first one and running from there and never getting to the line for the macro-dial. Your console output shows that.

This hasn’t been tested, but changing it like so should produce better results.

[voice-mail]
exten => _763NXXXXXX,1,GotoIf(${RDNIS}?5:2) ;
exten => _763NXXXXXX,n,Wait(1) ;
exten => _763NXXXXXX,n,Playback(en/vm-theperson)
exten => _763NXXXXXX,n,Playback(en/vm-isunavail)
exten => _763NXXXXXX,n,Answer ;
exten => _763NXXXXXX,n,Wait(1) ;
exten => _763NXXXXXX,n,Playback(en/vm-leavemsg)
exten => _763NXXXXXX,n,Macro(Dial,${EXTEN})
exten => _763NXXXXXX,n,Hangup

exten => *15,1,VoiceMailMain(s${CALLERID(num)})

As a note, using line numbers like you did on the GotoIf is just asking for trouble. You will at some point add or remove lines and if you forget to adjust those lines you will squirrel things up.

I’d recommend using named labels …

[voice-mail]
exten => _763NXXXXXX,1,GotoIf(${RDNIS}?leavemsg:unavail) ;
exten => _763NXXXXXX,n(unavail),Wait(1) ;
exten => _763NXXXXXX,n,Playback(en/vm-theperson)
exten => _763NXXXXXX,n,Playback(en/vm-isunavail)
exten => _763NXXXXXX,n(leavemsg),Answer ;
exten => _763NXXXXXX,n,Wait(1) ;
exten => _763NXXXXXX,n,Playback(en/vm-leavemsg)
exten => _763NXXXXXX,n,Macro(Dial,${EXTEN})
exten => _763NXXXXXX,n,Hangup

exten => *15,1,VoiceMailMain(s${CALLERID(num)})