Exemplo n.º 1
0
/* Always the first action to do */
Yate::Init();
/* Install a handler for the engine generated timer message */
Yate::Install("engine.timer", 10);
/* Create and dispatch an initial test message */
$m = new Yate("test");
$m->params["param1"] = "val1";
$m->retval = "ret_value";
$m->Dispatch();
Yate::GetLocal("engine.version");
Yate::GetLocal("engine.nodename");
Yate::GetLocal("engine.nosuch");
Yate::SetLocal("engine.nodename", "error because is readonly");
Yate::GetLocal("config.nosuch");
Yate::GetLocal("config.localsym");
Yate::GetLocal("config.localsym.h323chan.yate");
Yate::SetLocal("config.localsym.h323chan.yate", "r/o error too");
/* The main loop. We pick events and handle them */
for (;;) {
    $ev = Yate::GetEvent();
    /* If Yate disconnected us then exit cleanly */
    if ($ev === false) {
        break;
    }
    /* Empty events are normal in non-blocking operation.
       This is an opportunity to do idle tasks and check timers */
    if ($ev === true) {
        Yate::Output("PHP event: empty");
        continue;
    }
    /* If we reached here we should have a valid object */