提交 5138aede authored 作者: Chris Rienzo's avatar Chris Rienzo

FS-6282 mod_rayo: allow outbound call JID to be assigned by client

上级 b8e4a66d
......@@ -285,7 +285,10 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg,
/* create CPA component */
switch_core_new_memory_pool(&pool);
component = switch_core_alloc(pool, sizeof(*component));
rayo_component_init((struct rayo_component *)component, pool, RAT_CALL_COMPONENT, "cpa", NULL, call, iks_find_attrib(iq, "from"));
component = CPA_COMPONENT(rayo_component_init((struct rayo_component *)component, pool, RAT_CALL_COMPONENT, "cpa", NULL, call, iks_find_attrib(iq, "from")));
if (!component) {
return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create CPA entity");
}
switch_core_hash_init(&component->signals, pool);
......
/*
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2013, Grasshopper
* Copyright (C) 2013-2014, Grasshopper
*
* Version: MPL 1.1
*
......@@ -177,7 +177,11 @@ static iks *start_sendfax_component(struct rayo_actor *call, struct rayo_message
/* create sendfax component */
switch_core_new_memory_pool(&pool);
sendfax_component = switch_core_alloc(pool, sizeof(*sendfax_component));
rayo_component_init((struct rayo_component *)sendfax_component, pool, RAT_CALL_COMPONENT, "sendfax", NULL, call, iks_find_attrib(iq, "from"));
sendfax_component = FAX_COMPONENT(rayo_component_init((struct rayo_component *)sendfax_component, pool, RAT_CALL_COMPONENT, "sendfax", NULL, call, iks_find_attrib(iq, "from")));
if (!sendfax_component) {
switch_core_destroy_memory_pool(&pool);
return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create sendfax entity");
}
/* add channel variable so that fax component can be located from fax events */
switch_channel_set_variable(channel, "rayo_fax_jid", RAYO_JID(sendfax_component));
......@@ -265,7 +269,11 @@ static iks *start_receivefax_component(struct rayo_actor *call, struct rayo_mess
/* create receivefax component */
switch_core_new_memory_pool(&pool);
receivefax_component = switch_core_alloc(pool, sizeof(*receivefax_component));
rayo_component_init((struct rayo_component *)receivefax_component, pool, RAT_CALL_COMPONENT, "receivefax", NULL, call, iks_find_attrib(iq, "from"));
receivefax_component = RECEIVEFAX_COMPONENT(rayo_component_init((struct rayo_component *)receivefax_component, pool, RAT_CALL_COMPONENT, "receivefax", NULL, call, iks_find_attrib(iq, "from")));
if (!receivefax_component) {
switch_core_destroy_memory_pool(&pool);
return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create sendfax entity");
}
file_no = rayo_actor_seq_next(call);
receivefax_component->filename = switch_core_sprintf(pool, "%s%s%s-%d.tif",
globals.file_prefix, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session), file_no);
......
......@@ -662,7 +662,11 @@ static iks *start_call_input_component(struct rayo_actor *call, struct rayo_mess
switch_core_new_memory_pool(&pool);
input_component = switch_core_alloc(pool, sizeof(*input_component));
rayo_component_init(RAYO_COMPONENT(input_component), pool, RAT_CALL_COMPONENT, "input", component_id, call, iks_find_attrib(iq, "from"));
input_component = INPUT_COMPONENT(rayo_component_init(RAYO_COMPONENT(input_component), pool, RAT_CALL_COMPONENT, "input", component_id, call, iks_find_attrib(iq, "from")));
if (!input_component) {
switch_core_destroy_memory_pool(&pool);
return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create input entity");
}
return start_call_input(input_component, session, input, iq, NULL, 0);
}
......
......@@ -68,7 +68,11 @@ static struct rayo_component *create_output_component(struct rayo_actor *actor,
switch_core_new_memory_pool(&pool);
output_component = switch_core_alloc(pool, sizeof(*output_component));
rayo_component_init((struct rayo_component *)output_component, pool, type, "output", NULL, actor, client_jid);
output_component = OUTPUT_COMPONENT(rayo_component_init((struct rayo_component *)output_component, pool, type, "output", NULL, actor, client_jid));
if (!output_component) {
switch_core_destroy_memory_pool(&pool);
return NULL;
}
output_component->document = iks_copy(output);
output_component->start_offset_ms = iks_find_int_attrib(output, "start-offset");
......@@ -153,6 +157,9 @@ static iks *start_call_output_component(struct rayo_actor *call, struct rayo_mes
}
output_component = create_output_component(call, RAT_CALL_COMPONENT, output, iks_find_attrib(iq, "from"));
if (!output_component) {
return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create output entity");
}
return start_call_output(output_component, session, output, iq);
}
......@@ -179,6 +186,9 @@ static iks *start_mixer_output_component(struct rayo_actor *mixer, struct rayo_m
}
component = create_output_component(mixer, RAT_MIXER_COMPONENT, output, iks_find_attrib(iq, "from"));
if (!component) {
return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create output entity");
}
/* build conference command */
SWITCH_STANDARD_STREAM(stream);
......
/*
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2013, Grasshopper
* Copyright (C) 2013-2014, Grasshopper
*
* Version: MPL 1.1
*
......@@ -559,7 +559,11 @@ static iks *start_call_prompt_component(struct rayo_actor *call, struct rayo_mes
/* create prompt component, linked to call */
switch_core_new_memory_pool(&pool);
prompt_component = switch_core_alloc(pool, sizeof(*prompt_component));
rayo_component_init(RAYO_COMPONENT(prompt_component), pool, RAT_CALL_COMPONENT, "prompt", NULL, call, iks_find_attrib(iq, "from"));
prompt_component = PROMPT_COMPONENT(rayo_component_init(RAYO_COMPONENT(prompt_component), pool, RAT_CALL_COMPONENT, "prompt", NULL, call, iks_find_attrib(iq, "from")));
if (!prompt_component) {
switch_core_destroy_memory_pool(&pool);
return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create prompt entity");
}
prompt_component->iq = iks_copy(iq);
/* start output */
......
/*
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2013, Grasshopper
* Copyright (C) 2013-2014, Grasshopper
*
* Version: MPL 1.1
*
......@@ -156,11 +156,6 @@ static struct rayo_component *record_component_create(struct rayo_actor *actor,
char *fs_file_path;
switch_bool_t start_paused;
/* validate record attributes */
if (!VALIDATE_RAYO_RECORD(record)) {
return NULL;
}
start_paused = iks_find_bool_attrib(record, "start-paused");
/* create record filename from session UUID and ref */
......@@ -175,7 +170,12 @@ static struct rayo_component *record_component_create(struct rayo_actor *actor,
switch_core_new_memory_pool(&pool);
record_component = switch_core_alloc(pool, sizeof(*record_component));
rayo_component_init(RAYO_COMPONENT(record_component), pool, type, "record", fs_file_path, actor, client_jid);
record_component = RECORD_COMPONENT(rayo_component_init(RAYO_COMPONENT(record_component), pool, type, "record", fs_file_path, actor, client_jid));
if (!record_component) {
switch_core_destroy_memory_pool(&pool);
return NULL;
}
record_component->max_duration = iks_find_int_attrib(record, "max-duration");
record_component->initial_timeout = iks_find_int_attrib(record, "initial-timeout");
record_component->final_timeout = iks_find_int_attrib(record, "final-timeout");
......@@ -270,9 +270,14 @@ static iks *start_call_record_component(struct rayo_actor *call, struct rayo_mes
struct rayo_component *component = NULL;
iks *record = iks_find(iq, "record");
/* validate record attributes */
if (!VALIDATE_RAYO_RECORD(record)) {
return iks_new_error(iq, STANZA_ERROR_BAD_REQUEST);
}
component = record_component_create(call, RAT_CALL_COMPONENT, iks_find_attrib(iq, "from"), record);
if (!component) {
return iks_new_error(iq, STANZA_ERROR_BAD_REQUEST);
return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create record entity");
}
if (start_call_record(session, component)) {
......@@ -396,9 +401,14 @@ static iks *start_mixer_record_component(struct rayo_actor *mixer, struct rayo_m
struct rayo_component *component = NULL;
iks *record = iks_find(iq, "record");
/* validate record attributes */
if (!VALIDATE_RAYO_RECORD(record)) {
return iks_new_error(iq, STANZA_ERROR_BAD_REQUEST);
}
component = record_component_create(mixer, RAT_MIXER_COMPONENT, iks_find_attrib(iq, "from"), record);
if (!component) {
return iks_new_error(iq, STANZA_ERROR_BAD_REQUEST);
return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create record entity");
}
/* mixer doesn't allow "send" */
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论