Archives

AsteriskC2D, Setting up the Server Side

In order to use AsteriskC2D you need to install a simple Perl script onto a webserver. Normally people pick the server Asterisk is also running on but it’s not required.

So to get started you’ll need to download the tar ball which contains two scripts, one you might already have “cgi-lib.pl” and the other you won’t “AsteriskC2D.pl”.

AsteriskC2D.tgz Version released 10th August 2009

This new version now does not require you to install perl modules you do not intend to use. Ie if you’re installing on trixbox, then you don’t need to install the LDAP module. The script will also provide human error messages when necessary modules are missing

Support for setting CallerID from the iPhone has now been included. You’ll need to install the PBXCode ##1212# to get the extra parameter on your iPhone. If you do not then original function will remain.

You need to copy them to your “cgi-bin” directory of your webserver, “/var/www/cgi-bin/” maybe. change the permissions on “AsteriskC2D.pl” so it’s world executable.
$ chmod 755 AsteriskC2D.pl

The Perl script also requires at least one perl module which might not be installed on your system, “NET::Telnet”.
$ sudo perl -MCPAN -e “install(‘Net::Telnet’);”

If you want to authenticate with LDAP then you’ll likely need this modules too.
sudo perl -MCPAN -e “install(‘Net::LDAP’);”

Use your favorite editor, vi, pico, emacs, to edit AsteriskC2D.pl to match your Environment. By default this script will use mySQL server to authenticate the users and is generally set for TrixBox.

If you would like AsteriskC2D to adjust some phone numbers in flight, ie to change + to your international dialing code etc the look around line 152, uncomment and edit the if statements to your required tastes.

# Uncomment or edit these lines to have AsteriskC2D adjust numbers on the fly.

If you’re using Asterisk 1.6 you might need to change “call,user” to be “call,user,originate” in the above lines.

That should be it. Restart Asterisk and you’re ready to try test dialing. If you’re on a unix system then you can use “curl” to test the script and it’s ability to talk with asterisk.
curl ‘http://localhost/cgi-bin/AsteriskC2D.pl’ -d ‘username=fred&password=1234&deskphone=SIP/1234&toCall=600’

If that works then try with the AsteriskC2D Mac Client. Don’t forget to look in your webserver access and error logs.