From 53d36427e3d5bf43c2a159667daf72c6c2dbff7a Mon Sep 17 00:00:00 2001 From: paulc Date: Tue, 25 Oct 2011 08:54:04 +0000 Subject: [PATCH] Added a PHP Yate::GetLocal cleaner shortcut to retrieve a local parameter. Added libyate.php tests for GetLocal. git-svn-id: http://voip.null.ro/svn/yate@4652 acf43c95-373e-0410-b603-e72c3f656dc1 --- share/scripts/libyate.php | 9 +++++++++ share/scripts/test.php | 10 +++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/share/scripts/libyate.php b/share/scripts/libyate.php index 093f1ab4..b0cf12bc 100644 --- a/share/scripts/libyate.php +++ b/share/scripts/libyate.php @@ -223,6 +223,15 @@ class Yate _yate_print("%%>setlocal:$name:$value\n"); } + /** + * Asynchronously retrieve a local module parameter + * @param $name Name of the parameter to read + */ + static function GetLocal($name) + { + Yate::SetLocal($name, ""); + } + /** * Constructor. Creates a new outgoing message * @param $name Name of the new message diff --git a/share/scripts/test.php b/share/scripts/test.php index 0c983373..cbf8346f 100755 --- a/share/scripts/test.php +++ b/share/scripts/test.php @@ -20,10 +20,14 @@ $m->params["param1"]="val1"; $m->retval="ret_value"; $m->Dispatch(); -Yate::SetLocal("engine.version",""); -Yate::SetLocal("engine.nodename",""); -Yate::SetLocal("engine.nosuch",""); +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 (;;) {