Hello !
Finally my modification is working properly !
I will try to explain the reason why I needed this, basically it's because of a regulation in my country that tells you "every call originated from jail has to warn the called party that is coming from prision".
So what I did was create a new table:
mysql> describe Anis;
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| ani | varchar(100) | | PRI | | |
| tipo | varchar(50) | YES | | NULL | |
| recargo | varchar(10) | YES | | NULL | |
+---------+--------------+------+-----+---------+-------+
That will help me in the future for other stuff, in this case ani is the callerid from all the jails, "tipo" would be "type" in this case "carcel" [ jail in spanish ], and "recargo" would be charge [I will use it then for other purpose ].
Then what I did as asiby recommend me was to use the A(audio_file) in the Dial inside of /etc/asterisk/a2billing.conf:
dialcommand_param="|30|rHL(%timeout%:61000:00000)A(%carcel%)"
Then in Class.A2Billing.php inside of the function callingcard_ivr_authenticate() I added the following code:
$carcel = 'silence/1';
$this->escarcel = $carcel;
$ani = $this->CallerID;
$QUERYMAT = "SELECT ani FROM Anis where ani='".$ani."' AND tipo='carcel'";
if ($this->agiconfig['debug']>=1) $agi->verbose($QUERYMAT);
$matresult = $this->instance_table -> SQLExec ($this->DBHandle, $QUERYMAT);
if ($this->agiconfig['debug']>=1) $agi->verbose($result);
if($matresult != 0){ // viene de una carcel
$carcel = 'warn_jail_audio';
$this->escarcel=$carcel;
$this->write_log("WARNING: $ani is coming from prision!!!");
}
I defined the var $escarcel in the Class A2Billing to be able to read it from Class.RateEngine.php where I added this code:
// Added by Matias Rollan to replace %carcel% in /etc/asterisk/a2billing.conf to either the warn_jail_audio or just a silence
$pepe = $A2B->escarcel;
$A2B -> write_log("MATIAS PEPE: escarcel $pepe");
$dialparams = str_replace("%carcel%", $pepe, $dialparams);
I hope this all helps, if you are interested in the code I will post it in:
http://www.pranaone.com/dev/a2billing/
--
Matias Rollan