|
So, I did a fresh install from Asterisk on a server, then configured some SIP users and connected Snom phones for each one of them. Then, as I was testing, I noticed that the "Mail" button on the Snom phones dialed an extension "asterisk". So I couldn't get around dialing the general voicemail extension in order to check my mail. Anyway, there are a few solutions to this problem. One of them is including the option "vmexten" for each user, either in sip.conf or in users.conf. The problem with this approach is that any other user can dial any existing "vmexten" value and, given that he/she knows the password for this voicemail, access the mailbox. So, in order to solve this problem a collegue told me that it was perhaps a good idea to use the "asterisk" extension. Here is how I did it. In the file "extensions.conf" I performed the next changes: ; ; *First thing is defining an ew context for the voicemail* [voicemail] exten = asterisk,1,NoOp(This extension takes us to check the voicemail) exten = asterisk,n,NoOp(Caller ID : ${CALLERID(num)}) exten = asterisk,n,NoOp(Channel Type : ${CHANNEL(channeltype)}) exten = asterisk,n,GotoIf($[ "${CHANNEL(channeltype)}" = "SIP" ]?asterisk-sip,1) exten = asterisk,n,GotoIf($[ "${CHANNEL(channeltype)}" = "IAX2" ]?asterisk-iax,1) exten = asterisk-sip,1,NoOp(SIP Name : ${SIPCHANINFO(peername)}) exten = asterisk-sip,n,NoOp(Mailbox : ${SIPPEER(${SIPCHANINFO(peername)}|mailbox)}) exten = asterisk-sip,n,Macro(voicemail-general|${SIPPEER(${SIPCHANINFO(peername)}|mailbox)}) ; *Now, there's no IAXCHANINFO on asterisk 1.2 - 1.4. But it will work if you have an IAX2 client* ; *that supports entering voicemail login info. (like voix phone)* exten = asterisk-iax,1,NoOp(IAX automatic voicemail is not yet supported) exten = asterisk-iax,n,Macro(voicemail-general) ; *Second thing is definig a Voicemail Macro.* ; *Think of this macro as of a function which performs a login for the voicemail.* [macro-voicemail-general] ; ${ARG1} = User's mailbox ; *If the SIP 12 has the mailbox 30, then ${ARG1} = 30.* ; *But don't worry, this parameter is already given by the "asterisk" context previously defined.* ; Set the language for the voicemail message. exten = s,1,Set(CHANNEL(language)=de) exten = s,n,Answer() exten = s,n,GotoIf($[ ${ISNULL(${ARG1})} ]?s-null,1) ; *In my case I had to put this wait in order for the greeting message to play completely.* exten = s,n,Wait(1) exten = s,n,VoiceMailMain(${ARG1}) exten = s,n,Hangup() ; *The extension s-null is called when ${ARG1} is empty* ; *In this case, we call VoiceMailMain withouth parameters and, if the client, say voix phone,* ; *has the voicemail login data configured, it will pass it automatically to asterisk.* ; *It may well be that you don't need the "Wait()" here* exten = s-null,1,Wait(1) exten = s-null,n,VoiceMailMain() exten = s-null,n,Hangup() ; *Finally, I included the "voicemail" context on the default context for my users.* [default] include = voicemail ...
So that's it... I hope you find it useful.
Happy coding. :) |