[Freeswitch-svn] [commit] r4800 - freeswitch/trunk/src/mod/applications/mod_commands
Author: anthm Date: Thu Mar 29 20:36:02 2007 New Revision: 4800 Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Log: add group param to shed_api Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Thu Mar 29 20:36:02 2007 @@ -707,29 +707,37 @@ static switch_status_t sched_api_function(char *cmd, switch_core_session_t *isession, switch_stream_handle_t *stream) { - char *tm = NULL, *dcmd; + char *tm = NULL, *dcmd, *group; time_t when; assert(cmd != NULL); tm = strdup(cmd); assert(tm != NULL); - if ((dcmd = strchr(tm, ' '))) { + if ((group = strchr(tm, ' '))) { uint32_t id; - *dcmd++ = '\0'; + *group++ = '\0'; - if (*tm == '+') { - when = time(NULL) + atol(tm + 1); - } else { - when = atol(tm); - } - id = switch_scheduler_add_task(when, sch_api_callback, (char *) __SWITCH_FUNC__, dcmd, 0, strdup(dcmd), SSHF_FREE_ARG); - stream->write_function(stream, "Added task %u\n", id); - } else { - stream->write_function(stream, "Invalid syntax\n"); + if ((dcmd = strchr(group, ' '))) { + *dcmd++ = '\0'; + + if (*tm == '+') { + when = time(NULL) + atol(tm + 1); + } else { + when = atol(tm); + } + + id = switch_scheduler_add_task(when, sch_api_callback, (char *) __SWITCH_FUNC__, group, 0, strdup(dcmd), SSHF_FREE_ARG); + stream->write_function(stream, "Added task %u for command [%s] group [%s]\n", id, dcmd, group); + goto good; + } } + stream->write_function(stream, "Invalid syntax\n"); + + good: + switch_safe_free(tm); return SWITCH_STATUS_SUCCESS; @@ -891,7 +899,7 @@ /*.interface_name */ "sched_api", /*.desc */ "Schedule an api command", /*.function */ sched_api_function, - /*.syntax */ "[+]<time> <command string>", + /*.syntax */ "[+]<time> <group_name> <command_string>", /*.next */ NULL };
participants (1)
-
Freeswitch SVN