Added $(message,retval) function, retval and noop targets.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6165 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2017-01-17 15:47:54 +00:00
parent 3a18112a7f
commit 01ab5f4b5d
2 changed files with 11 additions and 1 deletions

View File

@ -57,6 +57,7 @@
; $(message,name) = name of the message handled
; $(message,time) = time of the message handled, seconds since UNIX Epoch
; $(message,broadcast) = true if the message is a broadcast, false otherwise
; $(message,retval) = string return value of the cirrent message
; $(message,count) = parameter count of the message handled
; $(message,parameters) = parameter list of the message handled, comma separated
; $(message,parameters,sep) = parameter list of the message handled, explicit separator
@ -186,12 +187,14 @@
; jump, goto - jumps to another context, does not return to this context
; match - modify the matched string instead of specifying a target
; rename - changes the name of the message
; retval - sets the returned string value of the message
; enqueue - puts a new message in the engine, parameters are taken from the
; old message but placed in the new one
; dispatch - dispatches a new message in the engine waiting for it to return,
; parameters are taken from the old message but placed in the new one
; echo, output - displays that line after making substitutions
; debug - displays line as a debug after making substitutions
; noop - no action but evaluates rest of target for side effects
; { - starts a block that ends on another line with }
; The @jump, @goto, @include and @call forms suppress warning if missing target
;

View File

@ -381,6 +381,8 @@ static void evalFunc(String& str, Message& msg)
str = msg.msgTime().sec();
else if (par == YSTRING("broadcast"))
str = msg.broadcast();
else if (par == YSTRING("retval"))
str = msg.retValue();
else if (par == YSTRING("count"))
str = msg.count();
else if (par == YSTRING("parameters")) {
@ -776,7 +778,7 @@ static bool oneContext(Message &msg, String &str, const String &context, String
setMessage(match,msg,val);
warn = true;
val.trimBlanks();
if (val.null()) {
if (val.null() || val.startSkip("noop")) {
// special case: do nothing on empty target
continue;
}
@ -815,6 +817,11 @@ static bool oneContext(Message &msg, String &str, const String &context, String
msg = val;
}
}
else if (val.startSkip("retval")) {
NDebug("RegexRoute",DebugAll,"Setting retValue length %u by rule #%u '%s' in context '%s'",
val.length(),i+1,n->name().c_str(),context.c_str());
ret = val;
}
else {
DDebug("RegexRoute",DebugAll,"Returning '%s' for '%s' in context '%s' by rule #%u '%s'",
val.c_str(),str.c_str(),context.c_str(),i+1,n->name().c_str());