mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 22:54:18 +00:00
[core] Add SMBF_PAUSE media bug flag to pause an individual media bug.
* [core] Add SMBF_PAUSE media bug flag to pause an individual media bug. [core] Add switch_ivr_record_session_pause() to pause a session recording. [mod_dptools] Add record_session_pause and record_session_resume dialplan APPs. [mod_commands] Add pause/resume sub-commands to uuid_record API.
This commit is contained in:
1 parent
a162cf86e8
commit
60c4b62254
11 files changed
+232
-14
No files matched your search
@@ -1031,6 +1031,7 @@ SWITCH_DECLARE(char *) switch_ivr_check_presence_mapping(const char *exten_name,
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_kill_uuid(const char *uuid, switch_call_cause_t cause);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_blind_transfer_ack(switch_core_session_t *session, switch_bool_t success);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_mask(switch_core_session_t *session, const char *file, switch_bool_t on);
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_pause(switch_core_session_t *session, const char *file, switch_bool_t on);
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_video_write_overlay_session(switch_core_session_t *session);
|
||||
|
||||
@@ -1910,7 +1910,8 @@ typedef enum {
|
||||
SMBF_SPY_VIDEO_STREAM_BLEG = (1 << 23),
|
||||
SMBF_READ_VIDEO_PATCH = (1 << 24),
|
||||
SMBF_READ_TEXT_STREAM = (1 << 25),
|
||||
SMBF_FIRST = (1 << 26)
|
||||
SMBF_FIRST = (1 << 26),
|
||||
SMBF_PAUSE = (1 << 27)
|
||||
} switch_media_bug_flag_enum_t;
|
||||
typedef uint32_t switch_media_bug_flag_t;
|
||||
|
||||
|
||||
@@ -4781,6 +4781,18 @@ SWITCH_STANDARD_API(session_record_function)
|
||||
} else {
|
||||
stream->write_function(stream, "+OK Success\n");
|
||||
}
|
||||
} else if (!strcasecmp(action, "pause")) {
|
||||
if (switch_ivr_record_session_pause(rsession, path, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
|
||||
stream->write_function(stream, "-ERR Cannot pause recording session!\n");
|
||||
} else {
|
||||
stream->write_function(stream, "+OK Success\n");
|
||||
}
|
||||
} else if (!strcasecmp(action, "resume")) {
|
||||
if (switch_ivr_record_session_pause(rsession, path, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
|
||||
stream->write_function(stream, "-ERR Cannot resume recording session!\n");
|
||||
} else {
|
||||
stream->write_function(stream, "+OK Success\n");
|
||||
}
|
||||
} else if (!strcasecmp(action, "mask")) {
|
||||
if (switch_ivr_record_session_mask(rsession, path, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
|
||||
stream->write_function(stream, "-ERR Cannot mask recording session!\n");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Copyright (C) 2005-2020, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
@@ -3317,6 +3317,16 @@ SWITCH_STANDARD_APP(record_session_unmask_function)
|
||||
switch_ivr_record_session_mask(session, (char *) data, SWITCH_FALSE);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(record_session_pause_function)
|
||||
{
|
||||
switch_ivr_record_session_pause(session, (char *) data, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(record_session_resume_function)
|
||||
{
|
||||
switch_ivr_record_session_pause(session, (char *) data, SWITCH_FALSE);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(record_session_function)
|
||||
{
|
||||
char *array[5] = {0};
|
||||
@@ -6679,7 +6689,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
|
||||
SWITCH_ADD_APP(app_interface, "stop_record_session", "Stop Record Session", STOP_SESS_REC_DESC, stop_record_session_function, "<path>", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "record_session", "Record Session", SESS_REC_DESC, record_session_function, "<path> [+<timeout>]", SAF_MEDIA_TAP);
|
||||
SWITCH_ADD_APP(app_interface, "record_session_mask", "Mask audio in recording", SESS_REC_MASK_DESC, record_session_mask_function, "<path>", SAF_MEDIA_TAP);
|
||||
SWITCH_ADD_APP(app_interface, "record_session_unmask", "Resume recording", SESS_REC_UNMASK_DESC, record_session_unmask_function, "<path>", SAF_MEDIA_TAP);
|
||||
SWITCH_ADD_APP(app_interface, "record_session_unmask", "Stop masking audio in recording", SESS_REC_UNMASK_DESC, record_session_unmask_function, "<path>", SAF_MEDIA_TAP);
|
||||
SWITCH_ADD_APP(app_interface, "record_session_pause", "Pause recording", "Temporarily pause writing call recording audio to file", record_session_pause_function, "<path>", SAF_MEDIA_TAP);
|
||||
SWITCH_ADD_APP(app_interface, "record_session_resume", "Resume paused recording", "Resume writing call recording audio to file", record_session_resume_function, "<path>", SAF_MEDIA_TAP);
|
||||
SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function,
|
||||
"<path> [<time_limit_secs>] [<silence_thresh>] [<silence_hits>]", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "preprocess", "pre-process", "pre-process", preprocess_session_function, "", SAF_NONE);
|
||||
|
||||
@@ -242,7 +242,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
ok = SWITCH_TRUE;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
ok = SWITCH_TRUE;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -652,7 +652,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
ok = SWITCH_TRUE;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -703,7 +703,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
ok = SWITCH_TRUE;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -883,7 +883,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
ok = SWITCH_TRUE;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -7224,7 +7224,7 @@ static switch_status_t perform_write(switch_core_session_t *session, switch_fram
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
ok = SWITCH_TRUE;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -14871,7 +14871,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
switch_bool_t ok = SWITCH_TRUE;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -15252,7 +15252,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
switch_bool_t ok = SWITCH_TRUE;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -15516,7 +15516,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_text_frame(switch_core_
|
||||
for (bp = session->bugs; bp; bp = bp->next) {
|
||||
switch_bool_t ok = SWITCH_TRUE;
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -16199,7 +16199,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
|
||||
continue;
|
||||
}
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) {
|
||||
if (switch_core_media_bug_test_flag(bp, SMBF_PAUSE) || (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1869,6 +1869,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_mask(switch_core_sessi
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_pause(switch_core_session_t *session, const char *file, switch_bool_t on)
|
||||
{
|
||||
switch_media_bug_t *bug;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
if ((bug = switch_channel_get_private(channel, file))) {
|
||||
if (on) {
|
||||
switch_core_media_bug_set_flag(bug, SMBF_PAUSE);
|
||||
} else {
|
||||
switch_core_media_bug_clear_flag(bug, SMBF_PAUSE);
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_session_t *session, const char *file)
|
||||
{
|
||||
switch_media_bug_t *bug;
|
||||
|
||||
Reference in new issue
Block a user