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
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
#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...
echo " "
echo "Letsencrypt settings..."
mkdir -p /var/lib/letsencrypt/.well-known
chgrp asterisk /var/lib/letsencrypt
......@@ -120,6 +140,19 @@ echo ' Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec' >> /et
echo ' Require method GET POST OPTIONS' >> /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!"
exit 0
......@@ -265,7 +265,7 @@ function getQuesue() {
*/
function Quesue(data) {
const self = this
this.data = data.data
this.data = this._toCurrentAgentData(data.data)
// this.target = data.target
this.locale = data.locale
this.params = data.params
......@@ -333,6 +333,7 @@ function getQuesue() {
* @returns {Boolean}
*/
update(newData) {
newData = this._toCurrentAgentData(newData)
const self = this
const prevData = this.data;
this._channels = this._getCurrentQueuesCalls(newData.channels)
......@@ -363,6 +364,23 @@ function getQuesue() {
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
* @private
......
......@@ -45,8 +45,9 @@ class AloVoiceActions
public function doAction() {
if(!empty($_REQUEST)){
ALVC::eLog($_REQUEST,"---- ****** ----- CODE [".$_REQUEST["code"]."]:");
if(!empty($_REQUEST["code"]) && $_REQUEST["code"] == "autocallrobot" ){
$code = (!empty($_REQUEST["code"])) ? $_REQUEST["code"] : false;
ALVC::eLog($_REQUEST,"---- ****** ----- CODE [".$code."]:");
if(!empty($code) && $code == "autocallrobot" ){
return $this->doAutoCallRobot($_REQUEST);
}
......@@ -56,8 +57,8 @@ class AloVoiceActions
}
}
if(!empty($_REQUEST["type"]) && !empty($_REQUEST["code"]) && !empty($_REQUEST["properties"])){
if( ($_REQUEST["type"]=="SMS") && ($_REQUEST["code"]=="alosms") && (!empty($_REQUEST["message_to"]) ) && (!empty($_REQUEST["message_body"]) )){ //["properties"] ["properties"]
if(!empty($_REQUEST["type"]) && !empty($code) && !empty($_REQUEST["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"]);
if( !empty($_REQUEST["properties"]["send_from_number"]) ){
$sndParams['fromnumber'] = $_REQUEST["properties"]["send_from_number"];
......@@ -65,7 +66,7 @@ class AloVoiceActions
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"]);
if( !empty($_REQUEST["properties"]["send_from_number"]) ){
$sndParams['fromnumber'] = $_REQUEST["properties"]["send_from_number"];
......@@ -73,7 +74,7 @@ class AloVoiceActions
return $this->doEtcSms($sndParams);
}
}
//"type":"SMS","code":"alosms"
}
return false;
......
......@@ -792,40 +792,40 @@ function(result){
'title'=>'Автоназначение внут.номера',
'status'=>'off',
)];
$res['nextintegration'] = 'status_leadupdate';
$res['nextintegration'] = 'status_activityadd';
$res['rescheck'] = $arResults;
return $res;
}
private function status_leadupdate($r=false) {
// private function status_leadupdate($r=false) {
$arResults = BxRest::call('event.get');
$integrations = [];
// $arResults = BxRest::call('event.get');
// $integrations = [];
if(!empty($arResults["result"])){
foreach($arResults["result"] as $itg){
if( $itg["event"] == "ONCRMLEADUPDATE" ){
if( $itg["handler"] == $this->config["alovoice_host"] ){
$integrations[] = array(
'code'=>'leadupdateevent',
'title'=>'Лидообработка',
'status'=>'on',
);
}
}
}
}
$res['lines'] = (!empty($integrations)) ? $integrations : [array(
'code'=>'leadupdateevent',
'title'=>'Лидообработка',
'status'=>'off',
)];
$res['nextintegration'] = 'status_activityadd';
$res['rescheck'] = $arResults;
return $res;
}
// if(!empty($arResults["result"])){
// foreach($arResults["result"] as $itg){
// if( $itg["event"] == "ONCRMLEADUPDATE" ){
// if( $itg["handler"] == $this->config["alovoice_host"] ){
// $integrations[] = array(
// 'code'=>'leadupdateevent',
// 'title'=>'Лидообработка',
// 'status'=>'on',
// );
// }
// }
// }
// }
// $res['lines'] = (!empty($integrations)) ? $integrations : [array(
// 'code'=>'leadupdateevent',
// 'title'=>'Лидообработка',
// 'status'=>'off',
// )];
// $res['nextintegration'] = 'status_activityadd';
// $res['rescheck'] = $arResults;
// return $res;
// }
private function status_activityadd($r=false) {
$arResults = BxRest::call('event.get');
......@@ -878,53 +878,53 @@ function(result){
'title'=>'Обратный звонок',
'status'=>'off',
)];
$res['nextintegration'] = 'status_alosms';
$res['nextintegration'] = 'status_alotg';
$res['rescheck'] = $arResults;
return $res;
}
private function status_alosms($r=false) {
$integrations = [];
$arResults = BxRest::call('messageservice.sender.list');
if(!empty($arResults["result"]) && in_array("alosms",$arResults["result"])){
$integrations[] = array(
'code'=>'smsservice',
'title'=>'SMS сервис (alosms)',
'status'=>'on',
);
}
$res['lines'] = (!empty($integrations)) ? $integrations : [array(
'code'=>'smsservice',
'title'=>'SMS сервис',
'status'=>'off',
)];
$res['nextintegration'] = 'status_aloetc';
$res['rescheck'] = $arResults;
return $res;
}
private function status_aloetc($r=false) {
$integrations = [];
$arResults = BxRest::call('messageservice.sender.list');
if(!empty($arResults["result"]) && in_array("smsetc",$arResults["result"])){
$integrations[] = array(
'code'=>'smsetcgateway',
'title'=>'SMS шлюз (smsetc)',
'status'=>'on',
);
}
$res['lines'] = (!empty($integrations)) ? $integrations : [array(
'code'=>'smsetcgateway',
'title'=>'SMS шлюз Etc',
'status'=>'off',
)];
$res['nextintegration'] = 'status_alotg';
$res['rescheck'] = $arResults;
return $res;
}
// private function status_alosms($r=false) {
// $integrations = [];
// $arResults = BxRest::call('messageservice.sender.list');
// if(!empty($arResults["result"]) && in_array("alosms",$arResults["result"])){
// $integrations[] = array(
// 'code'=>'smsservice',
// 'title'=>'SMS сервис (alosms)',
// 'status'=>'on',
// );
// }
// $res['lines'] = (!empty($integrations)) ? $integrations : [array(
// 'code'=>'smsservice',
// 'title'=>'SMS сервис',
// 'status'=>'off',
// )];
// $res['nextintegration'] = 'status_alotg';
// $res['rescheck'] = $arResults;
// return $res;
// }
// private function status_aloetc($r=false) {
// $integrations = [];
// $arResults = BxRest::call('messageservice.sender.list');
// if(!empty($arResults["result"]) && in_array("smsetc",$arResults["result"])){
// $integrations[] = array(
// 'code'=>'smsetcgateway',
// 'title'=>'SMS шлюз (smsetc)',
// 'status'=>'on',
// );
// }
// $res['lines'] = (!empty($integrations)) ? $integrations : [array(
// 'code'=>'smsetcgateway',
// 'title'=>'SMS шлюз Etc',
// 'status'=>'off',
// )];
// $res['nextintegration'] = 'status_alotg';
// $res['rescheck'] = $arResults;
// return $res;
// }
private function status_alotg($r=false) {
//OnImConnectorMessageAdd
......
File mode changed from 100644 to 100755
......@@ -20768,3 +20768,18 @@
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 []
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