YetiForceCompany / YetiForceCRM

Our team created for you one of the most innovative CRM systems that supports mainly business processes and allows for customization according to your needs. Be ahead of your competition and implement YetiForce!
https://yetiforce.com
Other
1.72k stars 747 forks source link

Question: PBX Manager module works with Asterisk ? #2981

Closed zwieja closed 8 years ago

zwieja commented 8 years ago

It is possible to use Vtiger Asterisk Connector from Vtiger to connect Yetiforce CRM to Asterisk to make and receive calls ?

nic86 commented 8 years ago

Same Issue:

2521

2059

2687

with small changes to the code you can operate the connector.

in modules/PBXManager/models/Record.php (line 76)

public function saveRecordWithArrray($params)
        {
                $moduleModel = Vtiger_Module_Model::getInstance('PBXManager');
                $recordModel = Vtiger_Record_Model::getCleanInstance('PBXManager');
                $recordModel->set('mode', '');
                $details = array_change_key_case($params, CASE_LOWER);
                $fieldModelList = $moduleModel->getFields();

                //add this line
                if(!isset($details["assigned_user_id"]))
                        $details["assigned_user_id"]=1;
                if(!isset($details["created_user_id"]))
                        $details["created_user_id"]=1;

                foreach ($fieldModelList as $fieldName => $fieldModel) {
                        $fieldValue = $details[$fieldName];
                        $recordModel->set($fieldName, $fieldValue);
                }
                return $moduleModel->saveRecord($recordModel);
        }

in table vtiger_pbxmanager change structure of column sourceuuid from int(11) to varchar(100)

to bring up the icon of a phone after the phone numbers in the listview to do the click to call, add this line in file include/ListView/ListViewController.php (from line 389 until the next else if)

elseif ($field->getUIType() == 11) {
  $moduleInstance = Vtiger_Module_Model::getInstance("PBXManager");
  if($moduleInstance && $moduleInstance->isActive()) {
    $outgoingCallPermission = PBXManager_Server_Model::checkPermissionForOutgoingCall();
  }
  $outgoingMobilePermission = Vtiger_Mobile_Model::checkPermissionForOutgoingCall();
  if($outgoingCallPermission && !empty($value)) {
    $phoneNumber = preg_replace('/[-()\s+]/', '',$value);
    $value = textlength_check($value).'<a class="phoneField" data-value="'.$phoneNumber.'" record="'.$recordId.'"onclick="Vtiger_PBXManager_Js.registerPBXOutboundCall(\''.$phoneNumber.'\', '.$recordId.')"> <img style="vertical-align:middle;" src="layouts/basic/skins/images/small_Call.png"/></a>';
  }
    elseif ($outgoingMobilePermission && !empty($value)) {
        $phoneNumber = preg_replace('/[-()\s]/', '', $value);
        $value = '<a class="phoneField" data-phoneNumber="' . $phoneNumber . '" record="' . $recordId . '" onclick="Vtiger_Mobile_Js.registerOutboundCall(\'' . $phoneNumber . '\', ' . $recordId . ')">' . textlength_check($value) . '</a>';
        $callUsers = Vtiger_Mobile_Model::getPrivilegesUsers();
        if ($callUsers) {
            $value .= '  <a class="btn btn-xs noLinkBtn" onclick="Vtiger_Mobile_Js.registerOutboundCallToUser(this,\'' . $phoneNumber . '\',' . $recordId . ')" data-placement="right" data-original-title="' . vtranslate('LBL_SELECT_USER_TO_CALL', $module) . '" data-content=\'<select class="select sesectedUser" name="sesectedUser">';
            foreach ($callUsers as $key => $item) {
                $value .= '<option value="' . $key . '">' . $item . '</option>';
            }
            $value .= '</select><br /><a class="btn btn-success popoverCallOK">' . vtranslate('LBL_BTN_CALL', $module) . '</a>   <a class="btn btn-inverse popoverCallCancel">' . vtranslate('LBL_CANCEL', $module) . '</a>\' data-trigger="manual"><i class="icon-user"></i></a>';
        }
    } else {
  $value = textlength_check($value);
    }
}
zwieja commented 8 years ago

@nic86 Thank you very much for help. Connector works.

I have last question. Do you know what to change to be able to listen call recordings from connector in Yetiforce call logs ?

nic86 commented 8 years ago

sorry, I have not tried to turn on this feature , share it if you find out how to do

zwieja commented 8 years ago

@nic86 Can you confirm that connector works in new version of YetiForce (3.1)

I can't edit settings in PBX Manager module. I click edit and Yeti hangs on loading in this module and I get this error :

Uncaught Error: Syntax error, unrecognized expression: {"success":false,"error":{"code":"LBL_NO_PERMISSIONS_FOR_THE_RECORD","message":"LBL_NO_PERMISSIONS_FOR_THE_RECORD"}}

zwieja commented 8 years ago

@nic86

  1. Is posiible to enable popup on incoming call in YetiForce when I using Vtiger Asterisk Connector ?.
  2. How to log calls in call history tab in Leads/Accounts/Partners/Vendors/Competition/ and Contacts from asterisk ?
zwieja commented 8 years ago

@nic86 ?

nic86 commented 8 years ago

In Software configuration > Permissions > Users > Detail in More Information tab assigns a value to the user "CRM phone extension"

Verify that there are no differences between the date and time of yeti server and the asterisk server

Server Asterisk (eg. IP=192.168.3.10): Configure asterisk connector /VtigerAsteriskConnector/conf/VtigerAsteriskConnector.properties

// Location where the application server will be running.
ServerIP   = 127.0.0.1
ServerPort = 87777

// Call Recordings storage path
StorageDir = /VtigerAsteriskConnector/rec

// Enable(true) or Disable(false) call recordings
Recording = false

// Location where the applications database files will be stored.
AsteriskAppDBPath = /VtigerAsteriskConnector/db

// Asterisk Server Details
AsteriskServerPublicIP = 127.0.0.1
AsteriskServerIP   = 127.0.0.1
AsteriskServerPort = 5038
AsteriskUsername   = your_manager.conf_user
AsteriskPassword   = your_manager.conf_password

// Vtiger CRM URL
VtigerURL = http://192.168.3.20
VtigerSecretKey = your_yetiforce_secret_key
//Enable(true) or Disable(false) Asterisk Events and Database Logs in Connector
AsteriskLog = false
DatabaseLog = false

if you have an active iptable do these commands from the terminal

iptables --insert INPUT -p tcp -s 192.168.3.20 --dport 87777 -j ACCEPT
iptables --insert OUTPUT -p tcp -s 192.168.3.20 --dport 87777 -j ACCEPT

Server Yeti: (eg. IP=192.168.3.20) in Software configuration > Integration > PBXManager > Start:

YetiForce Asterisk App URL: http://192.168.3.10:87777
Outbound Context: your_asterisk_outbound_context
Outbound Trunk: your_asterisk_outbound_trunk
YetiForce Secret Key: your_yetiforce_secret_key
zwieja commented 8 years ago

@nic86 Thanks for reply but I have one more problem. How to view Call History tab from PBX Manager in module eg. Contacts in Yetiforce ?

TomaszQr commented 8 years ago

The fixed code was added to the files. We haven't tested whether or not it's correct, if someone tests it let us know. https://github.com/YetiForceCompany/YetiForceCRM/commit/4b722e1aa2ccc592cd02f5b249ff3f74b696fbbb

zwieja commented 8 years ago

@TomaszQr Above changes works.

epsilonsc commented 8 years ago

@zwieja Hi you integrated with asterisk ?
Do you have ASTERISK 11 or 1,6, 1,8? Do you use Connector for Asterisk 1,4 or 1.3? can you past your extensions.conf file. please We use asterisk 1.6 and Connector for Asterisk 1,4 and we have error "IncomingCall log Failed to authenticate Vtiger Secret Key " but the key is ok. When we click on the phone number in crm, the phone ring but disconect after pick up the phone.

zwieja commented 8 years ago

@epsilonsc Hi. Yes I integrated with Asterisk 1.8 and VtigerAsteriskConnector v1.4. Under code from extensions.conf responsible for calling.

[testing] exten => Phone_Number,1,Agi(agi://127.0.0.1/incoming.agi) exten => Phone_Number,n,Hangup()

[testy] exten => _X.,1,Agi(agi://127.0.0.1/incoming.agi) exten => _X.,n,Dial(SIP/test/${EXTEN},90)

[vtigerout] exten => _X.,1,Agi(agi://127.0.0.1/incoming.agi)

sirwinston1 commented 7 years ago

@nic86 Hey Nic, Do you know which php and/or tpl files need to be changed in order to enable the click to call for yetiforce 4.0?

nic86 commented 7 years ago

If I had to implement the same functionality I would overwrite the function getListViewDisplayValue in the file modules/Vtiger/uitypes/Phone.php, starting from the old function that added the phone logo after the phone number in to the list view.

rafalzda commented 5 years ago

@zwieja cześć, czy udało Ci się poprawnie skonfigurować centralę asteriska z Yeti? JEżeli tak to czy mógłbyś mi pomóc to zrobić? Używam Asteriska 11 - Issabel 4

bpabiszczak commented 5 years ago

może @epsilonsc coś pomoże w tym zakresie.

rafalzda commented 5 years ago

jeżeli byłaby szansa to bardzo proszę o pomoc @epsilonsc @zwieja siedzę już tydzień próbując sam, ale chyba mi się nie uda

zwieja commented 5 years ago

@rafalzda

Napisz na maila azaw@protonmail.com na czym stoisz. Postaram się pomóc.

rafalzda commented 5 years ago

@zwieja dzięki

epsilonsc commented 5 years ago

@rafalzda Cześć, przeklej proszę konfigurację asteriska (extensions.conf) i opisz strukturę czy na jednym serwerze czy na różnych.

rafalzda commented 5 years ago

Chcę aby struktura wyglądała tak:

  1. Serwer na Centos 7 dostępny wyłącznie po VPNie
  2. Na serwerze zainstalowana centralka (u mnie Issabel w wersji 4 - Asterisk 11)
  3. Zintegrowany na serwerze CRM, połączony z centralką przez którą będę mógł zarządzać klientami, przypisywać od nich połączenia, pisać notatki podczas rozmów mniej więcej jak pod tym linkiem https://www.youtube.com/watch?v=HpSClWPICFE

Issabela korzysta z 4 plików extensions extensions.conf - https://pastebin.com/y7TuBrki extensions_additional.conf - https://pastebin.com/U5PWce8T extensions_custom.conf - https://pastebin.com/RrRRvhRU extensions_override_issabel.conf - https://pastebin.com/SNsdK99U

w extensions.conf na początku jest zapis:

include extensions_override_issabelpbx.conf

include extensions_additional.conf

include extensions_custom.conf

Obecnie jestem jeszcze w trakcie stawiania serwera na centos 7 z zainstalowanym php 7.1 by postawić Yeti na swojej maszynie googla. Issabel też jest na takiej maszynie

epsilonsc commented 5 years ago

@rafalzda Cześć, tutaj masz w miarę szczegółowy opis co i jak z rysunkami. https://www.smackcoders.com/blog/setup-vtiger-crm-telephony-integration-asterisk.html

  1. Musisz zwrócić uwagę na konfiguracje manager.conf oraz kontekst context w sip.conf

2.Widziałem ze programiści coś poprawiali w wersji 4.4 nie wiem jakiej wersji używasz. Jak uda Ci sie to poskładać to wrzuć może jakaś prosta instrukcję z konfiguracja dla pozostałych.

Ps ten mechanizm jest bardzo zawodny. Może zrobimy zrzutkę żeby producent napisał jakiś sensowny mechanizm do integracji. Sporo ludzi na to czeka. @bpabiszczak może ktoś od was utworzy jakiś projekt do zbiórki na wybrane moduły ?

Mam nawet wycenę na parę tyś. Zerknij sobie na https://www.3cx.com/ może uda sie prościej zintegrować z tym rozwiazaniem. https://www.3cx.com/support/integrating-3cx-phone-system/ całkiem fajne i proste api.

bpabiszczak commented 5 years ago

Minimum na to potrzeba 2.500 PLN netto. Wówczas możemy to zrobić w wersji podstawowej.

bpabiszczak commented 5 years ago

PS: zróbcie na to oddzielny wątek, bo tutaj to zginie.

rafalzda commented 5 years ago

@bpabiszczak no właśnie integracje dające takie możliwości kosztują około 300-400$ z rocznym wsparciem i supportem z integracją do EspoCRM również otwartym rozwiązaniem CRM. https://www.espocrm.com/features/asterisk-integration-setup/

Sądzę, że sporo klientów dołączyłoby do społeczności Yeti gdyby taki moduł został zintegrowany. Na razie pewnie spróbuję jeszcze powalczyć, i może uda mi się zintegrować Yeti z Asteriskiem. Gdy tak się stanie, na pewno umieszczę instrukcję i podepnę w tym lub nowym wątku.

ps. byłby to jedyny otwarty CRM dostępny na rynku (zrobiłem głęboki research) dający bezpośrednio możliwość integracji z asteriskiem, to byłaby rewolucja, sporo twórców takich rozwiązań byłaby niepocieszona

bpabiszczak commented 5 years ago

@rafalzda tylko tyle kosztuje jak ktoś to zrobił... napisanie integracji od zera to koszt 10-15 tyś złotych.

rafalzda commented 5 years ago

@bpabiszczak dlatego byłaby to rewolucja, ale w pełni to rozumiem

femolacaster commented 2 years ago

@rafalzda Cześć, tutaj masz w miarę szczegółowy opis co i jak z rysunkami. https://www.smackcoders.com/blog/setup-vtiger-crm-telephony-integration-asterisk.html

  1. Musisz zwrócić uwagę na konfiguracje manager.conf oraz kontekst context w sip.conf

2.Widziałem ze programiści coś poprawiali w wersji 4.4 nie wiem jakiej wersji używasz. Jak uda Ci sie to poskładać to wrzuć może jakaś prosta instrukcję z konfiguracja dla pozostałych.

Ps ten mechanizm jest bardzo zawodny. Może zrobimy zrzutkę żeby producent napisał jakiś sensowny mechanizm do integracji. Sporo ludzi na to czeka. @bpabiszczak może ktoś od was utworzy jakiś projekt do zbiórki na wybrane moduły ?

Mam nawet wycenę na parę tyś. Zerknij sobie na https://www.3cx.com/ może uda sie prościej zintegrować z tym rozwiazaniem. https://www.3cx.com/support/integrating-3cx-phone-system/ całkiem fajne i proste api.

Hi @epsilonsc. Do you have any ideas on how best to integrate Yetiforce to 3CX?