Hola !
I just want to show how this "patch" was finally done in case somebody has something similar to do.
Class.A2Billing.php file:
In the A2Billing Class the public var $conTonoA was added in order to be read from ClassRateEngine.php.
Code:
$Q = "SELECT ani FROM Anis where ani='".$ani."' AND tipo='TonoA'";
if ($this->agiconfig['debug']>=1) $agi->verbose($Q);
$resultadoa = $this->instance_table -> SQLExec ($this->DBHandle, $Q);
if ($this->agiconfig['debug']>=1) $agi->verbose($result);
$this->write_log("Debug info: TonoA query {$Q}: $resultadoa");
if($resultadoa != 0){
$this->write_log("DTMF A has to be sended");
// The following var is going to be read in Clase RateEngine
$this->esTonoA='si';
}
In ClassRateEngine.php:
Code:
$prefix = $this -> ratecard_obj[$k][$usetrunk+1];
$tech = $this -> ratecard_obj[$k][$usetrunk+2];
$ipaddress = $this -> ratecard_obj[$k][$usetrunk+3];
$removeprefix = $this -> ratecard_obj[$k][$usetrunk+4];
$timeout = $this -> ratecard_obj[$k]['timeout'];
$musiconhold = $this -> ratecard_obj[$k][39];
$failover_trunk = $this -> ratecard_obj[$k][40+$usetrunk_failover];
$addparameter = $this -> ratecard_obj[$k][42+$usetrunk_failover];
if (strncmp($destination, $removeprefix, strlen($removeprefix)) == 0)
$destination= substr($destination, strlen($removeprefix));
$dialparams = str_replace("%timeout%", $timeout *1000, $A2B->agiconfig['dialcommand_param']);
// Dial() Modification either for Jail originated calls or Calls where DTMF A // has to be played. Matias Rollan Patch
$paracarcel = $A2B->escarcel;
if($paracarcel == 'pacific'){ // Jail msg
$stringdial = "A($paracarcel)";
$A2B -> write_log("Debug: StringDial $stringdial");
$dialparams = str_replace("%carcel%", $paracarcel, $dialparams);
$A2B->write_log("Debug: Parameter: $dialparams");
}else{
// DTMF A to be played
$mitonoA = $A2B->esTonoA;
if($mitonoA == 'si'){
$A2B -> write_log("Debug: DTMF A is going to be added to Dial()");
$tono = "D(wAA:wAA)"; // DTMF As
$dialparams = str_replace("%carcel%", $tono, $dialparams);
$A2B->write_log("Debug: Dialparams $dialparams");
}else{
$dialparams = str_replace("%carcel%", '', $dialparams);
$A2B->write_log("Debug: Regular Dial() : $dialparams");
}
}
And as in my first post regarding the Jail message I change the /etc/asterisk/a2billing.conf the Dial() line:
Code:
dialcommand_param="|45|rHL(%timeout%:61000:00000)%carcel%"
So everytime a call is originated from the CallerIDs listed in Anis table with tipo field equal to:
- 'carcel' the A(audio_file_for_jail) is replaced in the Dial
- 'TonoA' the D(wAA:wAA) is concatenated in the Dial
The coding is ugly but is working perfectly well in my platform I just wanted to share it.
--
Matias Rollan
<
[email protected]> || <
[email protected]>[/code][/quote]