
Install SuiteCRM 7.5. Asterisk integration with Callinize - community Edition
I had to install a bundle: Asterisk + CRM + Integration. There were no problems installing Asterisk and FreePBX on Ubuntu. Great article with step-by-step instructions and pictures, even a beginner can handle it.
But when it came to installing CRM and trying to make it friendship with Aster, my hair began to fall out in shreds on my head. At first I thought this task was as simple as installing Ubuntu + Asteris + FreePBX. But after a few days I realized that there were simply no normal manuals, and even more so, there were simply no normalfree models. So the company we have is not big and there is no desire to buy anything. I had to buy pieces of different manuals, posts, articles and trial and error install and integrate CRM with Aster.
I chose from 3 (Sugar, Tigris and Suite) and decided on SuiteCRM (the rest did not pass the test for strength and compatibility with the integration modules with Aster).
In this article, I actually want to share the experience of installing and integrating SuiteCRM with Asterisk. Anyone who has already installed SuiteCRM, and it works successfully, we can safely scroll through the installation part and proceed with integration .
We open the terminal and connect to our Ubuntu Server as root.
1. First, go to the html directory (for example, I have / var / www / html, but you may have a different one):
2. Download the archive with the latest version of CRM (at the time of writing this article it was 7.5):
3. Unpack the archive:
4. Rename the directory (for convenience, so as not to write then a long address in the browser line):
5. Assign the rights to the new directory:
6. Open the our_server / crm page in the browser and proceed with the configuration.
7.Read and agree to the license agreement, click Next:

8. Take a couple of sips of tea and eat one cookie until the system checks the “soil” on which it will grow.

9. CRM checked everything and everything suits her. Click Next:

If swears on the IMAP Module, then just install it:
10. Fill in all the necessary fields:

If you want the demo data in CRM immediately, then Choose Demo Data -> Populate Database with Demo Data? -> Yes.
11. We go to finish the tea and finish the cookies until the system installs and sets everything up:

12. The system is installed and ready to go . We enter the logs and password of the main administrator and make Log In:

13. Hurray. The system is working. Then we smoke guides how to use it.
Let's move on to the stage that my brain blew for several days.
I will say right away that there isno free solution to this problem “out of the box”. I spent several days trying all CRMs in combination with all available free integration modules: all variations are not working. Some I tried to finish with my hands, some I deleted right after installation. In general, I was actually going to write this article in order to save someone time and nerves.
I had the following tasks: It is necessary that from CRM it was possible to call directly from the browser window with one click of the mouse. So that when making a call (incoming / outgoing), CRM immediately displays a client card with the necessary information in the browser window. All this had to be done to facilitate the work of the sales of my company.
I opted for it (or rather I didn’t stop the choice, and found out by trial and error that this was the most working option) on Callinize - community Edition. I don’t know if it is possible to download the free version from their website , I didn’t find it. Somewhere in the wilds of the web, I came across OpenSource yaai-Callinize and downloaded it. I don’t remember where I downloaded it, and in order to get the package on SuiteCRM, I had to finish it a bit.
So: “scalpel, sister, let's get started”:
1. Download the module from here ;
2. Go to our CRM and go to the Administrator -> Admin -> Module Loader section;
3. Select the module file that you downloaded and click Upload;
4. When the file is downloaded and displayed in the bottom window, click Install on our module:

5.Read and accept the agreement and click Commit:

6. We wait until the module is installed and click Back to Module Loader:

This was all a hint, but now the most juice - we need to make friends all at once Asterisk, CRM and Yaai.Thanks to Habr for banning the use of profanity in articles, otherwise I would just write what I think about all the developers of the module!
1. Let's create the Aster manager, under which our module will work, for this we’ll edit manager.conf:
Then restart Asterisk so that it reads the new settings:
2. Next, configure our module. We go to the browser window with our CRM and open Administratir -> Admin -> scroll to the very bottom, find the “Callinize - Asterisk SugarCRM Integration” section and click on “Module Configuration”:

3. Enter the username and password of the manager:
Asterisk Manager Login - yaai
Asterisk Manager Secret - the password that you specified in manager.conf
AND SOAP:
SugarCRM Soap-User - admin
SugarCRM Soap-Pass - the password that you specified for the super administrator when installing SugarCRM We
do not touch the rest of the values, click Save:

4. Go to Administratir -> Admin -> Studio.
Section Modules scroll down. We find the “User” folder, open it, open the “Layouts” folder, click on “EditView”. In the right window, a user settings template will open, in which we will have to add something:
First, drag “New Panel”, throw “New Row” on it. Then we drag 3 values to the fields (filler): Personal Extension, Magic Dial Buttons, Call Notification. Click Save & Deploy. It should work like this:

5. Go to Administratir -> Admin -> User Manager.
We click on the user (I will configure Administrator), in the window that opens, click Edit. We will see that the panel that we added in step 4 now appears here and you can fill in the fields. In the Personal Extension (s) field, enter the internal number of the user (I hope that in FreePBX you already created the Extension that you want to assign to the user in SuitCRM, for example, I already have the internal number 1001, I will assign it to Administrator). We put daws Magic Dial Buttons, Call Notification and click Save:

And here is the first jamb. I don’t know why, but the first time you save the settings, the CRM menu disappears. We will treat this by editing CSS code.
The menu was treated.
6. Open the terminal and run the script:
If your script at the end displays the following "Waiting for call events ...":
Then you did everything right.
If errors climb, it means that somewhere you did not carefully read / follow the instructions!
7. Let's check. In our CRM, create a contact, for example, Markenig -> Contacts -> Create. Fill in the First Name, Last Name, and most importantly Office Phone - here we write the phone number to which we will now call to test outgoing calls from CRM. Click Save:

8. And here's what we see:

Click on the green tube and - lo and behold ! - our internal phone rings, after we pick up the phone, the Asterisk will ring the number that was near the green tube and connect us. Hurrah. Outbox work.
BUT! We do not have a pop-up customer card when making a call. It should appear in the CRM window with an outgoing / incoming call and display information about the counterparty. We will treat it. Because we really need this “trick”.
So, first we need to download handlebars.runtime.js:
Now we will edit callPopups.js:
All is ready. Windows appear, calls are coming. Now configure autostart asteriskLogger.php:
Edit asterisk_logger:
Check:
If all is well and errors do not climb, enable autoload:
But when it came to installing CRM and trying to make it friendship with Aster, my hair began to fall out in shreds on my head. At first I thought this task was as simple as installing Ubuntu + Asteris + FreePBX. But after a few days I realized that there were simply no normal manuals, and even more so, there were simply no normal
I chose from 3 (Sugar, Tigris and Suite) and decided on SuiteCRM (the rest did not pass the test for strength and compatibility with the integration modules with Aster).
In this article, I actually want to share the experience of installing and integrating SuiteCRM with Asterisk. Anyone who has already installed SuiteCRM, and it works successfully, we can safely scroll through the installation part and proceed with integration .
Install SuiteCRM
We open the terminal and connect to our Ubuntu Server as root.
1. First, go to the html directory (for example, I have / var / www / html, but you may have a different one):
cd /var/www/html
2. Download the archive with the latest version of CRM (at the time of writing this article it was 7.5):
wget https://github.com/salesagility/SuiteCRM/archive/v7.5.tar.gz
3. Unpack the archive:
tar zxvf v7.5.tar.gz
4. Rename the directory (for convenience, so as not to write then a long address in the browser line):
mv SuiteCRM-7.5 crm
5. Assign the rights to the new directory:
chmod -R 775 crm
chmod -R a+wr crm
6. Open the our_server / crm page in the browser and proceed with the configuration.
7.

8. Take a couple of sips of tea and eat one cookie until the system checks the “soil” on which it will grow.

9. CRM checked everything and everything suits her. Click Next:

If swears on the IMAP Module, then just install it:
Installation
sudo apt-get install php5-imap
sudo php5enmod imap
sudo service apache2 restart
10. Fill in all the necessary fields:

If you want the demo data in CRM immediately, then Choose Demo Data -> Populate Database with Demo Data? -> Yes.
11. We go to finish the tea and finish the cookies until the system installs and sets everything up:

12. The system is installed and ready to go . We enter the logs and password of the main administrator and make Log In:

13. Hurray. The system is working. Then we smoke guides how to use it.
Let's move on to the stage that my brain blew for several days.
Asterisk integration with Callinize - community Edition
I will say right away that there is
I had the following tasks: It is necessary that from CRM it was possible to call directly from the browser window with one click of the mouse. So that when making a call (incoming / outgoing), CRM immediately displays a client card with the necessary information in the browser window. All this had to be done to facilitate the work of the sales of my company.
I opted for it (or rather I didn’t stop the choice, and found out by trial and error that this was the most working option) on Callinize - community Edition. I don’t know if it is possible to download the free version from their website , I didn’t find it. Somewhere in the wilds of the web, I came across OpenSource yaai-Callinize and downloaded it. I don’t remember where I downloaded it, and in order to get the package on SuiteCRM, I had to finish it a bit.
So: “scalpel, sister, let's get started”:
Module installation
1. Download the module from here ;
2. Go to our CRM and go to the Administrator -> Admin -> Module Loader section;
3. Select the module file that you downloaded and click Upload;
4. When the file is downloaded and displayed in the bottom window, click Install on our module:

5.

6. We wait until the module is installed and click Back to Module Loader:

This was all a hint, but now the most juice - we need to make friends all at once Asterisk, CRM and Yaai.
Setting up our module
1. Let's create the Aster manager, under which our module will work, for this we’ll edit manager.conf:
nano /etc/asterisk/manager.conf
добавим в файл эти строки и сохраним файл
[yaai]
secret = пароль_менеджера_yaai
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = all
; ^--- on some systems you can get away with just "call,hud"
write = originate,system,call
Then restart Asterisk so that it reads the new settings:
asterisk -rx "module reload manager"
2. Next, configure our module. We go to the browser window with our CRM and open Administratir -> Admin -> scroll to the very bottom, find the “Callinize - Asterisk SugarCRM Integration” section and click on “Module Configuration”:

3. Enter the username and password of the manager:
Asterisk Manager Login - yaai
Asterisk Manager Secret - the password that you specified in manager.conf
AND SOAP:
SugarCRM Soap-User - admin
SugarCRM Soap-Pass - the password that you specified for the super administrator when installing SugarCRM We
do not touch the rest of the values, click Save:

4. Go to Administratir -> Admin -> Studio.
Section Modules scroll down. We find the “User” folder, open it, open the “Layouts” folder, click on “EditView”. In the right window, a user settings template will open, in which we will have to add something:
First, drag “New Panel”, throw “New Row” on it. Then we drag 3 values to the fields (filler): Personal Extension, Magic Dial Buttons, Call Notification. Click Save & Deploy. It should work like this:

5. Go to Administratir -> Admin -> User Manager.
We click on the user (I will configure Administrator), in the window that opens, click Edit. We will see that the panel that we added in step 4 now appears here and you can fill in the fields. In the Personal Extension (s) field, enter the internal number of the user (I hope that in FreePBX you already created the Extension that you want to assign to the user in SuitCRM, for example, I already have the internal number 1001, I will assign it to Administrator). We put daws Magic Dial Buttons, Call Notification and click Save:

And here is the first jamb. I don’t know why, but the first time you save the settings, the CRM menu disappears. We will treat this by editing CSS code.
nano /var/www/html/crm/custom/modules/Asterisk/include/css/asterisk.css
ищем блок ".dropdown-menu LI" и убираем "display: none; "
The menu was treated.
6. Open the terminal and run the script:
cd /var/www/html/crm/custom/modules/Asterisk
php asteriskLogger.php
If your script at the end displays the following "Waiting for call events ...":
[Asterisk Manager Interface (AMI) Connection]
Successfully opened socket connection to 127.0.0.1:5038
AMI Version Info:
```
Asterisk Call Manager/2.8.0
```
AMI Login action raw response:
```
Response: Success
Message: Authentication accepted
```
AMI Login was a *success!*
Waiting for call events...
Then you did everything right.
If errors climb, it means that somewhere you did not carefully read / follow the instructions!
7. Let's check. In our CRM, create a contact, for example, Markenig -> Contacts -> Create. Fill in the First Name, Last Name, and most importantly Office Phone - here we write the phone number to which we will now call to test outgoing calls from CRM. Click Save:

8. And here's what we see:

Click on the green tube and - lo and behold ! - our internal phone rings, after we pick up the phone, the Asterisk will ring the number that was near the green tube and connect us. Hurrah. Outbox work.
BUT! We do not have a pop-up customer card when making a call. It should appear in the CRM window with an outgoing / incoming call and display information about the counterparty. We will treat it. Because we really need this “trick”.
So, first we need to download handlebars.runtime.js:
cd /var/www/html/crm/custom/modules/Asterisk/include/javascript/
wget http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars.min-latest.js
mv handlebars.min-latest.js handlebars.runtime.js
Now we will edit callPopups.js:
nano callPopups.js
находим строку template = Handlebars.templates['call-template.html'];
и заменяем ее на
var source = '{{title}}-->{{call_type}}
{{select_contact_label}}{{#each beans}}{{/each}} {{name_label}} {{bean_name}} --> {{company_label}} {{parent_name}} {{caller_id_label}}: {{caller_id}} {{phone_number_label}}: {{phone_number}} {{duration_label}}: {{duration}} -->{{call_time_label}}:-->-->{{call_time}}-->-->-->
';
var template = Handlebars.compile(source);
All is ready. Windows appear, calls are coming. Now configure autostart asteriskLogger.php:
wget https://raw.github.com/blak3r/yaai/master/misc/asterisk_logger
mv asterisk_logger /etc/init.d/
chmod 755 /etc/init.d/asterisk_logger
chmod 755 /etc/init.d/functions
Edit asterisk_logger:
nano +34 /etc/init.d/asterisk_logger
ищем строку . /lib/lsb/init-functions и заменяем ее на /etc/init.d/functions
Check:
/etc/init.d/asterisk_logger start
If all is well and errors do not climb, enable autoload:
chkconfig --add asterisk_logger
chkconfig asterisk_logger on