Exemplo n.º 1
0
        $ev->handled = true;
        return true;
    }
    if ($error) {
        $ev->params["error"] = $error;
        //	$ev->handled = true;
    }
    return false;
}
// Always the first action to do
Yate::Init();
if ($debug_on) {
    Yate::Debug(true);
    Yate::Output(true);
}
if (Yate::Arg()) {
    Yate::Output("Executing startup time CDR cleanup");
    $query = "UPDATE call_logs SET ended= 1 where ended = 0 or ended IS NULL";
    query_nores($query);
    $query = "UPDATE extensions SET inuse_count=0";
    query_nores($query);
    // Spawn another, restartable instance
    $cmd = new Yate("engine.command");
    $cmd->id = "";
    $cmd->SetParam("line", "external register.php");
    $cmd->Dispatch();
    sleep(1);
    exit;
}
// Install handler for the wave end notify messages
Yate::Watch("engine.timer");
Exemplo n.º 2
0
/* Ringback provider for the Yate PHP interface
   Add in extmodule.conf

   [scripts]
   ringback.php=RINGBACK

   where RINGBACK is a wave or autorepeat temporary tone resource like:
      tone/*ring  (this is the default)
      wave/play/path/to/custom.au
*/
require_once "libyate.php";
// A fixed format is needed as we can't know what the called will offer
$mediafmt = "mulaw";
Yate::Init();
//Yate::Debug(true);
$ringback = Yate::Arg();
if ($ringback == "") {
    $ringback = "tone/*ring";
}
Yate::Install("call.ringing", 50);
Yate::Watch("call.ringing");
Yate::SetLocal("restart", true);
for (;;) {
    $ev = Yate::GetEvent();
    if ($ev === false) {
        break;
    }
    if ($ev === true) {
        continue;
    }
    $id = $ev->GetValue("peerid");
Exemplo n.º 3
0
    if ($l) {
        if ($l == "banbrutes") {
            $retval = "{$banHelp}Automatically block brute force attackers\r\n";
            return true;
        }
        return false;
    }
    $retval .= $banHelp;
    return false;
}
Yate::Init();
// Comment the next line to get output only in logs, not in rmanager
Yate::Output(true);
// Uncomment the next line to get debugging details by default
//Yate::Debug(true);
$n = round(1 * Yate::Arg());
if ($n >= 2) {
    $ban_failures = $n;
}
Yate::SetLocal("trackparam", "banbrutes");
Yate::Watch("user.auth");
Yate::Watch("user.authfail");
Yate::Watch("engine.timer");
Yate::Install("engine.command", 120);
Yate::Install("engine.help", 150);
Yate::SetLocal("restart", true);
for (;;) {
    $ev = Yate::GetEvent();
    if ($ev === false) {
        break;
    }
Exemplo n.º 4
0
    if ($chan == "") {
        return;
    }
    switch ($ev->GetValue("operation")) {
        case "initialize":
            // Remember the called number for this call leg
            $calls[$chan] = $ev->GetValue("called");
            break;
        case "finalize":
            // Forget about the call leg that got hung up
            unset($calls[$chan]);
            break;
    }
}
$calls = array();
$prefix = Yate::Arg();
if ($prefix == "") {
    // Hope this is a sensible default - else set a prefix from extmodule.conf
    $prefix = "#8";
    Yate::Output("Pickup prefix not set, using default '{$prefix}'");
}
Yate::SetLocal("trackparam", "pickup.php");
Yate::Install("call.route", 35);
Yate::Install("call.cdr", 110, "direction", "outgoing");
Yate::SetLocal("restart", true);
for (;;) {
    $ev = Yate::GetEvent();
    if ($ev === false) {
        break;
    }
    if ($ev === true) {