iks *complete;
const char *input_jid;
const char *output_jid;
+ const char *start_timers_request_id;
};
#define PROMPT_COMPONENT(x) ((struct prompt_component *)x)
return "UNKNOWN";
}
+/**
+ * Send input-timers-started event
+ */
+void rayo_component_send_input_timers_started_event(struct rayo_component *component)
+{
+ iks *event = iks_new("presence");
+ iks *x;
+ iks_insert_attrib(event, "from", RAYO_JID(component));
+ iks_insert_attrib(event, "to", component->client_jid);
+ x = iks_insert(event, "input-timers-started");
+ iks_insert_attrib(x, "xmlns", RAYO_PROMPT_NS);
+ RAYO_SEND_REPLY(component, component->client_jid, event);
+}
+
/**
* Send stop to component
*/
iks_insert_attrib(iq, "from", RAYO_JID(prompt));
iks_insert_attrib(iq, "to", prompt->input_jid);
iks_insert_attrib(iq, "type", "set");
- iks_insert_attrib_printf(iq, "id", "mod_rayo-prompt-%d", RAYO_SEQ_NEXT(prompt));
+ prompt->start_timers_request_id = switch_core_sprintf(RAYO_POOL(prompt), "mod_rayo-prompt-%d", RAYO_SEQ_NEXT(prompt));
+ iks_insert_attrib(iq, "id", prompt->start_timers_request_id);
x = iks_insert(iq, "start-timers");
iks_insert_attrib(x, "xmlns", RAYO_INPUT_NS);
RAYO_SEND_MESSAGE(prompt, prompt->input_jid, iq);
case PCS_START_INPUT:
PROMPT_COMPONENT(prompt)->input_jid = switch_core_strdup(RAYO_POOL(prompt), msg->from_jid);
PROMPT_COMPONENT(prompt)->state = PCS_INPUT;
+ rayo_component_send_input_timers_started_event(RAYO_COMPONENT(prompt));
break;
case PCS_START_INPUT_OUTPUT:
PROMPT_COMPONENT(prompt)->input_jid = switch_core_strdup(RAYO_POOL(prompt), msg->from_jid);
}
/**
- * Handle barge event
+ * Handle failure to start timers
*/
static iks *prompt_component_handle_input_start_timers_error(struct rayo_actor *prompt, struct rayo_message *msg, void *data)
{
iks *iq = msg->payload;
/* forward all results, except for internal ones... */
- if (strncmp("mod_rayo-prompt", iks_find_attrib_soft(iq, "id"), 15)) {
+ const char *id = iks_find_attrib_soft(iq, "id");
+ if (strncmp("mod_rayo-prompt", id, 15)) {
iks_insert_attrib(iq, "from", RAYO_JID(prompt));
iks_insert_attrib(iq, "to", RAYO_COMPONENT(prompt)->client_jid);
RAYO_SEND_REPLY_DUP(prompt, RAYO_COMPONENT(prompt)->client_jid, iq);
+ } else if (!strcmp(PROMPT_COMPONENT(prompt)->start_timers_request_id, id)) {
+ rayo_component_send_input_timers_started_event(RAYO_COMPONENT(prompt));
}
+
return NULL;
}