|
@@ -4648,28 +4648,30 @@ In logical evaluation expressions:
|
|
|
- Negative is FALSE
|
|
|
- Positive is TRUE
|
|
|
|
|
|
-If no value is specified, or a route reaches its end without executing a
|
|
|
-return statement, it returns 1. If return is used in the top level route
|
|
|
-is equivalent with exit `[val]`.
|
|
|
+If no value is specified, it returns 1. If return is used in the top level route
|
|
|
+is equivalent with exit `[val]`. If no `return` is at the end of the routing block,
|
|
|
+the return code is the value of the last executed action, therefore it is highly
|
|
|
+recommended to return an explicit value (e.g., `return(1)`) to avoid unexpected
|
|
|
+config execution.
|
|
|
|
|
|
Example usage:
|
|
|
|
|
|
``` c
|
|
|
request_route {
|
|
|
if (route(RET)) {
|
|
|
- xlog("L_NOTICE","method $rm is INVITE\n");
|
|
|
+ xlog("L_NOTICE","method $rm is INVITE\n");
|
|
|
} else {
|
|
|
- xlog("L_NOTICE","method $rm is REGISTER\n");
|
|
|
+ xlog("L_NOTICE","method $rm is REGISTER\n");
|
|
|
};
|
|
|
}
|
|
|
|
|
|
route[RET] {
|
|
|
if (is_method("INVITE")) {
|
|
|
- return(1);
|
|
|
+ return(1);
|
|
|
} else if (is_method("REGISTER")) {
|
|
|
- return(-1);
|
|
|
+ return(-1);
|
|
|
} else {
|
|
|
- return(0);
|
|
|
+ return(0);
|
|
|
};
|
|
|
}
|
|
|
```
|
|
@@ -5125,7 +5127,7 @@ Example of usage:
|
|
|
}
|
|
|
```
|
|
|
|
|
|
-### route
|
|
|
+### route block
|
|
|
|
|
|
This block is used to define 'sub-routes' - group of actions that can be
|
|
|
executed from another routing block. Originally targeted as being
|
|
@@ -5177,6 +5179,10 @@ number of recursive levels, avoiding ending up in infinite loops -- see
|
|
|
The sub-route blocks allow to make the configuration file modular,
|
|
|
simplifying the logic and helping to avoid duplication of actions.
|
|
|
|
|
|
+If no `return` is at the end of the routing block, the return code is the value
|
|
|
+of the last executed action, therefore it is highly recommended to return an
|
|
|
+explicit value (e.g., `return(1)`) to avoid unexpected config execution.
|
|
|
+
|
|
|
### branch_route
|
|
|
|
|
|
Request's branch routing block. It contains a set of actions to be taken
|