X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=route.c;h=da59e987b806d78945b5b6333a0f1d75dd968afc;hp=8d821ecce0e9ad9c2a6e62592d9461fd895814cd;hb=6bf7c7f9db360d6031417b012dcb0e90e2251cd6;hpb=aaf6f200d7be63838fc2ad6ed818773b55a681fb diff --git a/route.c b/route.c index 8d821ec..da59e98 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; @@ -2002,7 +2022,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) case MATCH_PORT: if (ea_endpoint->ep_portlist) - if ((ea_endpoint->ep_portlist->port_type & PORT_CLASS_mISDN_MASK) != PORT_CLASS_mISDN_DSS1) + if ((ea_endpoint->ep_portlist->port_type & PORT_CLASS_MASK) != PORT_CLASS_mISDN) break; integer = e_callerinfo.isdn_port; goto match_integer;