Asterisk

From Freelock Knowledge Base

Jump to: navigation, search

Asterisk @ Home, the latest 1.3 version, installed very cleanly and pretty much worked out of the box. We gave it a static IP address in our DHCP conf, and had to edit /var/www/html/panel/op_server.cfg to get the Flash panel to work using the assigned host name.

Contents

[edit] Install notes

  • edit /var/www/html/panel/op_server.cfg:
manager_host
web_hostname
security_passcode = passw0rd


[edit] Customize weather

Configuration is in a Perl script: /var/lib/asterisk/agi-bin/weather.agi. Change:

9   my $custpath = "city/wa";
10  my $filename = "seattle.txt";
14  $AGI->exec('AGI',"festival-weather-script.pl|\"The latest weather forecast for Seattle. Press 1 to skip ahead.\"");


[edit] SugarCRM integration

Asterisk @ Home comes with a modified version of SugarCRM, complete with a custom call-back system. To make it work, you use the "My Account" link in Sugar to set up your extension, and then follow the "[Call]" links that are added to each phone number in the system.

A custom "callme.php" script retrieves the customer record and selected phone number from the database, initiates a call to your extension, and connects it with the number.

For this to work, your extension needs to be a valid channel. For an internal extension, for example, mine, the extension looks like this:

SIP/20

For an external number, the extension needs to be the type, outgoing context to use, and number. To call back a land line, for example, use:

IAX2/jnctn_out/12065551212

The outgoing number, naturally, needs to be formatted according to the dialing rules in Asterisk, which in our installation means a full 11-digit number beginning with a 1 for US numbers. The script is smart enough to filter out spaces, periods, brackets, parentheses, etc.

[edit] Integration notes

We've done a (very) preliminary analysis of the Sugar integration, mainly because we already have a more up-to-date installation of Sugar on another server. It's going to be much better for our needs to keep Sugar where it is, and add the appropriate integration to get the call-back feature to work.

We really don't know that much about how to do call-me types of scripts, but here's are first assessment of what's going on:

/crm/callme.php - takes an account GUID, and a type. The type identifies which phone number in the customer record to use:

0 - Office phone
1 - Mobile
2 - Home

The account GUID is passed in a "record" GET variable, and is looked up directly in the customer table.

The extension is found from a registered user session, by looking up in the user table. Based on the extension and the phone number, the callme.php script creates an asterisk manager object and uses the Originate method to make the call.

The Asterisk manager object is part of phpagi. This class file, obviously, needs to be included.

To do this remotely, presumably we just set the Asterisk manager to find the Asterisk server, and set the Asterisk server to accept the request from our CRM server.


Next piece is the [Call] links. Looking for these now...


[edit] SugarCRM Field customization

We've added a custom "Extension" field. We named it "Extension", added it to both the User and Employee modules, which appear to be the same thing. The back end added it to a user_cstm table, adding an "extension_c" field, associating it with an "id_c" field.

We then added it to User and Employee List, Detail, and Form views. It all works beautifully, except for there appears to be a bug adding it to the Employee list--we got the label but not the data.

Behind the scenes, we can now get the extension with this query:

SELECT Extension_c FROM user_cstm WHERE id_c = '$_SESSION["authenticated_user_id"]'
Personal tools