Skip to main content

Example Email Conference Control

About

by excelsio 2010.04.20 (ancient)

Currently we have a nice script Examples_JavaScript_Conference_IVR for setting up a publicly available conferencing system.

Unfortunatelay I haven´t seen any possibility for my users to create their own conferences. In the following I´ll show some hints for setting up a kind of basic email based remote control for the IVR based conference mentioned above. Users from your given domain will write an email with subject ADD and a body consisting of the triplet: conf_room mod_password conf_name This will finally add an entry to your MySQL database.

Features

ADDing a conference room entry

Issues

  • no checking whether there´s already a conference room with the given number. So the entries in you database will be overwritten by the next email with the same conf_room name
  • no EDIT of conference rooms
  • no DELETE of conference rooms

Email Example

If you want to set up a conference room with number 10000, moderator password of 123456 and name Conference, your users will have to write an email with:

Subject: ADD
Body: 10000 123456 Conference

Procmail Configuration

Everything that comes from my mail server, having an email address ending within mydomain.com and subject ADD will be parsed to the insert script which will itself make some modifications on the database called freeswitch. Look at the "b" of :0b*. This will forward only the body of the email. The rest, i.e. :0: will be thrown away. This will be your .procmail.rc

PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin:.
MAILDIR=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
LOGFILE=$MAILDIR/procmail.log

:0b*
* ^Received:.*mydomain.com
* ^From:.*mydomain.com
* ^To: conferencecontrol@mydomain.com
* ^Subject: ADD
|/usr/src/insert | mysql -uYOUR_DB_USER -pYOURPASSWORD freeswitch

:0:
/dev/null

Insert script

This is written with the help of awk.

#!/bin/awk -f

BEGIN {
FS=" "
}
{
if (length($0) == 0) next

if (NF != 3) {
print "error line: "NR
exit
}

do {
printf ("insert into freeswitch.conferences (conf_room, mod_password, conf_name) VALUES (" $1 ", " $2 ", " $3 ")\n");
} while (true)
}

Fetchmail configuration

This will download the emails with POP3 protocol from your provider. So this will be your .fetchmail.rc Change owner from .fetchmailrc with chown fetchmail ./fetchmailrc

poll pop.mydomain.com with proto POP3
user "conferencecontrol@mydomain.com" there with password "YOURPASSWORD is "YOURLOCALUSERWITHTHE.configFILES" here
mda "/usr/bin/procmail -d %s"

Crontab

Finally crontab will automatically run fetchmail every minute:

0-59/1 * * * * /usr/bin/fetchmail -av