Skip to content

Commit

Permalink
Merge branch 'suitecrm-updates'
Browse files Browse the repository at this point in the history
  • Loading branch information
serfreeman1337 committed Jun 16, 2021
2 parents bb6b715 + bf20f44 commit 2569e06
Show file tree
Hide file tree
Showing 42 changed files with 2,006 additions and 1,063 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Sergey D.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
107 changes: 26 additions & 81 deletions README_suitecrm.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,86 +6,23 @@ Features:
* Forwarding calls to assigned user.

## Basic setup
First of all, you need to setup V8 API in SuiteCRM. Follow [this](https://docs.suitecrm.com/developer/api/developer-setup-guide/json-api/#_before_you_start_calling_endpoints) guide (The "Before you start calling endpoints" part).

* There might be problems with contact search. See pull request [#8492](https://github.com/salesagility/SuiteCRM/pull/8492) for solution.
* You might get **404 API error**, if you are using SuiteCRM with **php-fcgi**. See pull request [#8486](https://github.com/salesagility/SuiteCRM/pull/8486) for solution.

Log calls for "Calls" module.

* Add new fields for Calls module
* Administrator -> Studio -> Calls -> Fields
* New fields:
| Data Type | Field Name | Display Label | Max Size |
|-----------|------------------------|---------------|----------|
| Integer | asterlink_call_seconds | s. | 2 |
| TextField | asterlink_did | DID | 32 |
| TextField | asterlink_uid | Asterisk UID | 64 |
| Phone | asterlink_cid | CallerID | 32 |
* Add new fields for Users module:
* Administrator -> Studio -> Calls -> Fields
* New fields:
| Data Type | Field Name | Display Label | Max Size |
|-----------|------------------------|---------------------|----------|
| TextField | asterlink_ext | Asterisk Extension | 64 |
* Optional: display seconds for call duration in detail view.
Set `customCode` for `duration_hours` in **custom\modules\Calls\metadata\detailviewdefs.php**:
```php
{$fields.duration_hours.value}{$MOD.LBL_HOURS_ABBREV} {$fields.duration_minutes.value}{$MOD.LBL_MINSS_ABBREV} {$fields.asterlink_call_seconds_c.value}{$MOD.LBL_ASTERLINK_CALL_SECONDS} 
```
If this file doesn't exist, click **save & deply** on Calls DetailView layout in studio.
* Download [suitecrm-asterlink-module.zip](https://github.com/serfreeman1337/asterlink/releases/latest/download/suitecrm-asterlink-module.zip) archive from the releases page.
Or create this archive by your own from the contents of the [connect/suitecrm/suitecrm-asterlink-module](https://github.com/serfreeman1337/asterlink/tree/master/connect/suitecrm/suitecrm-asterlink-module) folder.
* Upload and install this module on the **Module Loader** SuiteCRM Administrator page.
* Configure `Token` on the **AsterLink Settings** SuiteCRM Administrator page.
Token must be equal with the one in **conf.yml** file.
* Optional: display seconds for call duration in detail view:
Click `Add seconds to call duration view field` on the **AsterLink Settings** SuiteCRM Administrator page.
* Update layouts as you want.
* Set `asterlink_ext` in users profiles.
* Create new **Client Credentials Client** in Administrator -> OAuth2 Clients and Tokens
* Configure token ID and Secret in **config.yml**
* Do a test run. You should see userids from suitecrm in console.

You need to restart asterlink app evertime you change `asterisk_ext` for users.
* Set `Asterisk Extensions` in users profiles.
* Do a test run of asterlink app. You should see userids from suitecrm in console.

### Call record relationships
See `relationships` key in config.
```yml
relationships:
-
module: Contacts
module_name: Contact
primary_module: false
show_create: true
name_field: full_name
phone_fields: [phone_mobile, phone_work]
-
module: Prospects
module_name: Target
primary_module: true
show_create: false
name_field: full_name
phone_fields: [phone_mobile, phone_work]
relate_once: false
```
* `relationships` - modules to search for records in. Define every new module as shown in config example
* `module` - SuiteCRM Module ID
* `module_name` - module name, that will show on popup card
* `primary_module` - set `true`, if this module is primary in relationship to "Calls" module
* `show_create` - shows create new record link on popup card
* `name_field` - module field for found record name
* `phone_fields` - module fields to search for phone number
* `relate_once` - set `false` to search and relate records in all modules from `relationships`
Note: You need to restart asterlink app evertime you change asterisk extensions for users.

## Click2Dial and Pop up card
* Configure `endpoint_addr` and `endpoint_token` in **config.yml**. `endpoint_token` is just an any secret word you want.
It must be equal in both **conf.yml** and **config_override.php**.
* Copy [connect/suitecrm/dist/asterlink](https://github.com/serfreeman1337/asterlink/tree/master/connect/suitecrm/dist) folder to ***suitecrm*** directory.
* Add following line to the end of the **custom/modules/logic_hooks.php** file:
```php
$hook_array['after_ui_frame'][] = Array(1, 'asterlink javascript', 'asterlink/hooks.php', 'AsterLink', 'init_javascript');
```
* Add to **config_override.php**:
```php
$sugar_config['asterlink']['endpoint_token'] = 'my_endpoint_token';
$sugar_config['asterlink']['endpoint_url'] = 'http://my_endpoint_addr:my_endpoint_port';
$sugar_config['asterlink']['endpoint_ws'] = 'ws://my_endpoint_addr:my_endpoint_port';
```
* Check "***Enable click-to-call for phone numbers Information***" in SuiteCRM System Settings.
## Click-to-Call and Pop up card
* Configure `endpoint_addr` in the **conf.yml** file.
* Configure `Endpoint URL` for Click-to-Call function and `WebSocket URL` for pop up card on the **AsterLink Settings** SuiteCRM Administrator page.
* Check `Enable click-to-call for phone numbers Information` on the SuiteCRM System Settings page.
Note: SuiteCRM will only enable this for CallerID with begining plus sign.

### Apache2 endpoint proxy
Expand All @@ -95,10 +32,10 @@ See `relationships` key in config.
ProxyPass "/asterlink/ws/" "ws://my_endpoint_addr:my_endpoint_port/ws/"
ProxyPass "/asterlink/" "http://my_endpoint_addr:my_endpoint_port/"
```
* Update **config_override.php**:
```php
$sugar_config['asterlink']['endpoint_url'] = 'http://apache_addr/asterlink';
$sugar_config['asterlink']['endpoint_ws'] = 'ws://apache_addr/asterlink';
* Update AsterLink module settings:
```
Endpoint URL: http://my_endpoint_addr:my_endpoint_port/
WebSocket URL: ws://my_endpoint_addr:my_endpoint_port/ws/
```

## Forwarding calls to assigned user
Expand All @@ -110,3 +47,11 @@ same => n,GotoIf($[${ASSIGNED}]?from-did-direct,${ASSIGNED},1)
same => n,Goto(ext-queues,400,1)
same => n,Hangup
```

## Upgrade from 0.3 version
* Its highly recomended to backup DB before upgrading.
* Remove logic hook from **custom/modules/logic_hooks.php** by removing a line with the `asterlink javascript`.
* Remove any lines with `$sugar_config['asterlink']` from **config_override.php**.
* Delete **asterlink** folder from the suitecrm directory.
* Install AsterLink Module.
* Migrate relationships config from **conf.yml** to AsterLink Module settings.
Loading

0 comments on commit 2569e06

Please sign in to comment.