]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8280: [mod_conference] remove duplicate stop-recording event and move other-record...
authorMichael Jerris <mike@jerris.com>
Tue, 20 Oct 2015 18:30:59 +0000 (14:30 -0400)
committerMichael Jerris <mike@jerris.com>
Tue, 20 Oct 2015 18:31:12 +0000 (14:31 -0400)
src/mod/applications/mod_conference/conference_api.c
src/mod/applications/mod_conference/conference_record.c

index 5ce735b7e4501b8b2000ecdfb3ad3bbb5262b038..57882976ac03930d8fbde8ec602c137fbfd1d1d0 100644 (file)
@@ -2386,7 +2386,6 @@ switch_status_t conference_api_sub_record(conference_obj_t *conference, switch_s
 switch_status_t conference_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
 {
        int all, before = conference->record_count, ttl = 0;
-       switch_event_t *event;
 
        switch_assert(conference != NULL);
        switch_assert(stream != NULL);
@@ -2398,15 +2397,6 @@ switch_status_t conference_api_sub_norecord(conference_obj_t *conference, switch
 
        if (!conference_record_stop(conference, stream, all ? NULL : argv[2]) && !all) {
                stream->write_function(stream, "non-existant recording '%s'\n", argv[2]);
-       } else {
-               if (test_eflag(conference, EFLAG_RECORD) &&
-                       switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-                       conference_event_add_data(conference, event);
-                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "stop-recording");
-                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", all ? "all" : argv[2]);
-                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Other-Recordings", conference->record_count ? "true" : "false");
-                       switch_event_fire(&event);
-               }
        }
 
        ttl = before - conference->record_count;
index 5ff2dc18dcaa09127712e1f2cc5be2e83611f1b0..5636b1e534187a068404334012bd9a6b534a9c42 100644 (file)
@@ -91,6 +91,7 @@ switch_status_t conference_record_stop(conference_obj_t *conference, switch_stre
        switch_mutex_lock(conference->member_mutex);
        for (member = conference->members; member; member = member->next) {
                if (conference_utils_member_test_flag(member, MFLAG_NOCHANNEL) && (!path || !strcmp(path, member->rec_path))) {
+                       conference->record_count--;
                        if (!conference_utils_test_flag(conference, CFLAG_CONF_RESTART_AUTO_RECORD) && member->rec && member->rec->autorec) {
                                stream->write_function(stream, "Stopped AUTO recording file %s (Auto Recording Now Disabled)\n", member->rec_path);
                                conference->auto_record = 0;
@@ -99,12 +100,12 @@ switch_status_t conference_record_stop(conference_obj_t *conference, switch_stre
                        }
 
                        conference_utils_member_clear_flag_locked(member, MFLAG_RUNNING);
+
                        count++;
 
                }
        }
 
-       conference->record_count -= count;
 
        switch_mutex_unlock(conference->member_mutex);
        return count;
@@ -384,6 +385,7 @@ void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, v
                conference_event_add_data(conference, event);
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "stop-recording");
                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", rec->path);
+               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Other-Recordings", conference->record_count ? "true" : "false");
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Samples-Out", "%ld", (long) member->rec->fh.samples_out);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Samplerate", "%ld", (long) member->rec->fh.samplerate);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Milliseconds-Elapsed", "%ld", (long) member->rec->fh.samples_out / (member->rec->fh.samplerate / 1000));