# Voicemail application syntax

**URL:** <https://community.asterisk.org/t/voicemail-application-syntax/23948>\
**Category:** Asterisk Support\
**Created:** [November 6, 2008, 2:48am UTC](https://community.asterisk.org/t/voicemail-application-syntax/23948 "2008-11-06T02:48:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![im822](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@im822](https://community.asterisk.org/u/im822)\
**Post date:** [November 6, 2008, 2:48am UTC](https://community.asterisk.org/t/voicemail-application-syntax/23948/1 "2008-11-06T02:48:13Z")

</div>

Hello,

I am aware that the voicemail application syntax has chnaged. Can you please help me with new syntax to get old behavior.

In my extensionss.conf I used to have this line.

exten =\> 8,1,VoiceMail

When I called into asterisk the prompt would ask for a voicemail box number, I would dial the number and then be able to leave a voicemail in that box.

Now with this same line this no longer happens. Now the mail box number is not able to be “found”.

No entry in voicemail config file for ‘1001’

With an example I found this works but not as I want.

exten =\> 8,1,VoiceMail(1001@cj)

But I can only leave a message in box 1001. I want to be able to provide a box from a list of 10 different boxes for the context. For example these from voicemail.conf

[cj]

1001 =\> [9999,cj,cj@cj.com](mailto:9999,cj,cj@cj.com)

1002 =\> [9999,cj,1002@cj.com](mailto:9999,cj,1002@cj.com)

1003 =\> [9999,cj,1003@cj.com](mailto:9999,cj,1003@cj.com)

If any one can help this is greatly appreciated.

regards  
cj

---

<div class="post-metadata">

**Author:** ![im822](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@im822](https://community.asterisk.org/u/im822)\
**Post date:** [November 6, 2008, 3:11am UTC](https://community.asterisk.org/t/voicemail-application-syntax/23948/2 "2008-11-06T03:11:16Z")

</div>

ok i am closer. I need a macro inside this.

exten =\> 8,1,VoiceMail(MACRO)

I do not know yet how to build this logic.

Please help if you can.

My voicemail.conf is here.

[cj]  
1001 =\> [9999,cj,cj@cj.com](mailto:9999,cj,cj@cj.com)  
1002 =\> [9999,cj,1002@cj.com](mailto:9999,cj,1002@cj.com)

1003 =\> [9999,cj,1003@cj.com](mailto:9999,cj,1003@cj.com)

Here is the extensions.conf

[cj]  
exten =\> 8,1,VoiceMail(MAACRO HERE)

HEre is my sip.conf

[3000]  
type=friend  
context=cj  
username=3000  
host=dynamic  
mailbox=3000  
dtmfmode=rfc2833

I want to dial 8 and have it ask me for a box number. I want to be a ble to provide a box number from the voicemail.conf file one of the three listed. I then want to leave a message in the box I dial in after prompted for it. Can this be done ?

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![Mark\_Logan](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Mark\_Logan](https://community.asterisk.org/u/Mark_Logan)\
**Post date:** [November 6, 2008, 3:48am UTC](https://community.asterisk.org/t/voicemail-application-syntax/23948/3 "2008-11-06T03:48:51Z")

</div>

uhhh… so you mean the call answers, you dial “8” and it asks you for the mailbox you want to leave the message for?

```auto

[voicemail]
exten => _X.,1,Answer()
exten => _X.,n,Wait(1)
exten => _X.,n,Read(boxnum,vm-whichbox,4,,3,5)
exten => _X.,n,Voicemail(${buxnum})

```

Something like that? I mean, you have to adapt it for whatever nefarious use you deem suitable 😄

---

<div class="post-metadata">

**Author:** ![im822](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@im822](https://community.asterisk.org/u/im822)\
**Post date:** [November 6, 2008, 2:57pm UTC](https://community.asterisk.org/t/voicemail-application-syntax/23948/4 "2008-11-06T14:57:55Z")

</div>

Thank you for this reply. I will try the code you have given as examples.

“”“  
uhhh… so you mean the call answers, you dial “8” and it asks you for the mailbox you want to leave the message for?  
”""

You understand 99 percent of my need.

To answere your question here is what I need.

My sip client dials an 8.  
From the snippet below the asterisk server recognizes the pattern of 8.

exten =\> 8,1,VoiceMail

Then what I want the asterisk to do i ask for a mailbox number.

Then I dial 1001, or 1002, or 1003.

Then I get a prompt to leave a message in that box.

In older version of asterisk 2005 or so the snipet would work fine.

I will experiment with the ones you provided. They look very interesting. Thanks

---

<div class="post-metadata">

**Author:** ![Mark\_Logan](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Mark\_Logan](https://community.asterisk.org/u/Mark_Logan)\
**Post date:** [November 6, 2008, 3:34pm UTC](https://community.asterisk.org/t/voicemail-application-syntax/23948/5 "2008-11-06T15:34:39Z")

</div>

Oh, then you are looking for something like this:

```auto
[voicemail] 
exten => 8,1,Read(boxnum,vm-whichbox,4,,3,5) 
exten => 8,n,Voicemail(${buxnum}) 
```

So, the first line should ask for the voicemail box number and the second line should ship you to it. It should be noted that this configuration is waiting for 4 digit numbers at the read statement. If you need longer extensions, simply change the 4 to the correct length.

This is going to be the best solution I can think of because the channel variable will allow a dynamic range of inputs.

---

<div class="post-metadata">

**Author:** ![im822](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@im822](https://community.asterisk.org/u/im822)\
**Post date:** [November 6, 2008, 3:58pm UTC](https://community.asterisk.org/t/voicemail-application-syntax/23948/6 "2008-11-06T15:58:21Z")

</div>

Thanks very much this did work.

[voicemail]  
exten =\> \_X.,1,Answer()  
exten =\> \_X.,n,Wait(1)  
exten =\> \_X.,n,Read(boxnum,vm-whichbox,)  
exten =\> \_X.,n,Voicemail(${boxnum})

---

<div class="post-metadata">

**Author:** ![im822](https://avatars.discourse-cdn.com/v4/letter/i/d78d45/32.png) [@im822](https://community.asterisk.org/u/im822)\
**Post date:** [November 6, 2008, 4:08pm UTC](https://community.asterisk.org/t/voicemail-application-syntax/23948/7 "2008-11-06T16:08:46Z")

</div>

Yes this is even better.

[voicemail]  
exten =\> 8,1,Read(boxnum,vm-whichbox,4,3,5)  
exten =\> 8,n,Voicemail(${buxnum})
