Esempio n. 1
0
                                $res = query_to_array($query);
                                $query2 = "SELECT value FROM ntn_settings WHERE param = 'unanswered_incoming_call' AND value = 'true'";
                                $res2 = query_to_array($query2);
                                if (count($res2)) {
                                    $unanswered_incoming_call = true;
                                }
                                $query3 = "SELECT value FROM ntn_settings WHERE param = 'unanswered_order_call' AND value = 'true'";
                                $res3 = query_to_array($query3);
                                if (count($res3)) {
                                    $unanswered_order_call = true;
                                    $query4 = "SELECT * FROM call_logs WHERE billid = '" . $ev->GetValue('billid') . "' AND SUBSTRING(chan,1, 11) = 'order_call/'";
                                    $res4 = query_to_array($query4);
                                    if (count($res4)) {
                                        $existence_order_call = true;
                                    }
                                }
                            }
                            if (count($res) || $unanswered_incoming_call && $ev->GetValue('status') != 'answered' || $unanswered_order_call && $ev->GetValue('status') != 'answered' && $existence_order_call == true) {
                                $text = format_msg($text, $params);
                                $subject = format_msg($subject, $params);
                                send_mail(getValueFromNtnSettings('from', ''), getValueFromNtnSettings('password', ''), getValueFromNtnSettings('fromname', ''), getValueFromNtnSettings('email', ''), $subject, $text, $filename);
                            }
                        }
                    }
                }
                // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                break;
        }
    }
}
Yate::Debug('PHP: bye!');
Esempio n. 2
0
set_time_limit(600);
function debug($msg)
{
    Yate::Debug('send_voicem.php: ' . $msg);
}
$filename = $argv[1];
if (!is_file($filename)) {
    die;
}
$dir = dirname($filename);
$user = substr($dir, -3);
$args = basename($filename, '.mp3');
$args_arr = explode('-', $args);
if (count($args_arr) < 4) {
    die;
}
$caller = $args_arr[3];
$ftime = $args_arr[1] . ' ' . $args_arr[2];
$query = "SELECT address FROM extensions WHERE extension = '{$user}'";
$res = query_to_array($query);
$address = $res[0]["address"];
/*
$address   - адрес получателя письма
$filename  - путь и имя аудиофайла

$caller    - телефонный номер звонившего
$ftime     - дата и время совершения вызова
*/
$sda_SUBJECT = $ftime . ' ПРОПУЩЕННЫЙ ВХ. вызов ОТ номера ' . $caller;
send_mail(getValueFromNtnSettings('from', ''), getValueFromNtnSettings('password', ''), getValueFromNtnSettings('fromname', ''), $address, $sda_SUBJECT, null, $filename);