Sunday, June 1, 2008

Asterisk Dialer

Once you have an Asterisk based VoIP PBX (for example TrixBox) running for more than one hour, you will have a great need for a possibility to dial directly from Office Outlook. You might also know this as TAPI for Asterisk.

I have tested several options and programs that allow you to do this, and the best I found so far is the Asterisk Outlook Dialer (Freeware!).

It contains of a small PHP file you install on the Asterisk server and a local extension that integrates into Office Outlook (tested successfully with Office Outlook 2007). Entering a number into the box and hitting Dial will call the PHP file which in turns informs Asterisk to call your phone and connect you.

You only need to change the PHP file (originate.php) to include a context, username and password that can perform the actions on Asterisk. For example:

$sContext = "from-internal";

$Password = "D1QdC1xbkJ";

Once you have installed the extension, you need to configure it directly in Outlook using Tools -> Options -> Asterisk Dialer

The only glitch I have found was that non numeric chars inside the number (e.g. “+49..”) will cause the call to fail. Therefore you should patch the PHP file a little bit more.

Replace the part where you need to enter the context, username and password with the following:

//Number patching
$sNumber = preg_replace("/[^\+0-9]/", "", $sNumber);
$sNumber = str_replace("+49", "00", $sNumber);
$sNumber = str_replace("+", "000", $sNumber);
//User information
$sContext = "from-internal";
$Password = "D1QdC1xbkJ";

This line will strip out any chars that are not either numbers or the “+” sign. That way a number like “+49 (6232) 3987-x312” will become “+4962323987312”.

The next two lines will change the number as required by the backend PBX. A call from Germany to Germany needs to be initiated with “00”, a call to any other country needs to be initiated with “000”. You might need to change these two lines to meet your requirements.

In case you wish to mass deploy this extension, simply perform a normal installation on a given computer and enter the URL of the PHP file directly inside the setup (e.g. Once setup has finished, copy “AsteriskDialer.dll” and “AsteriskDialer.ini” to any network folder. Inside that folder create a batch file with the following content:

md "%ProgramFiles%\AsteriskDialer"

copy "%~dp0AsteriskDialer.dll" "%ProgramFiles%\AsteriskDialer" /Y
copy "%~dp0AsteriskDialer.ini" "%ProgramFiles%\AsteriskDialer" /Y

regsvr32.exe "%ProgramFiles%\AsteriskDialer\AsteriskDialer.dll" /s

reg add HKLM\Software\AsteriskDialer /v IniFilePath /t REG_SZ /d "%ProgramFiles%\AsteriskDialer\AsteriskDialer.ini" /f

And that’s it!

No comments:

Post a Comment