diff --git a/build/MagnusBilling-current.tar.gz b/build/MagnusBilling-current.tar.gz index c9975aad2..46f3ea99f 100644 Binary files a/build/MagnusBilling-current.tar.gz and b/build/MagnusBilling-current.tar.gz differ diff --git a/classic/src/view/campaignPoll/Form.js b/classic/src/view/campaignPoll/Form.js index a6ef02075..26c3a4bf1 100755 --- a/classic/src/view/campaignPoll/Form.js +++ b/classic/src/view/campaignPoll/Form.js @@ -125,6 +125,10 @@ Ext.define('MBilling.view.campaignPoll.Form', { name: 'option9', fieldLabel: t('Option 9'), allowBlank: true + }, { + name: 'option10', + fieldLabel: t('Option 10'), + allowBlank: true }] }] }]; diff --git a/classic/src/view/restrictedPhonenumber/Form.js b/classic/src/view/restrictedPhonenumber/Form.js index d0e469fdc..38cdf94c0 100755 --- a/classic/src/view/restrictedPhonenumber/Form.js +++ b/classic/src/view/restrictedPhonenumber/Form.js @@ -45,7 +45,8 @@ Ext.define('MBilling.view.restrictedPhonenumber.Form', { store: window.dialC ? [ [1, t('Outbound')], [2, t('Inbound')], - [3, t('Outbound & CallerID')] + [3, t('Outbound & CallerID')], + [4, t('CallerID')] ] : [ [1, t('Outbound')], [2, t('Inbound')] diff --git a/protected/commands/UpdateMysqlCommand.php b/protected/commands/UpdateMysqlCommand.php index 91f7579a7..c9a3b2353 100755 --- a/protected/commands/UpdateMysqlCommand.php +++ b/protected/commands/UpdateMysqlCommand.php @@ -2010,6 +2010,22 @@ public function run($args) $this->update($version); } + //2024-05-27 + if ($version == '7.8.4.6') { + $sql = " ALTER TABLE `pkg_campaign_poll` ADD `option10` VARCHAR(150) NULL DEFAULT NULL AFTER `option9`;"; + $this->executeDB($sql); + + $sql = " ALTER TABLE `pkg_campaign_poll_info` ADD `resposta_text` VARCHAR(150) NULL DEFAULT NULL AFTER `city`"; + $this->executeDB($sql); + + $sql = " + ALTER TABLE `pkg_campaign_poll_info` CHANGE `resposta` `resposta` INT(11) NOT NULL;"; + $this->executeDB($sql); + + $version = '7.8.4.7'; + $this->update($version); + } + } public function executeDB($sql) diff --git a/protected/controllers/CampaignPollInfoController.php b/protected/controllers/CampaignPollInfoController.php index d8e3fbb48..0eeed2712 100755 --- a/protected/controllers/CampaignPollInfoController.php +++ b/protected/controllers/CampaignPollInfoController.php @@ -18,17 +18,17 @@ class CampaignPollInfoController extends Controller { public $attributeOrder = 't.id'; - public $extraValues = array('idCampaignPoll' => 'name'); + public $extraValues = ['idCampaignPoll' => 'name']; public $nameFileReport = 'exported'; - public $fieldsFkReport = array( - 'id_campaign_poll' => array( + public $fieldsFkReport = [ + 'id_campaign_poll' => [ 'table' => 'pkg_campaign_poll', 'pk' => 'id', 'fieldReport' => 'name', - ), - ); + ], + ]; public function init() { @@ -69,4 +69,21 @@ public function extraFilterCustomAgent($filter) return $filter; } + + public function subscribeColunms($columns = '') + { + + for ($i = 0; $i < count($columns); $i++) { + + if ($columns[$i]['dataIndex'] == 'resposta') { + $columns[$i]['header'] = 'DTMF'; + } + + } + + $columns[] = ['header' => 'Response', 'dataIndex' => 'resposta_text']; + + return $columns; + } + } diff --git a/protected/models/CampaignPoll.php b/protected/models/CampaignPoll.php index ba55f1b7e..10ba49d2a 100755 --- a/protected/models/CampaignPoll.php +++ b/protected/models/CampaignPoll.php @@ -57,7 +57,7 @@ public function rules() ['id_user,ordem_exibicao, repeat, id_campaign, digit_authorize, request_authorize', 'numerical', 'integerOnly' => true], ['name, arq_audio', 'length', 'max' => 100], - ['option0, option1, option2, option3, option4, option5, option6, option7, option8, option9', + ['option0, option1, option2, option3, option4, option5, option6, option7, option8, option9, option10', 'length', 'max' => 300], ['description', 'length', 'max' => 300], diff --git a/resources/asterisk/MassiveCall.php b/resources/asterisk/MassiveCall.php index 608e4cf5d..330e872c7 100755 --- a/resources/asterisk/MassiveCall.php +++ b/resources/asterisk/MassiveCall.php @@ -410,6 +410,11 @@ public function send($agi, &$MAGNUS, &$CalcAgi) foreach ($modelCampaignPoll as $poll) { + if (isset($execute_poll_name)) { + $poll = $execute_poll_name; + unset($execute_poll_name); + } + $repeat = $poll->repeat; if ($dtmf_result == -1) { @@ -430,6 +435,7 @@ public function send($agi, &$MAGNUS, &$CalcAgi) $audio = $uploaddir . "idPoll_" . $poll->id; + $agi->verbose("audio: $audio", 5); if ($poll->request_authorize == 1) { $agi->verbose('Request authorize', 5); //IF CUSTOMER MARK 1 EXECUTE POLL @@ -443,7 +449,26 @@ public function send($agi, &$MAGNUS, &$CalcAgi) } } else { - $res_dtmf = $agi->get_data($audio, 5000, 1); + + $agi->verbose("poll->option10: $poll->option10", 5); + + if (strlen($poll->option10)) { + + if (preg_match('/\#/', $poll->option10)) { + $digit_timeout = preg_split('/\#/', $poll->option10); + + $agi->verbose(print_r($digit_timeout, true), 5); + $digit_timeout = end($digit_timeout); + + } else { + $digit_timeout = strlen($poll->option10); + } + + $res_dtmf = $agi->get_data($audio, strlen($poll->option10) * 2000, $digit_timeout); + } else { + $res_dtmf = $agi->get_data($audio, 5000, 1); + } + } //GET RESULT OF POLL @@ -451,6 +476,21 @@ public function send($agi, &$MAGNUS, &$CalcAgi) $agi->verbose("Cliente votou na opcao: $dtmf_result", 5); + $sql = "SELECT * FROM pkg_campaign_poll WHERE name = '" . $poll->{'option' . $dtmf_result} . "' AND id_campaign = $idCampaign"; + $poll2 = $agi->query($sql)->fetchAll(PDO::FETCH_OBJ); + + if (isset($poll2[0]->id)) { + //execute other poll + $fields = "id_campaign_poll,resposta,number,city,resposta_text"; + $values = "'$poll->id', '$dtmf_result', '$destination', '$phonenumberCity','" . strtok($poll->{'option' . $dtmf_result}, '#') . "'"; + $sql = "INSERT INTO pkg_campaign_poll_info ($fields) VALUES ($values)"; + $agi->exec($sql); + + $execute_poll_name = $poll2[0]; + continue; + + } + //Hungaup call if the fisrt poll dtmf is not numeric if ($i == 0 && ! is_numeric($dtmf_result)) { $agi->verbose('nao votou nada na 1ยบ enquete', 5); @@ -505,6 +545,16 @@ public function send($agi, &$MAGNUS, &$CalcAgi) } if (is_numeric($dtmf_result) && $dtmf_result >= 0) { + + if (preg_match('/play_/', $poll->{'option' . $dtmf_result})) { + + preg_match_all('/play_(.*)\#/', $poll->{'option' . $dtmf_result}, $play_audio); + + if (isset($play_audio[1][0])) { + $agi->stream_file($play_audio[1][0], ' #'); + } + } + if (preg_match('/^http/', $poll->{'option' . $dtmf_result})) { $agi->verbose('chamar API', 25); @@ -532,7 +582,7 @@ public function send($agi, &$MAGNUS, &$CalcAgi) } //si esta hangup en la opcion, corlgar. - else if (preg_match('/hangup/', $poll->{'option' . $dtmf_result})) { + else if ($poll->{'option' . $dtmf_result} == 'hangup') { $agi->verbose('desligar chamadas', 25); @@ -588,8 +638,8 @@ public function send($agi, &$MAGNUS, &$CalcAgi) } else { - $fields = "id_campaign_poll,resposta,number,city"; - $values = "'$poll->id', '$dtmf_result', '$destination', '$phonenumberCity'"; + $fields = "id_campaign_poll,resposta,number,city,resposta_text"; + $values = "'$poll->id', '$dtmf_result', '$destination', '$phonenumberCity','" . strtok($poll->{'option' . $dtmf_result}, '#') . "'"; $sql = "INSERT INTO pkg_campaign_poll_info ($fields) VALUES ($values)"; $agi->exec($sql); @@ -610,6 +660,10 @@ public function send($agi, &$MAGNUS, &$CalcAgi) } } + if (preg_match('/hangup/', $poll->{'option' . $dtmf_result})) { + break; + } + } else { $agi->verbose('Cliente no marco nada', 8); break;