]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
lord of the rings
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 13 Feb 2007 15:47:15 +0000 (15:47 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 13 Feb 2007 15:47:15 +0000 (15:47 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4230 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_core.h
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_iax/mod_iax.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
src/mod/endpoints/mod_woomera/mod_woomera.c
src/switch_core.c

index f91ab745970348425d06036018030caf797e829b..5b783f2affc96d32738d7a79cbd26b6ea83e383a 100644 (file)
@@ -514,6 +514,14 @@ SWITCH_DECLARE (switch_status_t) switch_core_session_message_send(char *uuid_str
 */
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_session_t *session, switch_core_session_message_t *message);
 
+/*! 
+  \brief Queue an indication message on a session
+  \param session the session to queue the message to
+  \param indication the indication message to queue
+  \return SWITCH_STATUS_SUCCESS if the message was queued
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core_session_t *session, switch_core_session_message_types_t indication);
+
 /*! 
   \brief DE-Queue an message on a given session
   \param session the session to de-queue the message on
index d578d2d8b1cfb876107e23f3ebc37909bfc94c17..f096f792ba38b8b139275a2741c7905a3ce50ae4 100644 (file)
@@ -950,6 +950,10 @@ static switch_status_t negotiate_media(switch_core_session_t *session)
 
        started = switch_time_now();
 
+       /* jingle has no ringing indication so we will just pretend that we got one */
+       switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
+       switch_channel_mark_ring_ready(channel);
+       
        if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
                tech_pvt->next_cand = switch_time_now() + DL_CAND_WAIT;
                tech_pvt->next_desc = switch_time_now();
index 46908bbac2dfee00af8898aa9701cfe4cd179fe2..163a8058e19a0fc74f8c8e36948044286e61282a 100644 (file)
@@ -1043,6 +1043,10 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Call accepted.\n");
                                break;
                        case IAX_EVENT_RINGA:
+                               if (channel) {
+                                       switch_core_session_queue_indication(tech_pvt->session, SWITCH_MESSAGE_INDICATE_RINGING);
+                                       switch_channel_mark_ring_ready(channel);
+                               }
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Ringing heard.\n");
                                break;
                        case IAX_EVENT_PONG:
index c87e728bb2341fa0cefb35dcafcabb48daac9a53..5a7093699c0fa096e53cfd65910792c34ddff71f 100644 (file)
@@ -240,6 +240,9 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
             }
         }
 
+               switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
+               switch_channel_mark_ring_ready(channel);
+               
                while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
                        if (switch_time_now() - last >= waitsec) {
                                char buf[512];
index 2ea53aad8f8e24b4fe33a1c43d69a926cc74fe7a..7851e91e8abbe1bd7ae11672aab3ade7ee413a0f 100644 (file)
@@ -2823,14 +2823,7 @@ static void sip_i_state(int status,
                                                }
                                                
                                        } else {
-                                               switch_core_session_message_t *msg;
-                                               if ((msg = malloc(sizeof(*msg)))) {
-                                                       memset(msg, 0, sizeof(*msg));
-                                                       msg->message_id = SWITCH_MESSAGE_INDICATE_RINGING;
-                                                       msg->from = __FILE__;
-                                                       switch_core_session_queue_message(session, msg);
-                                                       switch_set_flag(msg, SCSMF_DYNAMIC);
-                                               }
+                                               switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
                                        }
                                }
                        }
index 82a72b74d3f270eae82b4c0febd2782b9786c5b0..fc6e7d46bdf78b1acf4665371bf49640bad7cd3d 100644 (file)
@@ -1160,15 +1160,8 @@ static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
                channel = switch_core_session_get_channel(session);
                assert(channel != NULL);
 
-               if ((msg = malloc(sizeof(*msg)))) {
-                       memset(msg, 0, sizeof(*msg));
-                       msg->message_id = SWITCH_MESSAGE_INDICATE_RINGING;
-                       msg->from = __FILE__;
-                       switch_core_session_queue_message(session, msg);
-                       switch_set_flag(msg, SCSMF_DYNAMIC);
-               } else {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-               }
+               switch_core_session_queue_indication(tech_pvt->session, SWITCH_MESSAGE_INDICATE_RINGING);
+               switch_channel_mark_ring_ready(channel);
 
                switch_core_session_rwunlock(session);
        } else {
index 741851eb816d52dd696deb9297ac7d8db4717e5a..ec396a62cec3ec4fad698c7299e5e8dd3bc44c0f 100644 (file)
@@ -1063,6 +1063,8 @@ static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
                        } else if (!strcasecmp(wmsg.command, "PROCEED")) {
                                /* This packet has lots of info so well keep it */
                                tech_pvt->call_info = wmsg;
+                               switch_core_session_queue_indication(tech_pvt->session, SWITCH_MESSAGE_INDICATE_RINGING);
+                               switch_channel_mark_ring_ready(channel);
                        } else if (switch_test_flag(tech_pvt, TFLAG_PARSE_INCOMING) && !strcasecmp(wmsg.command, "INCOMING")) {
                                char *exten;
                                char cid_name[512];
index 921682a0ebf7af97a3b9a256f0a31a033ca20bb3..a43d52fe91e10f156eefe6783f2cf2246d52fb54 100644 (file)
@@ -1732,6 +1732,22 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_receive_message(switch_core_
        return status;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(switch_core_session_t *session, switch_core_session_message_types_t indication)
+{
+       switch_core_session_message_t *msg;
+
+       if ((msg = malloc(sizeof(*msg)))) {
+               memset(msg, 0, sizeof(*msg));
+               msg->message_id = indication;
+               msg->from = __FILE__;
+               switch_core_session_queue_message(session, msg);
+               switch_set_flag(msg, SCSMF_DYNAMIC);
+               return SWITCH_STATUS_SUCCESS;
+       }
+       
+       return SWITCH_STATUS_FALSE;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_core_session_queue_message(switch_core_session_t *session, switch_core_session_message_t *message)
 {
        switch_status_t status = SWITCH_STATUS_FALSE;