Plugins
From Mms-wiki
Dan Thorson has written a plugin to run external user defined external commands and control them. You can get a preliminary version from here
Fredrik Wikström has written a feature plugin to run python scripts in mmsv2. The plugin has been included in the main distribution.
[edit] MMS-Vbox-Plugin with vboxd
Status :
First Release with bzr-revision 1536 I have to thank Arj for committing and Support on small questions - and acmelabs for the graphics and the encouragement to write this wiki.
Purpose :
The Purpose of Vbox-Plugin is to access vboxd Voicemails
Screenshots :
can be seen here
Requirements :
Client-Side (System that runs mms) :
Packages vbox, sox The vbox-Package is used to convert propriatary voicemail-Files to Sun Audio (.au) The sox-Package is used to convert Sun Audio to .wav This is done inside the Script configured in the Plugin-Config :
vbox_conv_tool = /usr/local/bin/vboxtoau-mms
Script (vboxtowav.sh)
#! /bin/bash
#
# vboxtowav.sh
# Author : L. Thielemann
# Purpose : Improve Replay of VBOX-Messages
#
LOGFILE=/tmp/mms-vbox.log
{
vboxfile=${1}
audiofile=`basename ${2} .wav`
dir=`dirname ${2}`
/usr/bin/vboxtoau <${vboxfile} > ${dir}/${audiofile}.au
/usr/bin/sox -v 4.0 -U ${dir}/${audiofile}.au -c 2 -r 44100 -s -w ${dir}/${audiofile}.wav
} 2>&1 | tee -a ${LOGFILE}
Server-Side : Packages vbox, isdn4linux The Package vbox contains vbox-clientsoftware (vbox, vboxtoau and vboxcnvt) and also the files needed for accepting Calls (vboxgetty) and the vboxd (Daemon) all Clients connect to to control the Messages.
See Documentation of Package vbox for more Details.
Configuration :
MMS-Plugin-Configuration (VBoxConfig)
### VBOX #### version = 3 # # Temporary Filename for conversion from vboxd-Format to au and wav # vbox_temp_file = /tmp/mms-vbox.wav # # Name of Script for Conversion from vboxd-Format to wav # vbox_conv_tool = /usr/local/lib/mms/vboxtowav.sh # # # Voice-Boxes Name:Host:Port:Username:Password (Multiple Entries allowed) vbox = Name:localhost:20012:username:passwd # #vbox = Name:localhost:20012:username1:passwd1
Serverside (vboxd.conf-Example)
# Login access list # # All hosts in the login access list (begins with 'L') are checked at # login (server startup) time. If access is 'yes' the host can login # and count messages without special access. # Login - Access for localhost : L:localhost:Y # Login-Access for all from 192.168.3/24: L:192.168.3.*:Y # Full access list # # All hosts in the full access list (begins with 'A') are checked if the # server gets the 'login' command. # RW-Access for user "username" with password "password" (substitute <msn>) with spool-directory for calls for that msn A:localhost:RW:username:password:/var/spool/vbox/<msn>:incoming A:192.168.3.*:RW:username:password:/var/spool/vbox/<msn>:incoming
“username” and “password” are to be set so that Entries match between both Config-Files. Additional Documentation is to be found with the vbox-Package.
Usage :
Navigate with the cursor Keys - play Message with "ACTION" and Toggle Status with "SECOND_ACTION" PG-Up, PG-Down cycle through multiple Voiceboxes - each configured in a seperate line on VBoxConfig (vbox)
--Magicamun 10:35, 27 March 2008 (CET)
[edit] MMS-Vbox-Plugin with Asterisk (Free VoIP - PBX for Linux)
(!!!! No more thinking - it's working !!!!)
Asterisk also provides means to record unanswered (but not only unanswered) Calls on a Voice-Mailbox.
The Flexibility of Asterisk is by far larger than that of vboxgetty/vboxd. Asterisk also provides a more flexible Control of what should happen with incoming and outgoing calls. Asterisk uses a Dialplan for that.
The Dialplan in Asterisk is capable of executing Commands (Shell-Scripts, Binary) at almost any stage of a Call - especially after finishing the Call. The Dialplan insinde Asterisk is a lot more powerful - but for this Scenario we only need a little feature - called "externalnotify" for Voiceboxes.
"externnotify" is a Parameter set in voicemail.conf of your asterisk -Configuration. (voicemail.conf Voicemail-Configuration) The Parameter is set to an external Application/Shell-Script which will be called every time a Voice-Message is recorded.
Asterisk calls the Script/Application with 3 Arguments : Context, Voicebox and Number of Messages in Voicebox.
The Script provided assumes that Voicemessages are recorded as WAV's and assumes certain Path-Settings for the Asterisk and vboxd-Setup. Along with the Wav-File, asterisk writes a txt-File with information about the call - this is where the Settings for autovbox are taken from.
For those of you beeing keen on how asterisk derives Names for Numbers - have a look at the dialplans and scripts provided by Ip-Phone Forum (German only - sorry - look for Rückwärtssuche or reverse-Lookup).
The Script now only converts the wav into an .au (using sox) and then converts the .au to a vboxd-Message. The File is named with the current Timestamp and Process-ID (A Format vboxd relies on)
#! /bin/bash
#
# $1 = context, $2=voicebox $3 = number of messages in vbox
#
{
astspool=/var/spool/asterisk
vboxdspool=/var/spool/vbox
echo "$# $@"
#
CONTEXT=${1}
VOICEBOX=${2}
MSG="`expr ${3} - 1 | gawk '{ printf(\"msg%04d\", $0)}'`"
#
echo $CONTEXT, $VOICEBOX, $MSG
#
dir=${astspool}/voicemail/${CONTEXT}/${VOICEBOX}/INBOX
#
name=`cat ${dir}/${MSG}.txt | gawk '
/callerid=/ {
split($0, fields, "=")
split(fields[2], cid, "<")
gsub("\"", "", cid[1])
printf("%s", cid[1]);
}
'`
phone=`cat ${dir}/${MSG}.txt | gawk '
/callerid=/ {
split($0, fields, "=")
split(fields[2], cid, "<")
gsub(">", "", cid[2])
printf("%s", cid[2]);
}
'`
#
echo $name, $phone
#
/usr/bin/sox ${dir}/${MSG}.wav /tmp/${MSG}.au
#
ext=`echo $$ | gawk '{ printf("%08d", $0) }'`
timestamp=`date +%s | gawk '{ printf("%014d", $0) }'`
vboxdfile="${timestamp}-${ext}"
#
/usr/bin/autovbox -n "${name}" -p "$phone" < /tmp/${MSG}.au > ${vboxdspool}/${VOICEBOX}/incoming/${vboxdfile}
#
rm /tmp/${MSG}.au
} >> /var/log/asterisk2vboxd 2>&1
--Magicamun 13:55, 12 April 2008 (CEST)
