FS-5669 --resolve mod_rayo: return error if <document> is missing in <output>

This commit is contained in:
Chris Rienzo 2013-08-06 11:05:35 -04:00
parent 9d9844ec46
commit 86ea09c9e3
2 changed files with 16 additions and 1 deletions

View File

@ -3688,7 +3688,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load)
"<grammar content-type=\"application/srgs+xml\">"
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digits\" scope=\"public\"><item><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item><item>*</item><item>#</item></one-of></item></rule></grammar>]]>"
"</grammar></input>");
rayo_add_cmd_alias("output_bad",
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-time=\"100\"></output>");
return SWITCH_STATUS_SUCCESS;
}

View File

@ -126,12 +126,19 @@ static iks *start_call_output_component(struct rayo_actor *call, struct rayo_mes
switch_core_session_t *session = (switch_core_session_t *)session_data;
struct rayo_component *output_component = NULL;
iks *output = iks_find(iq, "output");
iks *document = NULL;
/* validate output attributes */
if (!VALIDATE_RAYO_OUTPUT(output)) {
return iks_new_error(iq, STANZA_ERROR_BAD_REQUEST);
}
/* check if <document> exists */
document = iks_find(output, "document");
if (!document) {
return iks_new_error(iq, STANZA_ERROR_BAD_REQUEST);
}
output_component = create_output_component(call, RAT_CALL_COMPONENT, output, iks_find_attrib(iq, "from"));
return start_call_output(output_component, session, output, iq);
}
@ -144,6 +151,7 @@ static iks *start_mixer_output_component(struct rayo_actor *mixer, struct rayo_m
iks *iq = msg->payload;
struct rayo_component *component = NULL;
iks *output = iks_find(iq, "output");
iks *document = NULL;
switch_stream_handle_t stream = { 0 };
/* validate output attributes */
@ -151,6 +159,12 @@ static iks *start_mixer_output_component(struct rayo_actor *mixer, struct rayo_m
return iks_new_error(iq, STANZA_ERROR_BAD_REQUEST);
}
/* check if <document> exists */
document = iks_find(output, "document");
if (!document) {
return iks_new_error(iq, STANZA_ERROR_BAD_REQUEST);
}
component = create_output_component(mixer, RAT_MIXER_COMPONENT, output, iks_find_attrib(iq, "from"));
/* build conference command */