mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 08:49:01 +00:00
add recovery_refresh app and api and use it in mod_conference to send a message to the channel telling it to sync its recovery snapshot
This commit is contained in:
parent
81608da006
commit
650393fb90
@ -791,6 +791,7 @@ typedef enum {
|
|||||||
SWITCH_MESSAGE_INDICATE_UDPTL_MODE,
|
SWITCH_MESSAGE_INDICATE_UDPTL_MODE,
|
||||||
SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS,
|
SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS,
|
||||||
SWITCH_MESSAGE_INDICATE_JITTER_BUFFER,
|
SWITCH_MESSAGE_INDICATE_JITTER_BUFFER,
|
||||||
|
SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH,
|
||||||
SWITCH_MESSAGE_INVALID
|
SWITCH_MESSAGE_INVALID
|
||||||
} switch_core_session_message_types_t;
|
} switch_core_session_message_types_t;
|
||||||
|
|
||||||
|
@ -2226,6 +2226,40 @@ SWITCH_STANDARD_API(uuid_deflect)
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define UUID_RECOVERY_REFRESH_SYNTAX "<uuid> <uri>"
|
||||||
|
SWITCH_STANDARD_API(uuid_recovery_refresh)
|
||||||
|
{
|
||||||
|
switch_core_session_t *tsession = NULL;
|
||||||
|
char *uuid = NULL, *text = NULL;
|
||||||
|
|
||||||
|
if (!zstr(cmd) && (uuid = strdup(cmd))) {
|
||||||
|
if ((text = strchr(uuid, ' '))) {
|
||||||
|
*text++ = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zstr(uuid) || zstr(text)) {
|
||||||
|
stream->write_function(stream, "-USAGE: %s\n", UUID_RECOVERY_REFRESH_SYNTAX);
|
||||||
|
} else {
|
||||||
|
if ((tsession = switch_core_session_locate(uuid))) {
|
||||||
|
switch_core_session_message_t msg = { 0 };
|
||||||
|
|
||||||
|
/* Tell the channel to recovery_refresh the call */
|
||||||
|
msg.from = __FILE__;
|
||||||
|
msg.string_arg = text;
|
||||||
|
msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH;
|
||||||
|
switch_core_session_receive_message(tsession, &msg);
|
||||||
|
stream->write_function(stream, "+OK:%s\n", msg.string_reply);
|
||||||
|
switch_core_session_rwunlock(tsession);
|
||||||
|
} else {
|
||||||
|
stream->write_function(stream, "-ERR No Such Channel %s!\n", uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_safe_free(uuid);
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
#define SCHED_TRANSFER_SYNTAX "[+]<time> <uuid> <extension> [<dialplan>] [<context>]"
|
#define SCHED_TRANSFER_SYNTAX "[+]<time> <uuid> <extension> [<dialplan>] [<context>]"
|
||||||
SWITCH_STANDARD_API(sched_transfer_function)
|
SWITCH_STANDARD_API(sched_transfer_function)
|
||||||
{
|
{
|
||||||
@ -4858,6 +4892,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
|||||||
SWITCH_ADD_API(commands_api_interface, "uuid_phone_event", "Send and event to the phone", uuid_phone_event_function, PHONE_EVENT_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_phone_event", "Send and event to the phone", uuid_phone_event_function, PHONE_EVENT_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_preprocess", "Pre-process Channel", preprocess_function, PREPROCESS_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_preprocess", "Pre-process Channel", preprocess_function, PREPROCESS_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
|
||||||
|
SWITCH_ADD_API(commands_api_interface, "uuid_recovery_refresh", "Send a recovery_refresh", uuid_recovery_refresh, UUID_RECOVERY_REFRESH_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_recv_dtmf", "receive dtmf digits", uuid_recv_dtmf_function, UUID_RECV_DTMF_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_recv_dtmf", "receive dtmf digits", uuid_recv_dtmf_function, UUID_RECV_DTMF_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_session_heartbeat", "uuid_session_heartbeat", uuid_session_heartbeat_function, HEARTBEAT_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_session_heartbeat", "uuid_session_heartbeat", uuid_session_heartbeat_function, HEARTBEAT_SYNTAX);
|
||||||
@ -4983,6 +5018,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
|||||||
switch_console_set_complete("add uuid_phone_event ::console::list_uuid hold");
|
switch_console_set_complete("add uuid_phone_event ::console::list_uuid hold");
|
||||||
switch_console_set_complete("add uuid_preprocess ::console::list_uuid");
|
switch_console_set_complete("add uuid_preprocess ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_record ::console::list_uuid ::[start:stop");
|
switch_console_set_complete("add uuid_record ::console::list_uuid ::[start:stop");
|
||||||
|
switch_console_set_complete("add uuid_recovery_refresh ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_recv_dtmf ::console::list_uuid");
|
switch_console_set_complete("add uuid_recv_dtmf ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_send_dtmf ::console::list_uuid");
|
switch_console_set_complete("add uuid_send_dtmf ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid");
|
switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid");
|
||||||
|
@ -4284,6 +4284,7 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc
|
|||||||
switch_event_t *params = NULL;
|
switch_event_t *params = NULL;
|
||||||
conference_obj_t *new_conference = NULL;
|
conference_obj_t *new_conference = NULL;
|
||||||
int locked = 0;
|
int locked = 0;
|
||||||
|
switch_core_session_message_t msg = { 0 };
|
||||||
|
|
||||||
switch_assert(conference != NULL);
|
switch_assert(conference != NULL);
|
||||||
switch_assert(stream != NULL);
|
switch_assert(stream != NULL);
|
||||||
@ -4409,6 +4410,11 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc
|
|||||||
|
|
||||||
switch_channel_set_variable(channel, "last_transfered_conference", argv[2]);
|
switch_channel_set_variable(channel, "last_transfered_conference", argv[2]);
|
||||||
|
|
||||||
|
/* Sync the recovery data */
|
||||||
|
msg.from = __FILE__;
|
||||||
|
msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH;
|
||||||
|
switch_core_session_receive_message(member->session, &msg);
|
||||||
|
|
||||||
unlock_member(member);
|
unlock_member(member);
|
||||||
|
|
||||||
stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]);
|
stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]);
|
||||||
|
@ -1001,6 +1001,17 @@ SWITCH_STANDARD_APP(deflect_function)
|
|||||||
switch_core_session_receive_message(session, &msg);
|
switch_core_session_receive_message(session, &msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_STANDARD_APP(recovery_refresh_function)
|
||||||
|
{
|
||||||
|
switch_core_session_message_t msg = { 0 };
|
||||||
|
|
||||||
|
/* Tell the channel to recovery_refresh the call */
|
||||||
|
msg.from = __FILE__;
|
||||||
|
msg.string_arg = data;
|
||||||
|
msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH;
|
||||||
|
switch_core_session_receive_message(session, &msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_STANDARD_APP(sched_cancel_function)
|
SWITCH_STANDARD_APP(sched_cancel_function)
|
||||||
{
|
{
|
||||||
@ -3547,6 +3558,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
|
|||||||
SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>",
|
SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>",
|
||||||
SAF_SUPPORT_NOMEDIA);
|
SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
|
SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
|
||||||
|
SWITCH_ADD_APP(app_interface, "recovery_refresh", "Send call recovery_refresh", "Send a call recovery_refresh.", recovery_refresh_function, "", SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>",
|
SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>",
|
||||||
SAF_SUPPORT_NOMEDIA);
|
SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>",
|
SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>",
|
||||||
|
@ -1319,6 +1319,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
|
|
||||||
/* ones that do not need to lock sofia mutex */
|
/* ones that do not need to lock sofia mutex */
|
||||||
switch (msg->message_id) {
|
switch (msg->message_id) {
|
||||||
|
case SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH:
|
||||||
case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC:
|
case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC:
|
||||||
{
|
{
|
||||||
sofia_glue_tech_track(tech_pvt->profile, session);
|
sofia_glue_tech_track(tech_pvt->profile, session);
|
||||||
@ -1335,6 +1336,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
|
case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
|
||||||
{
|
{
|
||||||
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user