]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add SWITCH_MESSAGE_HEARTBEAT_EVENT indication to execute on a session when session...
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 15 Apr 2014 16:22:36 +0000 (21:22 +0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 15 Apr 2014 16:22:36 +0000 (21:22 +0500)
src/include/switch_types.h
src/switch_core_io.c
src/switch_core_session.c

index 949958835b04f1fa3e802fc214174883a22dcaaf..b9c5b744ac2224017d47ada6b099dbc15a94fc8d 100644 (file)
@@ -1014,6 +1014,7 @@ typedef enum {
        SWITCH_MESSAGE_PROGRESS_EVENT,
        SWITCH_MESSAGE_RING_EVENT,
        SWITCH_MESSAGE_RESAMPLE_EVENT,
+       SWITCH_MESSAGE_HEARTBEAT_EVENT,
        SWITCH_MESSAGE_INVALID
 } switch_core_session_message_types_t;
 
index 4c7b7fd8b802976851d7a707ea99d1a6aa18c36c..6b9a1dacf85d1aa58ef492a98e3e65ba9ecee178 100644 (file)
@@ -226,8 +226,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
        if (session->read_codec && !session->track_id && session->track_duration) {
                if (session->read_frame_count == 0) {
                        switch_event_t *event;
+                       switch_core_session_message_t msg = { 0 };
+
                        session->read_frame_count = (session->read_impl.actual_samples_per_second / session->read_impl.samples_per_packet) * session->track_duration;
 
+                       msg.message_id = SWITCH_MESSAGE_HEARTBEAT_EVENT;
+                       switch_core_session_receive_message(session, &msg);
+
                        switch_event_create(&event, SWITCH_EVENT_SESSION_HEARTBEAT);
                        switch_channel_event_set_data(session->channel, event);
                        switch_event_fire(&event);
index 5fa3feb3447478b46f9a227eb40f941f2d274983..d07a435b7454b7ba0bcadfe920ed32121d0c8c95 100644 (file)
@@ -755,6 +755,7 @@ static const char *message_names[] = {
        "PROGRESS_EVENT",
        "RING_EVENT",
        "RESAMPLE_EVENT",
+       "HEARTBEAT_EVENT",
        "INVALID"
 };
 
@@ -1494,6 +1495,7 @@ SWITCH_STANDARD_SCHED_FUNC(sch_heartbeat_callback)
        switch_event_t *event;
        switch_core_session_t *session;
        char *uuid = task->cmd_arg;
+       switch_core_session_message_t msg = { 0 }; 
 
        if ((session = switch_core_session_locate(uuid))) {
                switch_event_create(&event, SWITCH_EVENT_SESSION_HEARTBEAT);
@@ -1503,6 +1505,9 @@ SWITCH_STANDARD_SCHED_FUNC(sch_heartbeat_callback)
                /* reschedule this task */
                task->runtime = switch_epoch_time_now(NULL) + session->track_duration;
 
+               msg.message_id = SWITCH_MESSAGE_HEARTBEAT_EVENT;
+               switch_core_session_receive_message(session, &msg);
+
                switch_core_session_rwunlock(session);
        }
 }