summaryrefslogtreecommitdiffstats
path: root/route.c
diff options
context:
space:
mode:
authorAndreas Eversberg2009-04-06 20:20:09 +0200
committerAndreas Eversberg2009-04-06 20:20:09 +0200
commit64143650bc9c04fadc99694c499cf34750bc2804 (patch)
tree1a26819112d615bbe1dbc7058382122e94fc0352 /route.c
parentMini-Fix: don't read settings, where not required. (diff)
downloadlcr-64143650bc9c04fadc99694c499cf34750bc2804.tar.gz
lcr-64143650bc9c04fadc99694c499cf34750bc2804.tar.xz
lcr-64143650bc9c04fadc99694c499cf34750bc2804.zip
Applied patch by Daniel: "execute"-action can now be performed on call init or on call hangup. A special parameter allows that.
-> Forking of executed program is now performed without getting zombie process. modified: README modified: action.cpp modified: apppbx.h modified: route.c modified: route.h
Diffstat (limited to 'route.c')
-rw-r--r--route.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/route.c b/route.c
index 8d821ec..017a55c 100644
--- a/route.c
+++ b/route.c
@@ -239,6 +239,9 @@ struct param_defs param_defs[] = {
{ PARAM_EXTEN,
"exten", PARAM_TYPE_STRING,
"exten=<extension>", "Give exten parameter to the remote application. (overrides dialed number)"},
+ { PARAM_ON,
+ "on", PARAM_TYPE_STRING,
+ "on=[init|hangup]", "Defines if the action is executed on call init or on hangup."},
{ 0, NULL, 0, NULL, NULL}
};
@@ -347,8 +350,8 @@ struct action_defs action_defs[] = {
NULL},
// "The call forward is set within the telephone network of the external line."},
{ ACTION_EXECUTE,
- "execute", NULL, NULL, &EndpointAppPBX::action_hangup_execute,
- PARAM_CONNECT | PARAM_EXECUTE | PARAM_PARAM,
+ "execute", &EndpointAppPBX::action_init_execute, NULL, &EndpointAppPBX::action_hangup_execute,
+ PARAM_CONNECT | PARAM_EXECUTE | PARAM_PARAM | PARAM_ON,
"Executes the given script file. The file must terminate quickly, because it will halt the PBX."},
{ ACTION_FILE,
"file", NULL, NULL, &EndpointAppPBX::action_hangup_file,
@@ -1684,6 +1687,7 @@ struct route_ruleset *ruleset_parse(void)
case PARAM_TYPE_DESTIN:
case PARAM_TYPE_TYPE:
case PARAM_TYPE_YESNO:
+ case PARAM_TYPE_ON:
key[0] = '\0';
if (*p==',' || *p==' ' || *p=='\0')
{
@@ -1722,6 +1726,22 @@ struct route_ruleset *ruleset_parse(void)
SPRINT(failure, "Caller ID type '%s' unknown.", key);
goto parse_error;
}
+ if (param_defs[index].type == PARAM_TYPE_ON)
+ {
+ param->value_type = VALUE_TYPE_INTEGER;
+ if (!strcasecmp(key, "init"))
+ {
+ param->integer_value = INFO_ON_INIT;
+ break;
+ }
+ if (!strcasecmp(key, "hangup"))
+ {
+ param->integer_value = INFO_ON_HANGUP;
+ break;
+ }
+ SPRINT(failure, "Execute on '%s' unknown.", key);
+ goto parse_error;
+ }
if (param_defs[index].type == PARAM_TYPE_CAPABILITY)
{
param->value_type = VALUE_TYPE_INTEGER;