mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-28 22:24:16 +00:00
add code to pass recording bugs on to other legs when executing an attended transfer, needs testing and possible follup commits before using
This commit is contained in:
1 parent
0419c4e0f3
commit
e2da3bea0c
4 files changed
+62
No files matched your search
@@ -392,6 +392,45 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_flush_all(switch_core_sess
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_transfer_recordings(switch_core_session_t *orig_session, switch_core_session_t *new_session)
|
||||
{
|
||||
switch_media_bug_t *bp;
|
||||
char *list[100] = { 0 };
|
||||
int stop_times[100] = { 0 };
|
||||
int i = 0, x = 0;
|
||||
|
||||
if (orig_session->bugs) {
|
||||
switch_channel_t *new_channel = switch_core_session_get_channel(new_session);
|
||||
const char *save = switch_channel_get_variable(new_channel, "record_append");
|
||||
|
||||
switch_thread_rwlock_wrlock(orig_session->bug_rwlock);
|
||||
|
||||
switch_channel_set_variable(new_channel, "record_append", "true");
|
||||
|
||||
for (bp = orig_session->bugs; bp; bp = bp->next) {
|
||||
if (!strcmp(bp->function, "session_record")) {
|
||||
list[x] = switch_core_session_strdup(new_session, bp->target);
|
||||
if (bp->stop_time > 0) {
|
||||
stop_times[x] = bp->stop_time - switch_epoch_time_now(NULL);
|
||||
}
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
switch_thread_rwlock_unlock(orig_session->bug_rwlock);
|
||||
|
||||
for(i = 0; i < x; i++) {
|
||||
switch_ivr_stop_record_session(orig_session, list[i]);
|
||||
switch_ivr_record_session(new_session, list[i], stop_times[i], NULL);
|
||||
}
|
||||
|
||||
switch_channel_set_variable(new_channel, "record_append", save);
|
||||
|
||||
}
|
||||
|
||||
return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_session_t *session, switch_stream_handle_t *stream)
|
||||
{
|
||||
switch_media_bug_t *bp;
|
||||
|
||||
Reference in new issue
Block a user