Commit 4864c379 authored by Kulya's avatar Kulya 😊

Change INtegration changes

parent c7715ed3
...@@ -106,7 +106,27 @@ echo "read = system,call,log,verbose,command,agent,user,config,command,dtmf,repo ...@@ -106,7 +106,27 @@ echo "read = system,call,log,verbose,command,agent,user,config,command,dtmf,repo
echo "write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message " >> /etc/asterisk/manager_custom.conf echo "write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message " >> /etc/asterisk/manager_custom.conf
echo "writetimeout = 500 " >> /etc/asterisk/manager_custom.conf echo "writetimeout = 500 " >> /etc/asterisk/manager_custom.conf
#open FireWALL ports
echo " "
echo "Opening ports..."
firewall-cmd --zone=public --permanent --add-port=80/tcp
firewall-cmd --zone=public --permanent --add-port=443/tcp
firewall-cmd --zone=public --permanent --add-port=55522/tcp
firewall-cmd --zone=public --permanent --add-port=5060/tcp
firewall-cmd --zone=public --permanent --add-port=5060/udp
firewall-cmd --zone=public --permanent --add-port=5061/tcp
firewall-cmd --zone=public --permanent --add-port=5061/udp
firewall-cmd --zone=public --permanent --add-port=4569/udp
firewall-cmd --zone=public --permanent --add-port=5038/tcp
firewall-cmd --zone=public --permanent --add-port=5038/udp
firewall-cmd --zone=public --permanent --add-port=10000-20000/udp
firewall-cmd --reload
# Letsencrypt settings... # Letsencrypt settings...
echo " "
echo "Letsencrypt settings..."
mkdir -p /var/lib/letsencrypt/.well-known mkdir -p /var/lib/letsencrypt/.well-known
chgrp asterisk /var/lib/letsencrypt chgrp asterisk /var/lib/letsencrypt
...@@ -120,6 +140,19 @@ echo ' Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec' >> /et ...@@ -120,6 +140,19 @@ echo ' Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec' >> /et
echo ' Require method GET POST OPTIONS' >> /etc/httpd/conf.d/letsencrypt.conf echo ' Require method GET POST OPTIONS' >> /etc/httpd/conf.d/letsencrypt.conf
echo '</Directory>' >> /etc/httpd/conf.d/letsencrypt.conf echo '</Directory>' >> /etc/httpd/conf.d/letsencrypt.conf
#Cronnig fro AloVoice jobs
crontab -l > mycron
echo "* * * * * /usr/bin/chmod 777 /var/www/html/bx24/alovoice/ -R" > mycron
echo "* * * * * /etc/init.d/amibx check" >> mycron
echo "* * * * * /usr/bin/chmod 777 /var/www/html/bx24/logs/*" >> mycron
crontab mycron
rm mycron
echo "Done!" echo "Done!"
exit 0 exit 0
...@@ -265,7 +265,7 @@ function getQuesue() { ...@@ -265,7 +265,7 @@ function getQuesue() {
*/ */
function Quesue(data) { function Quesue(data) {
const self = this const self = this
this.data = data.data this.data = this._toCurrentAgentData(data.data)
// this.target = data.target // this.target = data.target
this.locale = data.locale this.locale = data.locale
this.params = data.params this.params = data.params
...@@ -333,6 +333,7 @@ function getQuesue() { ...@@ -333,6 +333,7 @@ function getQuesue() {
* @returns {Boolean} * @returns {Boolean}
*/ */
update(newData) { update(newData) {
newData = this._toCurrentAgentData(newData)
const self = this const self = this
const prevData = this.data; const prevData = this.data;
this._channels = this._getCurrentQueuesCalls(newData.channels) this._channels = this._getCurrentQueuesCalls(newData.channels)
...@@ -363,6 +364,23 @@ function getQuesue() { ...@@ -363,6 +364,23 @@ function getQuesue() {
return true return true
}, },
_toCurrentAgentData(data) {
var agents = {};
Object.entries(data.agents).map(function(arr) {
var key = arr[0], value = arr[1];
if (value.connect && value.status === 'off') {
value.status = 'free'
}
agents[key] = value
})
data.agents = agents
return data
},
/** /**
* uppdate queue * uppdate queue
* @private * @private
......
...@@ -45,8 +45,9 @@ class AloVoiceActions ...@@ -45,8 +45,9 @@ class AloVoiceActions
public function doAction() { public function doAction() {
if(!empty($_REQUEST)){ if(!empty($_REQUEST)){
ALVC::eLog($_REQUEST,"---- ****** ----- CODE [".$_REQUEST["code"]."]:"); $code = (!empty($_REQUEST["code"])) ? $_REQUEST["code"] : false;
if(!empty($_REQUEST["code"]) && $_REQUEST["code"] == "autocallrobot" ){ ALVC::eLog($_REQUEST,"---- ****** ----- CODE [".$code."]:");
if(!empty($code) && $code == "autocallrobot" ){
return $this->doAutoCallRobot($_REQUEST); return $this->doAutoCallRobot($_REQUEST);
} }
...@@ -56,8 +57,8 @@ class AloVoiceActions ...@@ -56,8 +57,8 @@ class AloVoiceActions
} }
} }
if(!empty($_REQUEST["type"]) && !empty($_REQUEST["code"]) && !empty($_REQUEST["properties"])){ if(!empty($_REQUEST["type"]) && !empty($code) && !empty($_REQUEST["properties"])){
if( ($_REQUEST["type"]=="SMS") && ($_REQUEST["code"]=="alosms") && (!empty($_REQUEST["message_to"]) ) && (!empty($_REQUEST["message_body"]) )){ //["properties"] ["properties"] if( ($_REQUEST["type"]=="SMS") && ($code=="alosms") && (!empty($_REQUEST["message_to"]) ) && (!empty($_REQUEST["message_body"]) )){ //["properties"] ["properties"]
$sndParams = array("sendto"=>$_REQUEST["message_to"],"message"=>$_REQUEST["message_body"]); $sndParams = array("sendto"=>$_REQUEST["message_to"],"message"=>$_REQUEST["message_body"]);
if( !empty($_REQUEST["properties"]["send_from_number"]) ){ if( !empty($_REQUEST["properties"]["send_from_number"]) ){
$sndParams['fromnumber'] = $_REQUEST["properties"]["send_from_number"]; $sndParams['fromnumber'] = $_REQUEST["properties"]["send_from_number"];
...@@ -65,7 +66,7 @@ class AloVoiceActions ...@@ -65,7 +66,7 @@ class AloVoiceActions
return $this->doSendSms($sndParams); return $this->doSendSms($sndParams);
} }
if( ($_REQUEST["type"]=="SMS") && ($_REQUEST["code"]=="smsetc") && (!empty($_REQUEST["message_to"]) ) && (!empty($_REQUEST["message_body"]) )){ //["properties"] ["properties"] if( ($_REQUEST["type"]=="SMS") && ($code=="smsetc") && (!empty($_REQUEST["message_to"]) ) && (!empty($_REQUEST["message_body"]) )){ //["properties"] ["properties"]
$sndParams = array("sendto"=>$_REQUEST["message_to"],"message"=>$_REQUEST["message_body"]); $sndParams = array("sendto"=>$_REQUEST["message_to"],"message"=>$_REQUEST["message_body"]);
if( !empty($_REQUEST["properties"]["send_from_number"]) ){ if( !empty($_REQUEST["properties"]["send_from_number"]) ){
$sndParams['fromnumber'] = $_REQUEST["properties"]["send_from_number"]; $sndParams['fromnumber'] = $_REQUEST["properties"]["send_from_number"];
...@@ -73,7 +74,7 @@ class AloVoiceActions ...@@ -73,7 +74,7 @@ class AloVoiceActions
return $this->doEtcSms($sndParams); return $this->doEtcSms($sndParams);
} }
} }
//"type":"SMS","code":"alosms"
} }
return false; return false;
......
...@@ -792,40 +792,40 @@ function(result){ ...@@ -792,40 +792,40 @@ function(result){
'title'=>'Автоназначение внут.номера', 'title'=>'Автоназначение внут.номера',
'status'=>'off', 'status'=>'off',
)]; )];
$res['nextintegration'] = 'status_leadupdate'; $res['nextintegration'] = 'status_activityadd';
$res['rescheck'] = $arResults; $res['rescheck'] = $arResults;
return $res; return $res;
} }
private function status_leadupdate($r=false) { // private function status_leadupdate($r=false) {
$arResults = BxRest::call('event.get'); // $arResults = BxRest::call('event.get');
$integrations = []; // $integrations = [];
if(!empty($arResults["result"])){ // if(!empty($arResults["result"])){
foreach($arResults["result"] as $itg){ // foreach($arResults["result"] as $itg){
if( $itg["event"] == "ONCRMLEADUPDATE" ){ // if( $itg["event"] == "ONCRMLEADUPDATE" ){
if( $itg["handler"] == $this->config["alovoice_host"] ){ // if( $itg["handler"] == $this->config["alovoice_host"] ){
$integrations[] = array( // $integrations[] = array(
'code'=>'leadupdateevent', // 'code'=>'leadupdateevent',
'title'=>'Лидообработка', // 'title'=>'Лидообработка',
'status'=>'on', // 'status'=>'on',
); // );
} // }
} // }
} // }
} // }
$res['lines'] = (!empty($integrations)) ? $integrations : [array( // $res['lines'] = (!empty($integrations)) ? $integrations : [array(
'code'=>'leadupdateevent', // 'code'=>'leadupdateevent',
'title'=>'Лидообработка', // 'title'=>'Лидообработка',
'status'=>'off', // 'status'=>'off',
)]; // )];
$res['nextintegration'] = 'status_activityadd'; // $res['nextintegration'] = 'status_activityadd';
$res['rescheck'] = $arResults; // $res['rescheck'] = $arResults;
return $res; // return $res;
} // }
private function status_activityadd($r=false) { private function status_activityadd($r=false) {
$arResults = BxRest::call('event.get'); $arResults = BxRest::call('event.get');
...@@ -878,53 +878,53 @@ function(result){ ...@@ -878,53 +878,53 @@ function(result){
'title'=>'Обратный звонок', 'title'=>'Обратный звонок',
'status'=>'off', 'status'=>'off',
)]; )];
$res['nextintegration'] = 'status_alosms'; $res['nextintegration'] = 'status_alotg';
$res['rescheck'] = $arResults; $res['rescheck'] = $arResults;
return $res; return $res;
} }
private function status_alosms($r=false) { // private function status_alosms($r=false) {
$integrations = []; // $integrations = [];
$arResults = BxRest::call('messageservice.sender.list'); // $arResults = BxRest::call('messageservice.sender.list');
if(!empty($arResults["result"]) && in_array("alosms",$arResults["result"])){ // if(!empty($arResults["result"]) && in_array("alosms",$arResults["result"])){
$integrations[] = array( // $integrations[] = array(
'code'=>'smsservice', // 'code'=>'smsservice',
'title'=>'SMS сервис (alosms)', // 'title'=>'SMS сервис (alosms)',
'status'=>'on', // 'status'=>'on',
); // );
} // }
$res['lines'] = (!empty($integrations)) ? $integrations : [array( // $res['lines'] = (!empty($integrations)) ? $integrations : [array(
'code'=>'smsservice', // 'code'=>'smsservice',
'title'=>'SMS сервис', // 'title'=>'SMS сервис',
'status'=>'off', // 'status'=>'off',
)]; // )];
$res['nextintegration'] = 'status_aloetc'; // $res['nextintegration'] = 'status_alotg';
$res['rescheck'] = $arResults; // $res['rescheck'] = $arResults;
return $res; // return $res;
} // }
private function status_aloetc($r=false) { // private function status_aloetc($r=false) {
$integrations = []; // $integrations = [];
$arResults = BxRest::call('messageservice.sender.list'); // $arResults = BxRest::call('messageservice.sender.list');
if(!empty($arResults["result"]) && in_array("smsetc",$arResults["result"])){ // if(!empty($arResults["result"]) && in_array("smsetc",$arResults["result"])){
$integrations[] = array( // $integrations[] = array(
'code'=>'smsetcgateway', // 'code'=>'smsetcgateway',
'title'=>'SMS шлюз (smsetc)', // 'title'=>'SMS шлюз (smsetc)',
'status'=>'on', // 'status'=>'on',
); // );
} // }
$res['lines'] = (!empty($integrations)) ? $integrations : [array( // $res['lines'] = (!empty($integrations)) ? $integrations : [array(
'code'=>'smsetcgateway', // 'code'=>'smsetcgateway',
'title'=>'SMS шлюз Etc', // 'title'=>'SMS шлюз Etc',
'status'=>'off', // 'status'=>'off',
)]; // )];
$res['nextintegration'] = 'status_alotg'; // $res['nextintegration'] = 'status_alotg';
$res['rescheck'] = $arResults; // $res['rescheck'] = $arResults;
return $res; // return $res;
} // }
private function status_alotg($r=false) { private function status_alotg($r=false) {
//OnImConnectorMessageAdd //OnImConnectorMessageAdd
......
File mode changed from 100644 to 100755
...@@ -20768,3 +20768,18 @@ ...@@ -20768,3 +20768,18 @@
2021-11-29_19:32:00 add_contact 998367577 "Newcont_7577" "Newcont_7577" 2021-11-29_19:32:00 add_contact 998367577 "Newcont_7577" "Newcont_7577"
2021-11-29_19:32:00 addContact: RES: 2021-11-29_19:32:00 addContact: RES:
2021-11-29_19:32:00 [] 2021-11-29_19:32:00 []
2021-12-01_11:12:09 addContact: 998904127410, Newcont_7410,
2021-12-01_11:12:09 RES INFOFOFOF: false
2021-12-01_11:12:09 add_contact 998904127410 "Newcont_7410" "Newcont_7410"
2021-12-01_11:12:09 addContact: RES:
2021-12-01_11:12:09 false
2021-12-01_11:13:31 addContact: 998904127410, Newcont_7410,
2021-12-01_11:13:31 RES INFOFOFOF: false
2021-12-01_11:13:31 add_contact 998904127410 "Newcont_7410" "Newcont_7410"
2021-12-01_11:13:31 addContact: RES:
2021-12-01_11:13:31 false
2021-12-01_11:14:30 addContact: 998977807990, Newcont_7990,
2021-12-01_11:14:31 RES INFOFOFOF: false
2021-12-01_11:14:31 add_contact 998977807990 "Newcont_7990" "Newcont_7990"
2021-12-01_11:14:31 addContact: RES:
2021-12-01_11:14:31 [{"id":"$01000000fe7e891177bcc1766ac01038","peer_type":"user","peer_id":294223614,"print_name":"Newcont_7990_Newcont_7990","flags":65537,"first_name":"Newcont_7990","last_name":"Newcont_7990","phone":"998977807990"}]
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment