Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions setup/dialer_process/dialer/AMIClientConn.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@ function procesarPaquete()
// Implementación de wait_response para compatibilidad con phpagi-asmanager
private function wait_response()
{
$iMaxWait = 30;
$iWaitStart = time();
while (!is_null($this->sKey) && is_null($this->_response)) {
$this->multiplexSrv->procesarActividad(1);

Expand All @@ -350,6 +352,12 @@ private function wait_response()
}
}
$this->_listaEventos = $t;

if ((time() - $iWaitStart) > $iMaxWait) {
if (!is_null($this->oLogger))
$this->oLogger->output('WARN: '.__METHOD__.' AMI response timeout ('.$iMaxWait.'s), skipping');
return NULL;
}
}
if (!is_null($this->_response)) {
$r = $this->_response;
Expand Down Expand Up @@ -543,8 +551,8 @@ public function __call($name, $args)
private function _emulate_sync_response($paquete)
{
if (!is_null($this->_response)) {
$this->oLogger->output("ERR: '.__METHOD__.' segundo Response sobreescribe primer Response no procesado: ".
print_r($this->_response, 1));
if (!is_null($this->oLogger))
$this->oLogger->output("WARN: ".__METHOD__." segundo Response, primer Response descartado");
}
$this->_response = $paquete;
}
Expand Down Expand Up @@ -651,16 +659,17 @@ private function process_event($parameters)
} elseif (isset($parameters['Response'])) {
if (count($this->_queue_requests) <= 0) {
if (!is_null($this->oLogger)) {
$this->oLogger->output('ERR: '.__METHOD__.' se pierde respuesta porque no hay callback encolado: '.
print_r($parameters, TRUE));
$this->oLogger->output('WARN: '.__METHOD__.' response sin callback - ignorando');
}
return FALSE;
return TRUE;
}

$callback_info = array_shift($this->_queue_requests);
if (!is_null($callback_info[0])) {
if (!is_null($this->oLogger))
$this->oLogger->output('ERR: '.__METHOD__.' petición head NO ha sido enviada: '.$callback_info[0]);
$this->oLogger->output('WARN: '.__METHOD__.' petición head NO ha sido enviada, enviando siguiente');
$this->_send_next_request();
return TRUE;
}
$handler = $callback_info[1];
$handler_params = $callback_info[2];
Expand Down
6 changes: 6 additions & 0 deletions setup/dialer_process/dialer/AMIEventProcess.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,12 @@ private function _ejecutarOriginate($sFuente, $sActionID, $iTimeoutOriginate,
return;
}

if (is_null($this->_ami)) {
$this->_log->output('ERR: '.__METHOD__." AMI connection not ready, originate cancelled (actionid=$sActionID)");
$this->_tuberia->enviarRespuesta($sFuente, FALSE);
return;
}

// Luego de llamar a este método, el status debería haber cambiado a Placing
$r = $llamada->marcarLlamada($this->_ami, $sFuente, $iTimeoutOriginate,
$iTimestampInicioOriginate, $sContext, $sCID, $sCadenaVar, $retry,
Expand Down