X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=route.c;h=8217ff14ccf50d07a7ef61259945b042580dbdc1;hp=aaa560634b2e14850ce897e4617f78f981993ccc;hb=0eebd3a28e968844ec459298ac36e16305cc07bb;hpb=8fb861ef9ece9f4bd68ef79a77625ec23c27aef1 diff --git a/route.c b/route.c index aaa5606..8217ff1 100644 --- a/route.c +++ b/route.c @@ -1890,6 +1890,8 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) struct route_action *action = NULL; unsigned long comp_len; int j, jj; + char isdn_port[10]; + char *argv[11]; /* check also number of args below */ char callerid[64], callerid2[64], redirid[64]; int integer; char *string; @@ -1900,6 +1902,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) struct admin_list *admin; time_t now; struct tm *now_tm; + int pid2; /* reset timeout action */ e_match_to_action = NULL; @@ -1953,7 +1956,7 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) goto match_string_prefix; case MATCH_EXTENSION: - string = e_ext.name; + string = e_ext.number; goto match_string; case MATCH_DIALING: @@ -2068,8 +2071,26 @@ struct route_action *EndpointAppPBX::route(struct route_ruleset *ruleset) break; case MATCH_EXECUTE: - if (system(cond->string_value) == 0) - istrue = 1; + j = 0; +#if 0 + argv[j++] = (char *)"/bin/sh"; + argv[j++] = (char *)"-c"; + argv[j++] = cond->string_value; +#endif + argv[j++] = cond->string_value; + argv[j++] = e_extdialing; + argv[j++] = (char *)numberrize_callerinfo(e_callerinfo.id, e_callerinfo.ntype, options.national, options.international); + argv[j++] = e_callerinfo.extension; + argv[j++] = e_callerinfo.name; + SPRINT(isdn_port, "%d", e_callerinfo.isdn_port); + argv[j++] = isdn_port; + argv[j++] = e_callerinfo.imsi; + argv[j++] = NULL; /* check also number of args above */ + if (fork() == 0) { + if ((pid2 = fork()) == 0) { + execve(cond->string_value, argv, environ); + } + } break; case MATCH_DEFAULT: