📜 ⬆️ ⬇️

Integration of Asterisk and SugarCRM


Let's try to combine all this and make a convenient call center.


Initially, the task was to install CRM to work in conjunction with Asterisk to maintain a customer base and track incoming calls. VTigerCRM and SugarCRM came up with a description of the needs and the claimed availability of the merger. We didn’t have a friendship with vTiger - their module, which comes bundled with the engine, was very careless about its duties: it missed calls or showed them with a delay. In SugarCRM, on the contrary, a module called YAAI KINAMU / abcona Open Asterisk Connector works like a clock. It is not included, we will install it separately. The working principle and functionality of these CRMs is similar, so we opted for SugarCRM Community Edition . There is an excellent Russification module for this system - RUSSIAN RAPIRA LANGUAGE PACK. But I will show the setting for now without it.

I will not tell you how to install SugarCRM - there is a lot of information on the network about it. Immediately proceed to the method of integration with telephony.
')
Swing the YAAI module from here . Do not unpack. Install through the admin CRM: Admin -> Module Loader . Download, click 'Install'. Again we go into the admin panel, look for the very bottom of our module, go to the configurator. Here we need the data from the /etc/asterisk/manager.conf file of our Asterisk server. You can edit manager.conf and create a new AMI user, or use the admin account, changing the default password (if you have not already done this when installing Asterisk, then your system is at risk). Here you can specify which host is allowed to connect AMI-manager. I have 127.0.0.1 since we have CRM on the same machine. We take this data and copy it to the settings of the YAAI module: host, login, port, secret. It remains to drive a SOAP user. Let it be any CRM user with their password. The remaining settings can not touch at all.

Since the latest version of the module itself does not add to the user profile a field for entering the internal telephone, we will have to work on the interface ourselves. Go to Admin -> Studio . We are looking for the User daddy, expand the list, find Layouts, Edit View. The user edit form editor opens. Drag the first left-to-right New Panel and New Row . We impose Asterisk Extensinon, Magic Dial Buttons, Call notification on top of them. Save the view: Save & Deploy .



I hope you already have a CRM user who has his own SIP phone. We fix for his account his number. Go to Admin -> User Management. We select the user, we press Edit . From above we see the panel we created. In Asterisk Extension, enter the user's internal number and put both checkboxes: Magic Dial - to quickly call back by clicking on the icon next to the saved number (our device rings first - pick up the phone - the outgoing number is dialed) and Call Notification - a pop-up window with the caller’s number and other data .



Now you need to run a PHP script that will interact with Asterisk. Go to folder_c_SugarCRM / custom / modules / Asterisk and run:

php asteriskLogger.php 


If everything is in order, we will see the message "Waiting for events" . If errors are issued, then you need to check the settings of the asterisk manager and SOAP.

In principle, everything should work, but in order for us not to run the script all the time manually, we will make it a service.

1. Download the asterisk_logger file :

 wget https://raw.github.com/blak3r/yaai/master/misc/asterisk_logger 


or extract it from the YAAI zip archive in misc / asterisk_logger.
2. Copy it to /etc/init.d/
3. We expose the attributes:

 chmod 755 /etc/init.d/asterisk_logger 


4. Open it for editing in the editor.
- edit the path where asteriskLogger is located (usually it is / var / www / html / sugarcrm / custom / modules / Asterisk / asteriskLogger.php )
- we show the user from whom the web server is started (usually it is asterisk )
5. Install the script:
- for Centos, Red Hat, Fedora Core, Suse, etc .:

 chkconfig --add asterisk_logger 


for Debian, Ubuntu and similar:

 update-rc.d -f asterisk_logger start 80 2 3 4 5 . stop 30 0 1 6 . 


Check by running

 /etc/init.d/asterisk_logger start 


If it started, then everything was done correctly. If mistakes are made, then look further. It is likely that asterisk_logger will have to remove the newline characters ^ M. You can do this in the editor built into mc. Also, if you have CentOS 6.X, you will have to change the line with
 . /lib/lsb/init-functions 

on
 /etc/init.d/functions 

That's all. You can call and check how pop-up windows with numbers appear in CRM. True, if the number is less than four digits, it will be deselected. This behavior is configured in the YAAI module in CRM.



Pls, throw karma if someone useful article.

Source: https://habr.com/ru/post/174637/


All Articles