X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=action.cpp;h=514c01600c5de1213b8334ee8c8874c23f3c90af;hp=aa83304fb84853f88440c52e77c16438ce34131f;hb=d19e69fe802e4d4be9fa488a4dd78ff25f0b4479;hpb=76c5d82d4cbdd9d75e6b6db9e51eb22d10fb44bd diff --git a/action.cpp b/action.cpp index aa83304..514c016 100644 --- a/action.cpp +++ b/action.cpp @@ -111,6 +111,8 @@ void EndpointAppPBX::action_dialing_internal(void) capainfo.bearer_mode = INFO_BMODE_PACKET; } capainfo.bearer_info1 = INFO_INFO1_NONE; + capainfo.hlc = INFO_HLC_NONE; + capainfo.exthlc = INFO_HLC_NONE; } if ((rparam = routeparam(e_action, PARAM_BMODE))) { capainfo.bearer_mode = rparam->integer_value; @@ -206,7 +208,7 @@ void EndpointAppPBX::action_dialing_external(void) memcpy(&redirinfo, &e_redirinfo, sizeof(redirinfo)); memset(&dialinginfo, 0, sizeof(dialinginfo)); dialinginfo.itype = INFO_ITYPE_ISDN; - dialinginfo.sending_complete = 0; +// dialinginfo.sending_complete = 0; SCPY(dialinginfo.id, e_extdialing); /* process prefix */ @@ -221,8 +223,6 @@ void EndpointAppPBX::action_dialing_external(void) /* process number complete */ if ((rparam = routeparam(e_action, PARAM_COMPLETE))) - if ((rparam = routeparam(e_action, PARAM_PREFIX))) - SCPY(dialinginfo.id, rparam->string_value); dialinginfo.sending_complete = 1; /* process number type */ @@ -237,6 +237,8 @@ void EndpointAppPBX::action_dialing_external(void) capainfo.bearer_mode = INFO_BMODE_PACKET; } capainfo.bearer_info1 = INFO_INFO1_NONE; + capainfo.hlc = INFO_HLC_NONE; + capainfo.exthlc = INFO_HLC_NONE; } if ((rparam = routeparam(e_action, PARAM_BMODE))) { capainfo.bearer_mode = rparam->integer_value; @@ -309,6 +311,8 @@ void EndpointAppPBX::action_dialing_external(void) /* add or update outgoing call */ trace_header("ACTION extern (calling)", DIRECTION_NONE); add_trace("number", NULL, dialinginfo.id); + if (dialinginfo.sending_complete) + add_trace("number", "complete", "yes"); if (dialinginfo.interfaces[0]) add_trace("interfaces", NULL, dialinginfo.interfaces); end_trace(); @@ -1961,7 +1965,7 @@ void EndpointAppPBX::action_execute(void) int iWaitStatus; char *command = (char *)""; char isdn_port[10]; - char *argv[11]; /* check also number of args below */ + char *argv[12]; /* check also number of args below */ int i = 0; /* get script / command */ @@ -1972,9 +1976,11 @@ void EndpointAppPBX::action_execute(void) end_trace(); return; } +#if 0 argv[i++] = (char *)"/bin/sh"; argv[i++] = (char *)"-c"; argv[i++] = command; +#endif argv[i++] = command; if ((rparam = routeparam(e_action, PARAM_PARAM))) { argv[i++] = rparam->string_value; @@ -1985,6 +1991,7 @@ void EndpointAppPBX::action_execute(void) argv[i++] = e_callerinfo.name; SPRINT(isdn_port, "%d", e_callerinfo.isdn_port); argv[i++] = isdn_port; + argv[i++] = e_callerinfo.imsi; argv[i++] = NULL; /* check also number of args above */ switch (pid = fork ()) { case -1: @@ -1994,12 +2001,10 @@ void EndpointAppPBX::action_execute(void) case 0: /* To be shure there are no zombies created double fork */ if ((pid2 = fork()) == 0) { - execve("/bin/sh", argv, environ); - } - else { - /* Exit immediately and release the waiting parent. The subprocess falls to init because the parent died */ - exit(0); + execve(command, argv, environ); } + /* Exit immediately and release the waiting parent. The subprocess falls to init because the parent died */ + exit(0); break; default: trace_header("ACTION execute", DIRECTION_NONE); @@ -2278,11 +2283,12 @@ void EndpointAppPBX::process_dialing(int timeout) } gettimeofday(¤t_time, NULL); - if (timeout && TIME_SMALLER(&e_match_timeout.timeout, ¤t_time)) { + if (e_match_to_action && TIME_SMALLER(&e_match_timeout.timeout, ¤t_time)) { /* return timeout rule */ PDEBUG(DEBUG_EPOINT, "EPOINT(%d): terminal '%s' dialing: '%s', timeout in ruleset '%s'\n", ea_endpoint->ep_serial, e_ext.number, e_dialinginfo.id, e_ruleset->name); unsched_timer(&e_match_timeout); e_action = e_match_to_action; + e_match_to_action = NULL; e_extdialing = e_match_to_extdialing; trace_header("ROUTING (timeout)", DIRECTION_NONE); add_trace("action", NULL, "%s", action_defs[e_action->index].name);