Exemple #1
0
         }
     }
     $ev->Acknowledge();
     break;
 case "answer":
     if ($ev->name == "call.answered" || $ev->name == "chan.replaced") {
         $text = "";
         if (getBoolValue($ev->getValue($param), false)) {
             $text = $ev->getValue($param . "_text");
         }
         if (!empty($text)) {
             $id = "id";
             if ($ev->name == "chan.replaced") {
                 $id = "newid";
             }
             callAnswered($ev, $text, $id);
         }
     }
     break;
 case "watched":
     Yate::Debug($param . ": Watching " . $ev->name);
     break;
 case "installed":
     Yate::Debug($param . ": Installed " . $ev->name);
     break;
 case "uninstalled":
     Yate::Debug($param . ": Uninstalled " . $ev->name);
     break;
 case "setlocal":
     Yate::Debug($param . ": Parameter " . $ev->name . "=" . $ev->retval . ($ev->handled ? " (OK)" : " (error)"));
     break;
     $ev->handled = true;
     // Dispatch outgoing call.execute before acknowledging this one
     $m = new Yate("call.execute");
     $m->SetParam("id", $ourcallid);
     $m->SetParam("callto", $ev->GetValue("direct"));
     $m->SetParam("caller", $caller);
     $m->SetParam("callername", $callername);
     $m->SetParam("called", $called);
     // No need to track us, this is an utility channel
     $m->SetParam("cdrtrack", false);
     // Active DTMF detector on outgoing call leg
     $m->SetParam("tonedetect_out", true);
     $m->Dispatch();
     break;
 case "call.answered":
     callAnswered();
     $ev->handled = true;
     break;
 case "chan.notify":
     callFailed("noanswer");
     $ev->handled = true;
     break;
 case "chan.dtmf":
     gotDTMF($ev->GetValue("text"));
     $ev->handled = true;
     break;
 case "chan.disconnected":
     callFailed($ev->GetValue("reason"));
     /* Put it back running to avoid double destruction... */
     $running = true;
     $ev->handled = true;