{
iks *iq = msg->payload;
iks *result = NULL;
+ switch_core_session_t *session = NULL;
switch_stream_handle_t stream = { 0 };
char *command = switch_mprintf("%s stop", RAYO_JID(component));
SWITCH_STANDARD_STREAM(stream);
OUTPUT_COMPONENT(component)->stop = 1;
+ if (!strcmp(RAYO_ACTOR(component)->type, RAT_CALL_COMPONENT)) {
+ session = (switch_core_session_t *)data;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s stopping\n", RAYO_JID(component));
switch_api_execute("fileman", command, NULL, &stream);
if (!zstr((char *)stream.data) && !strncmp((char *)stream.data, "+OK", 3)) {
result = iks_new_iq_result(iq);
+ } else if (session && switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
+ result = iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "call has ended");
} else if (!zstr((char *)stream.data)) {
result = iks_new_error_detailed_printf(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "%s", (char *)stream.data);
} else {
{
iks *iq = msg->payload;
iks *result = NULL;
+ switch_core_session_t *session = NULL;
switch_stream_handle_t stream = { 0 };
char *command = switch_mprintf("%s pause", RAYO_JID(component));
SWITCH_STANDARD_STREAM(stream);
+ if (!strcmp(RAYO_ACTOR(component)->type, RAT_CALL_COMPONENT)) {
+ session = (switch_core_session_t *)data;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s pausing\n", RAYO_JID(component));
switch_api_execute("fileman", command, NULL, &stream);
if (!zstr((char *)stream.data) && !strncmp((char *)stream.data, "+OK", 3)) {
result = iks_new_iq_result(iq);
+ } else if (session && switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
+ result = iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "call has ended");
} else if (!zstr((char *)stream.data)) {
result = iks_new_error_detailed_printf(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "%s", (char *)stream.data);
} else {
{
iks *iq = msg->payload;
iks *result = NULL;
+ switch_core_session_t *session = NULL;
switch_stream_handle_t stream = { 0 };
char *command = switch_mprintf("%s resume", RAYO_JID(component));
SWITCH_STANDARD_STREAM(stream);
+ if (!strcmp(RAYO_ACTOR(component)->type, RAT_CALL_COMPONENT)) {
+ session = (switch_core_session_t *)data;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s resuming\n", RAYO_JID(component));
switch_api_execute("fileman", command, NULL, &stream);
if (!zstr((char *)stream.data) && !strncmp((char *)stream.data, "+OK", 3)) {
result = iks_new_iq_result(iq);
+ } else if (session && switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
+ result = iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "call has ended");
} else if (!zstr((char *)stream.data)) {
result = iks_new_error_detailed_printf(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "%s", (char *)stream.data);
} else {
{
iks *iq = msg->payload;
iks *result = NULL;
+ switch_core_session_t *session = NULL;
switch_stream_handle_t stream = { 0 };
char *command = switch_mprintf("%s speed:+", RAYO_JID(component));
SWITCH_STANDARD_STREAM(stream);
+ if (!strcmp(RAYO_ACTOR(component)->type, RAT_CALL_COMPONENT)) {
+ session = (switch_core_session_t *)data;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s speeding up\n", RAYO_JID(component));
switch_api_execute("fileman", command, NULL, &stream);
if (!zstr((char *)stream.data) && !strncmp((char *)stream.data, "+OK", 3)) {
result = iks_new_iq_result(iq);
+ } else if (session && switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
+ result = iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "call has ended");
} else if (!zstr((char *)stream.data)) {
result = iks_new_error_detailed_printf(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "%s", (char *)stream.data);
} else {
{
iks *iq = msg->payload;
iks *result = NULL;
+ switch_core_session_t *session = NULL;
switch_stream_handle_t stream = { 0 };
char *command = switch_mprintf("%s speed:-", RAYO_JID(component));
SWITCH_STANDARD_STREAM(stream);
+ if (!strcmp(RAYO_ACTOR(component)->type, RAT_CALL_COMPONENT)) {
+ session = (switch_core_session_t *)data;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s slowing down\n", RAYO_JID(component));
switch_api_execute("fileman", command, NULL, &stream);
if (!zstr((char *)stream.data) && !strncmp((char *)stream.data, "+OK", 3)) {
result = iks_new_iq_result(iq);
+ } else if (session && switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
+ result = iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "call has ended");
} else if (!zstr((char *)stream.data)) {
result = iks_new_error_detailed_printf(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "%s", (char *)stream.data);
} else {
{
iks *iq = msg->payload;
iks *result = NULL;
+ switch_core_session_t *session = NULL;
switch_stream_handle_t stream = { 0 };
char *command = switch_mprintf("%s volume:+", RAYO_JID(component));
SWITCH_STANDARD_STREAM(stream);
+ if (!strcmp(RAYO_ACTOR(component)->type, RAT_CALL_COMPONENT)) {
+ session = (switch_core_session_t *)data;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s increasing volume\n", RAYO_JID(component));
switch_api_execute("fileman", command, NULL, &stream);
if (!zstr((char *)stream.data) && !strncmp((char *)stream.data, "+OK", 3)) {
result = iks_new_iq_result(iq);
+ } else if (session && switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
+ result = iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "call has ended");
} else if (!zstr((char *)stream.data)) {
result = iks_new_error_detailed_printf(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "%s", (char *)stream.data);
} else {
{
iks *iq = msg->payload;
iks *result = NULL;
+ switch_core_session_t *session = NULL;
switch_stream_handle_t stream = { 0 };
char *command = switch_mprintf("%s volume:-", RAYO_JID(component));
SWITCH_STANDARD_STREAM(stream);
+ if (!strcmp(RAYO_ACTOR(component)->type, RAT_CALL_COMPONENT)) {
+ session = (switch_core_session_t *)data;
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s lowering volume\n", RAYO_JID(component));
switch_api_execute("fileman", command, NULL, &stream);
if (!zstr((char *)stream.data) && !strncmp((char *)stream.data, "+OK", 3)) {
result = iks_new_iq_result(iq);
+ } else if (session && switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
+ result = iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "call has ended");
} else if (!zstr((char *)stream.data)) {
result = iks_new_error_detailed_printf(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "%s", (char *)stream.data);
} else {
if (VALIDATE_RAYO_OUTPUT_SEEK(seek)) {
iks *result = NULL;
+ switch_core_session_t *session = NULL;
int is_forward = !strcmp("forward", iks_find_attrib(seek, "direction"));
int amount_ms = iks_find_int_attrib(seek, "amount");
char *command = switch_mprintf("%s seek:%s%i", RAYO_JID(component),
is_forward ? "+" : "-", amount_ms);
switch_stream_handle_t stream = { 0 };
SWITCH_STANDARD_STREAM(stream);
+ if (!strcmp(RAYO_ACTOR(component)->type, RAT_CALL_COMPONENT)) {
+ session = (switch_core_session_t *)data;
+ }
switch_api_execute("fileman", command, NULL, &stream);
if (!zstr((char *)stream.data) && !strncmp((char *)stream.data, "+OK", 3)) {
result = iks_new_iq_result(iq);
+ } else if (session && switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
+ result = iks_new_error_detailed(iq, STANZA_ERROR_UNEXPECTED_REQUEST, "call has ended");
} else if (!zstr((char *)stream.data)) {
result = iks_new_error_detailed_printf(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "%s", (char *)stream.data);
} else {
struct output_component *output = OUTPUT_COMPONENT(context->component);
/* send completion and destroy */
- if (output->stop) {
- rayo_component_send_complete(context->component, COMPONENT_COMPLETE_STOP);
- } else {
- if (!strcmp(RAYO_ACTOR(context->component)->type, RAT_CALL_COMPONENT)) {
- /* call output... check for hangup */
- switch_core_session_t *session = switch_core_session_locate(RAYO_ACTOR(context->component)->parent->id);
- if (session) {
- if (switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
- rayo_component_send_complete(context->component, COMPONENT_COMPLETE_HANGUP);
- } else {
- rayo_component_send_complete(context->component, OUTPUT_FINISH);
- }
- switch_core_session_rwunlock(session);
- } else {
- /* session is gone */
+ if (!strcmp(RAYO_ACTOR(context->component)->type, RAT_CALL_COMPONENT)) {
+ /* call output... check for hangup */
+ switch_core_session_t *session = switch_core_session_locate(RAYO_ACTOR(context->component)->parent->id);
+ if (session) {
+ if (switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
rayo_component_send_complete(context->component, COMPONENT_COMPLETE_HANGUP);
+ } else if (output->stop) {
+ rayo_component_send_complete(context->component, COMPONENT_COMPLETE_STOP);
+ } else {
+ rayo_component_send_complete(context->component, OUTPUT_FINISH);
}
+ switch_core_session_rwunlock(session);
} else {
- /* mixer output... finished */
- rayo_component_send_complete(context->component, OUTPUT_FINISH);
+ /* session is gone */
+ rayo_component_send_complete(context->component, COMPONENT_COMPLETE_HANGUP);
}
+ } else if (output->stop) {
+ rayo_component_send_complete(context->component, COMPONENT_COMPLETE_STOP);
+ } else {
+ /* mixer output... finished */
+ rayo_component_send_complete(context->component, OUTPUT_FINISH);
}
/* TODO timed out */