I started to code a few routines to fix the MWI notice on the phones for my clients. I was having a real hard time finding any documentation about turning that little light on without digging into a complex SIP protocol manual. This problem seems to be fixed on the newer version of Asterisk, but not all clients are on the same versions. I noticed on my newer install that about every 5 to 6 minutes a pass is made and the MWI indicator is set or reset as needed. This is great for the newer installs, but what about the older stable ones that sometimes don’t get the MWI notice?
I’m finally releasing three routines that should take care of any of your MWI problems. The three programs are to set the MWI by extension number, reset the MWI by extension number and fix all phones that have voicemail accounts (Set or Reset based on voicemail). Let’s continue on….press read more...
Want to drive a person crazy? Turn on their light for a second or two and then it off again. These routines are tested on Cisco phones but will work on every phone since this is sending a SIP notice to an IP not a specific phone. These routines should be run on the server the phones are registered to.
I have no idea if the required utility program is on your server so at the prompt you should check and see if sipsak is installed. I use sipsak to execute the files I create in my script. On the servers I checked it was already installed (/usr/local/bin).
About the coding:
Remember, I do not have the SIP protocol manual or any manual discussing SIP packets. I only deciphered most of it from the SIP commands I captured. That being said, I noticed that in order to send an MWI packet, I would need specific information about the host as well as the destination phone.
In my routines ‘setmwi’ and 'clearmwi' I expect only the extension of the SIP phone to set. I make the assumption that the script is running on the server that the phone is registered to. This is because I need to know the servers IP, Realm and the Asterisk User Agent. I also need the ip address of the phone whose extension you want to set. I obtain this information in my script by using the hostname command and Asterisks SIP show commands. The set and clear MWI programs have a few things hard coded which are derived at in the ‘fixallmwi’ script such as the message count (1/1). In the important routine, ‘fixallmwi’, I scan every voicemail message folder on the hard drive and compare this to the voicemail in Asterisks database before continuing any other calculations. If this folder is for a valid voice mail account then I calculate the number of messages in the inbox and oldmail folders for passing the correct count to the SIP command. The count on the inbox determines if the MWI is set or reset. Additionally, I calculate the proper message length by totaling various strings that are passed. This is so the full message is received regardless of what you named your server or the string size of your servers IP address (10.0.0.1 vrs 192.168.254.253) The only two pieces of information which are not calculated are the tag and the Call-ID. Neither of these parameters seems to matter when setting the MWI state. Installation:
The files are in the download area. They are released under the GNU GPL Just move them to /usr/local/bin where sipsak should be. Set the execute permissions on the files and set a cron job to execute the script fixallmwi every few minutes. Summary:
Did I waste my time? Is this just another way to have fun? Should I try and send a SIP MWI packet to your phone (send me the phone and server IPs, I'll blink your light every few minutes for an hour or so...)? There are many playful possibilities but this answers a need for installations that have problems with the MWI lights. So if this helps you drop me a line. Paul Norris
|