I updated my FreeSWITCH svn tree the other day and was surprised how much had changed. The configuration structure was completely rearranged. I had to start from scratch. Lots of new goodies, though.
My VoIP provider has their own voicemail system that kicks in after 20 seconds, there doesn’t appear to be a way to turn it off. I want to use my own voicemail using FreeSWITCH, so I’ve got to answer the call before 20 seconds are up.
First thing I needed was some sounds. There’s some prerecorded sounds available via make sounds-install, except it doesn’t work in trunk at the moment. They are easily downloaded manually, though. I chose http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.pre3.tar.gz and http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.pre3.tar.gz
Unpack the files in /usr/local/freeswitch/sounds/. I found that FreeSwitch was looking for the sounds in (for example) /usr/local/freeswitch/sounds/en/us/callie/voicemail/ but the sounds unpacked to en/us/callie/voicemail/8000/. So I went through every 8000/ directory and moved the sound files to the parent.
Check in conf/autoload_configs/modules.conf.xml that mod_voicemail is being loaded. There’s a few things to edit in conf/autoload_configs/voicemail.conf.xml, the main one being the storage-dir. I created a directory /usr/local/freeswitch/vm and set <param name=”storage-dir” value=”/usr/local/freeswitch/vm”/>. The only other thing that really needs setting is email-from. I haven’t setup email yet.
Now we just need a dialplan to send unanswered calls to voicemail
<extension name=”public_did”>
<condition field=”destination_number” expression=”^(5551212)$”>
<action application=”set” data=”call_timeout=18″/>
<action application=”set” data=”continue_on_fail=true”/>
<action application=”set” data=”hangup_after_bridge=true”/>
<action application=”bridge” data=”sofia/switch.gruntnet/1000,sofia/switch.gruntnet/1001″/>
<action application=”answer”/>
<action application=”voicemail” data=”default $${domain} 1000″/>
</condition>
</extension>
In this plan, when someone calls 5551212 (that’s the number my VoIP provider sends calls to) we set the timeout to 18 seconds, so if it’s not answered before then, it goes to voicemail.
continue_on_fail means if the bridge fails for whatever reason, one being no one answered it, continue processing the rest of the plan so the call goes to voicemail.
hangup_after_bridge means if someone answered the phone within the 18 seconds, then stop processing the rest of the plan when the call terminates, ie, don’t send it to voicemail.
I’m sending the call to two phones in parallel, 1000 and 1001. If neither of them pickup the call, FreeSWITCH answers the call, and launches the voicemail application, sending the call to voicemail box 1000
I commented out <param name=”vm-email-all-messages” value=”true”/> in conf/directory/default/1000.xml because I haven’t setup email yet. Plus if you do enable that option, the messages aren’t saved on FreeSWITCH, they get emailed and deleted.
The only other thing left to do is call 1000 from 1000 to access voicemail, and setup a greeting
Annoyingly my Nokia E65 doesn’t appear to subscribe to new message notification. So I’m going to have to setup some sort of email/sms solution later to alert me of new messages