]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make things work right in windows
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Dec 2005 00:45:38 +0000 (00:45 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Dec 2005 00:45:38 +0000 (00:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@155 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/mod_bridgecall/mod_bridgecall.c
src/mod/mod_iaxchan/mod_iaxchan.c
src/mod/mod_portaudio/mod_portaudio.c
src/switch_core.c
w32/vsnet/Freeswitch.sln

index e24ad29ca8ed4d67d10a24eab35c5bb3accd0891..5ce63aaff71f602c0fc98af5bc4f871b2a3541f5 100644 (file)
@@ -161,9 +161,7 @@ static void audio_bridge_function(switch_core_session *session, char *data)
        caller_channel = switch_core_session_get_channel(session);
        assert(caller_channel != NULL);
 
-       switch_channel_answer(caller_channel);
 
-       
        strncpy(chan_type, data, sizeof(chan_type));
 
        if ((chan_data = strchr(chan_type, '/'))) {
@@ -226,6 +224,7 @@ static void audio_bridge_function(switch_core_session *session, char *data)
                }
 
                if (switch_channel_test_flag(peer_channel, CF_ANSWERED)) {
+                       switch_channel_answer(caller_channel);
                        switch_core_session_launch_thread(session, audio_bridge_thread, (void *) &other_audio_thread);
                        audio_bridge_thread(NULL, (void *) &this_audio_thread);
                        switch_channel_hangup(peer_channel);
index 7b93cf8ad7ddd94deb7c82526499a3e2cccfbbe1..c0254a6ddd52401c4716fb7c9e08d5179c591411 100644 (file)
@@ -446,9 +446,10 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
 
        switch_clear_flag(tech_pvt, TFLAG_IO);
        switch_clear_flag(tech_pvt, TFLAG_VOICE);
+       switch_thread_cond_signal(tech_pvt->cond);
        switch_channel_hangup(channel);
        switch_thread_cond_signal(tech_pvt->cond);
-
+       
        switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
 
        
@@ -927,13 +928,13 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
                    case IAX_EVENT_VOICE:
                                if (tech_pvt && (tech_pvt->read_frame.datalen = iaxevent->datalen)) {
                                        int bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
-                                       int frames = (tech_pvt->read_frame.datalen / bytes);
+                                       int frames = (int)(tech_pvt->read_frame.datalen / bytes);
                                        tech_pvt->read_frame.samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
                                        memcpy(tech_pvt->read_frame.data, iaxevent->data, iaxevent->datalen);
                                        /* wake up the i/o thread*/
                                        switch_set_flag(tech_pvt, TFLAG_VOICE);
                                        switch_thread_cond_signal(tech_pvt->cond);
-                               }
+                               }                               
                                break;
                    case IAX_EVENT_TRANSFER:
                                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Call transfer occurred.\n");
index 7ea4c7a7bf5d93993a8a099bb1ecb5177572ded2..bfe421fc11809942c8d756bafad130ca48dc472e 100644 (file)
@@ -214,7 +214,7 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
 
-       switch_channel_hangup(channel);
+       switch_clear_flag(tech_pvt, TFLAG_IO);
        switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
 
        
@@ -246,12 +246,12 @@ static switch_status channel_on_transmit(switch_core_session *session)
        engage_device(tech_pvt);
 
        while(switch_channel_get_state(channel) == CS_TRANSMIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
+               if (switch_time_now() - last >= waitsec) {
                char buf[512];
                snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
                switch_event_fire_subclass(SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING, buf);
-               if (switch_time_now() - last >= waitsec) {
-                       switch_console_printf(SWITCH_CHANNEL_CONSOLE, "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
-                       last = switch_time_now();
+               switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s\n", buf);
+               last = switch_time_now();
                }
                switch_yield(50000);
        }
@@ -363,6 +363,10 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
        tech_pvt = switch_core_session_get_private(session);
        assert(tech_pvt != NULL);
 
+       if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+               return SWITCH_STATUS_FALSE;
+       }
+
        if      ((samples = ReadAudioStream(tech_pvt->audio_in, tech_pvt->read_frame.data, tech_pvt->read_codec.implementation->samples_per_frame))) {
                tech_pvt->read_frame.datalen = samples * 2;
                tech_pvt->read_frame.samples = samples;
@@ -389,12 +393,6 @@ static switch_status channel_write_frame(switch_core_session *session, switch_fr
        if(!switch_test_flag(tech_pvt, TFLAG_IO)) {
                return SWITCH_STATUS_FALSE;
        }
-/*
-       if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
-               switch_swap_linear(frame->data, (int)frame->datalen / 2);
-       }
-*/
-       
 
        WriteAudioStream(tech_pvt->audio_out, (short *)frame->data, (int)(frame->datalen / sizeof(SAMPLE)));
        //XXX send voice
index b20ce306452fcca13fde1cb0ccdb8ee42aedaacf..e7bafdedd11d7f9f7d29b206c4213a857e7b86be 100644 (file)
@@ -1060,12 +1060,14 @@ SWITCH_DECLARE(switch_channel *) switch_core_session_get_channel(switch_core_ses
 
 static void switch_core_standard_on_init(switch_core_session *session)
 {
-       switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard INIT\n");
+       switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard INIT %s\n", switch_channel_get_name(session->channel));
 }
 
 static void switch_core_standard_on_hangup(switch_core_session *session)
 {
-       switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard HANGUP\n");
+       
+       switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard HANGUP %s\n", switch_channel_get_name(session->channel));
+
 }
 
 static void switch_core_standard_on_ring(switch_core_session *session)
@@ -1074,6 +1076,8 @@ static void switch_core_standard_on_ring(switch_core_session *session)
        switch_caller_profile *caller_profile;
        switch_caller_extension *extension;
 
+       switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard RING %s\n", switch_channel_get_name(session->channel));
+
        if (!(caller_profile = switch_channel_get_caller_profile(session->channel))) {
                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't get profile!\n");
                switch_channel_set_state(session->channel, CS_HANGUP);
@@ -1087,9 +1091,7 @@ static void switch_core_standard_on_ring(switch_core_session *session)
                        }
                }
        }
-
-       switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard RING\n");
-}
+ }
 
 static void switch_core_standard_on_execute(switch_core_session *session)
 {
index f88165bc552a5ce2ae08333826e45f487cac2a32..778012d71548882023715532a20d8c438a94e17a 100644 (file)
@@ -1,6 +1,6 @@
 \r
 Microsoft Visual Studio Solution File, Format Version 9.00\r
-# Visual C++ Express 2005\r
+# Visual Studio 2005\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchConsole", "FreeSwitchConsole.vcproj", "{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}"\r
        ProjectSection(ProjectDependencies) = postProject\r
                {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}\r
@@ -68,6 +68,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_speexcodec", "mod_speex
                {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}\r
        EndProjectSection\r
 EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_test", "mod_event_test.vcproj", "{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}"\r
+       ProjectSection(ProjectDependencies) = postProject\r
+               {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}\r
+       EndProjectSection\r
+EndProject\r
 Global\r
        GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
                Debug DLL|Win32 = Debug DLL|Win32\r
@@ -188,6 +193,14 @@ Global
                {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release DLL|Win32.Build.0 = Release|Win32\r
                {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.ActiveCfg = Release|Win32\r
                {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.Build.0 = Release|Win32\r
+               {3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Debug DLL|Win32.ActiveCfg = Debug|Win32\r
+               {3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Debug DLL|Win32.Build.0 = Debug|Win32\r
+               {3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Debug|Win32.ActiveCfg = Debug|Win32\r
+               {3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Debug|Win32.Build.0 = Debug|Win32\r
+               {3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Release DLL|Win32.ActiveCfg = Release|Win32\r
+               {3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Release DLL|Win32.Build.0 = Release|Win32\r
+               {3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Release|Win32.ActiveCfg = Release|Win32\r
+               {3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Release|Win32.Build.0 = Release|Win32\r
        EndGlobalSection\r
        GlobalSection(SolutionProperties) = preSolution\r
                HideSolutionNode = FALSE\r