- Add a new dialplan application (see Dialplan Applications).
Creating a new dialplan application
- Assign an internal number, for example, 2200110.
Parameters for dialplan
- Insert the following code into the "Programme Code" tab:
<?php
require_once 'Globals.php';
use \MikoPBX\Core\Asterisk\AGI;
use MikoPBX\Core\System\Notifications;
use MikoPBX\Core\System\{MikoPBXConfig};
$agi = new AGI();
$faxFile = "/tmp/" .$agi->get_variable("CDR(linkedid)", true).'.tiff';
$caller = $agi->get_variable("CALLERID(num)", true);
$agi->exec("ReceiveFax", "{$faxFile},d");
$result = $agi->get_variable("FAXOPT(status)", true);
if($result === 'SUCCESS' && file_exists($faxFile)){
$notify = new Notifications();
$notify->sendMail('your-email@gmail.com', 'Fax msg from '.$caller, 'Incoming fax <br><br>', $faxFile);
unlink($faxFile);
}
sleep(1);
{% hint style="success" %} In the code, replace 'your-email@gmail.com' with your own email address. {% endhint %}
Code for dialplan
- Go to the "System file customization" section.
System file customization section.
- Open the "extensions.conf" file for editing.
extensions.conf file
- Add the folowwing code to the end of file:
[SIP-1687941868-incoming](+)
exten => fax,1,Goto(internal,2200100,1)
Replace "2200100" with the number of your application.
In the code, replace "SIP-1687941868" with your provider's ID. You can find it in the provider's card in the browser's address bar.
Provider ID
- Open the "modules.conf" file for editing.
Modules.conf file
- Add the following code to the end of the file:
load => res_fax.so
load => res_fax_spandsp.so
Code for Modules.conf
- In the provider's card, in the advanced settings, in additional parameters, specify:
[endpoint]
fax_detect=yes
fax_detect_timeout=30
Additional parameters in Provider section