On the picture above you can see our
extensions.conf file.
In our example when somebody dials
5454, the call will be answered by the
Answer application. The next executed extension will be the one which contains the
Dial application. It will try to connect the user
anatoliy through the
IAX2 channel.
We will use the
GoToIf application to determine the dial status of the call. For the purpose we need also the variable
${DIALSTATUS}. The first extension after the one with
Dial application, will check whether the called person is available.
If the person is unavailable, then the execution will continue with the extension with priority
7. This extension contains the
VoiceMail application. In its brackets we have set the following:
uanatoliy@testmail. The first letter -
u means that a message for an
unavailable condition has to be played. The message by default is:
The person at extension is unavailable". The word
anatoliy is for the mailbox which we have set in the
voicemail.conf. The last part is
@testmail. This shows the context in
voicemail.conf, in which the mailbox
anatoliy is configured.
So, the caller will hear a message and he/she will be allowed to record a message and to store it in the mailbox of
anatoliy. The message will be stored in the directory
/var/spool/asterisk/voicemail/testmail/anatoliy/INBOX. In order to send the message in the mailbox, the caller has to hang up the line or to press the pound key(
#), when he/she finishes with the recording of the message.
If the
GoToIf check show that the user is
available, then the next application with priority
4 will be executed. This one will check, whether the line is busy or not.
If the line is busy, then the execution will continue with the extension with priority
9. This extension contains again the
VoiceMail application. In its brackets we have set the following:
banatoliy@testmail. The first letter -
b means that a message for
busy condition has to be played. The message by default is:
The person at extension is on the phone. The word
anatoliy is for the mailbox which we have set in the
voicemail.conf. The last part is
@testmail. This shows the context in
voicemail.conf, in which the mailbox
anatoliy is configured.
The caller will hear the message, that the called person is busy and
he/she will be allowed to record a message and to store it in the
mailbox of
anatoliy. The message will be stored in the directory
/var/spool/asterisk/voicemail/testmail/anatoliy/INBOX. In order to send the message in the mailbox, the caller has to hang up the line or to press the pound key(
#), when he/she finishes with the recording of the message.
Now, if the user is available and the line is free and the called person does not answer within
5 seconds, the next executed extension will be the one with priority
5. This one contains another copy of the
VoiceMail application.
As arguments in its brackets we have set the following:
anatoliy@testmail. There is no first letter which means that a message with instructions has to be played. The message by default is:
Please leave your message after the tone. When done, hang up, or press the pound key. The word
anatoliy is for the mailbox which we have set in the
voicemail.conf. The last part is
@testmail. This shows the context in
voicemail.conf, in which the mailbox
anatoliy is configured.
Again the user will be allowed to record a message after the signal. The message will be stored in the directory
/var/spool/asterisk/voicemail/testmail/anatoliy/INBOX. In order to send the message in the mailbox, the caller has to hang up the line or to press the pound key(
#), when he/she finishes with the recording of the message.
NOTE: Please, pay attention that between the option flags and
the voicemail number there is no separator. That is why the voicemails
cannot start with "s", "u", "b" or any combination of these three
letters.
Maybe you have noticed that between the extensions with priority
5,
7 and
9, we have extensions with the
GoTo application. It cause the jumping to the last extension with priority
10 which has the
Hangup application. Thanks to it the line will be hung up. This is necessary, because otherwise the three
VoiceMail application will be executed subsequently. In this way the effect from the
GoToIf applications will be lost.