提交 28db1ede authored 作者: Vitaly Kovalyshyn's avatar Vitaly Kovalyshyn

FS-9096: [mod_commands] new uuid argument for bgapi

上级 7f1813cf
...@@ -5179,18 +5179,37 @@ SWITCH_STANDARD_API(bgapi_function) ...@@ -5179,18 +5179,37 @@ SWITCH_STANDARD_API(bgapi_function)
switch_thread_t *thread; switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL; switch_threadattr_t *thd_attr = NULL;
const char *p, *arg = cmd;
char my_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
if (!cmd) { if (!cmd) {
stream->write_function(stream, "-ERR Invalid syntax\n"); stream->write_function(stream, "-ERR Invalid syntax\n");
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
if (!strncasecmp(cmd, "uuid:", 5)) {
p = cmd + 5;
if ((arg = strchr(p, ' ')) && *arg++) {
switch_copy_string(my_uuid, p, arg - p);
}
}
if (zstr(arg)) {
stream->write_function(stream, "-ERR Invalid syntax\n");
return SWITCH_STATUS_SUCCESS;
}
switch_core_new_memory_pool(&pool); switch_core_new_memory_pool(&pool);
job = switch_core_alloc(pool, sizeof(*job)); job = switch_core_alloc(pool, sizeof(*job));
job->cmd = switch_core_strdup(pool, cmd); job->cmd = switch_core_strdup(pool, arg);
job->pool = pool; job->pool = pool;
if (*my_uuid) {
switch_copy_string(job->uuid_str, my_uuid, strlen(my_uuid)+1);
} else {
switch_uuid_get(&uuid); switch_uuid_get(&uuid);
switch_uuid_format(job->uuid_str, &uuid); switch_uuid_format(job->uuid_str, &uuid);
}
switch_threadattr_create(&thd_attr, job->pool); switch_threadattr_create(&thd_attr, job->pool);
switch_threadattr_detach_set(thd_attr, 1); switch_threadattr_detach_set(thd_attr, 1);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论