Fixed some errors and warnings exposed by PHP5.

git-svn-id: http://voip.null.ro/svn/yate@742 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2006-04-07 20:23:43 +00:00
parent 5629245e44
commit 7e1e297bce
3 changed files with 27 additions and 25 deletions

View File

@ -139,14 +139,14 @@ while ($state != "") {
case "incoming":
switch ($ev->name) {
case "call.execute":
$partycallid = $ev->params["id"];
$partycallid = $ev->GetValue("id");
$ev->params["targetid"] = $ourcallid;
$ev->handled = true;
/* We must ACK this message before dispatching a call.answered */
$ev->Acknowledge();
/* Check if the mailbox exists, answer only if that's the case */
if (checkUser($ev->params["called"],$ev->params["caller"])) {
if (checkUser($ev->GetValue("called"),$ev->GetValue("caller"))) {
$m = new Yate("call.answered");
$m->params["id"] = $ourcallid;
$m->params["targetid"] = $partycallid;
@ -162,7 +162,7 @@ while ($state != "") {
break;
case "chan.notify":
if ($ev->params["targetid"] == $ourcallid) {
if ($ev->GetValue("targetid") == $ourcallid) {
gotNotify();
$ev->handled = true;
}
@ -174,16 +174,16 @@ while ($state != "") {
$ev->Acknowledge();
break;
case "answer":
Yate::Output("PHP Answered: " . $ev->name . " id: " . $ev->id);
// Yate::Debug("PHP Answered: " . $ev->name . " id: " . $ev->id);
break;
case "installed":
Yate::Output("PHP Installed: " . $ev->name);
// Yate::Debug("PHP Installed: " . $ev->name);
break;
case "uninstalled":
Yate::Output("PHP Uninstalled: " . $ev->name);
// Yate::Debug("PHP Uninstalled: " . $ev->name);
break;
default:
Yate::Output("PHP Event: " . $ev->type);
// Yate::Output("PHP Event: " . $ev->type);
}
}

View File

@ -36,11 +36,11 @@ function vmGetMessageStats($mailbox,&$total,&$unread,$type = "voicemail")
if (is_dir($dir) && ($d = @opendir($dir))) {
while (($f = readdir($d)) !== false) {
if (substr($f,0,4) == "nvm-") {
Yate::Output("found new file '$f'");
Yate::Debug("found new file '$f'");
$n++;
}
else if (substr($f,0,3) == "vm-") {
Yate::Output("found old file '$f'");
Yate::Debug("found old file '$f'");
$o++;
}
}
@ -55,13 +55,15 @@ function vmGetMessageFiles($mailbox,&$files)
global $vm_base;
$dir = "$vm_base/$mailbox";
if (is_dir($dir) && ($d = @opendir($dir))) {
$nf = array();
$of = array();
while (($f = readdir($d)) !== false) {
if (substr($f,0,4) == "nvm-") {
Yate::Output("found new file '$f'");
Yate::Debug("found new file '$f'");
$nf[] = $f;
}
else if (substr($f,0,3) == "vm-") {
Yate::Output("found old file '$f'");
Yate::Debug("found old file '$f'");
$of[] = $f;
}
}

View File

@ -65,7 +65,7 @@ function setState($newstate)
if ($state == "")
return;
Yate::Output("setState('$newstate') state: $state");
Yate::Debug("setState('$newstate') state: $state");
// always obey a return to prompt
switch ($newstate) {
@ -163,7 +163,7 @@ function initUser()
vmInitMessageDir($mailbox);
vmGetMessageFiles($mailbox,$files);
$dir = "$vm_base/$mailbox";
Yate::Output("found " . count($files) . " file entries");
Yate::Output("found " . count($files) . " file entries for mailbox $mailbox");
setState("prompt");
}
@ -198,7 +198,7 @@ function checkAuth($pass)
global $collect_user;
global $collect_pass;
global $mailbox;
// Yate::Output("checking passwd if '$collect_pass' == '$pass'");
// Yate::Debug("checking passwd if '$collect_pass' == '$pass'");
if ($collect_pass == $pass) {
$mailbox = $collect_user;
initUser();
@ -215,7 +215,7 @@ function gotNotify()
global $partycallid;
global $state;
Yate::Output("gotNotify() state: $state");
Yate::Debug("gotNotify() state: $state");
switch ($state) {
case "goodbye":
@ -290,7 +290,7 @@ function gotDTMF($text)
global $collect_user;
global $collect_pass;
Yate::Output("gotDTMF('$text') state: $state");
Yate::Debug("gotDTMF('$text') state: $state");
switch ($state) {
case "user":
@ -334,8 +334,8 @@ while ($state != "") {
case "incoming":
switch ($ev->name) {
case "call.execute":
$mailbox = $ev->params["user"];
$partycallid = $ev->params["id"];
$mailbox = $ev->GetValue("user");
$partycallid = $ev->GetValue("id");
$ev->params["targetid"] = $ourcallid;
$ev->handled = true;
/* We must ACK this message before dispatching a call.answered */
@ -357,15 +357,15 @@ while ($state != "") {
break;
case "chan.notify":
if ($ev->params["targetid"] == $ourcallid) {
if ($ev->GetValue("targetid") == $ourcallid) {
gotNotify();
$ev->handled = true;
}
break;
case "chan.dtmf":
if ($ev->params["targetid"] == $ourcallid ) {
$text = $ev->params["text"];
if ($ev->GetValue("targetid") == $ourcallid ) {
$text = $ev->GetValue("text");
for ($i = 0; $i < strlen($text); $i++)
gotDTMF($text[$i]);
$ev->handled = true;
@ -378,18 +378,18 @@ while ($state != "") {
$ev->Acknowledge();
break;
case "answer":
Yate::Output("PHP Answered: " . $ev->name . " id: " . $ev->id);
// Yate::Debug("PHP Answered: " . $ev->name . " id: " . $ev->id);
if ($ev->name == "user.auth")
checkAuth($ev->retval);
break;
case "installed":
Yate::Output("PHP Installed: " . $ev->name);
// Yate::Debug("PHP Installed: " . $ev->name);
break;
case "uninstalled":
Yate::Output("PHP Uninstalled: " . $ev->name);
// Yate::Debug("PHP Uninstalled: " . $ev->name);
break;
default:
Yate::Output("PHP Event: " . $ev->type);
// Yate::Output("PHP Event: " . $ev->type);
}
}