X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=route.c;h=017a55c36719f74b3b4cc743224ffdfe9f285fb3;hp=8d821ecce0e9ad9c2a6e62592d9461fd895814cd;hb=64143650bc9c04fadc99694c499cf34750bc2804;hpb=7e2b25feda9872e0aea63bb227f70600a8d36130 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=", "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;