make things work right in windows

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@155 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2005-12-15 00:45:38 +00:00
parent 6630e372c0
commit ced29c144d
5 changed files with 34 additions and 21 deletions

View File

@ -161,8 +161,6 @@ static void audio_bridge_function(switch_core_session *session, char *data)
caller_channel = switch_core_session_get_channel(session); caller_channel = switch_core_session_get_channel(session);
assert(caller_channel != NULL); assert(caller_channel != NULL);
switch_channel_answer(caller_channel);
strncpy(chan_type, data, sizeof(chan_type)); strncpy(chan_type, data, sizeof(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)) { 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); switch_core_session_launch_thread(session, audio_bridge_thread, (void *) &other_audio_thread);
audio_bridge_thread(NULL, (void *) &this_audio_thread); audio_bridge_thread(NULL, (void *) &this_audio_thread);
switch_channel_hangup(peer_channel); switch_channel_hangup(peer_channel);

View File

@ -446,6 +446,7 @@ 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_IO);
switch_clear_flag(tech_pvt, TFLAG_VOICE); switch_clear_flag(tech_pvt, TFLAG_VOICE);
switch_thread_cond_signal(tech_pvt->cond);
switch_channel_hangup(channel); switch_channel_hangup(channel);
switch_thread_cond_signal(tech_pvt->cond); switch_thread_cond_signal(tech_pvt->cond);
@ -927,7 +928,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
case IAX_EVENT_VOICE: case IAX_EVENT_VOICE:
if (tech_pvt && (tech_pvt->read_frame.datalen = iaxevent->datalen)) { if (tech_pvt && (tech_pvt->read_frame.datalen = iaxevent->datalen)) {
int bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame; 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; tech_pvt->read_frame.samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
memcpy(tech_pvt->read_frame.data, iaxevent->data, iaxevent->datalen); memcpy(tech_pvt->read_frame.data, iaxevent->data, iaxevent->datalen);
/* wake up the i/o thread*/ /* wake up the i/o thread*/

View 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); tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL); 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)); switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
@ -246,11 +246,11 @@ static switch_status channel_on_transmit(switch_core_session *session)
engage_device(tech_pvt); engage_device(tech_pvt);
while(switch_channel_get_state(channel) == CS_TRANSMIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) { while(switch_channel_get_state(channel) == CS_TRANSMIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
if (switch_time_now() - last >= waitsec) {
char buf[512]; char buf[512];
snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id); snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
switch_event_fire_subclass(SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING, buf); switch_event_fire_subclass(SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING, buf);
if (switch_time_now() - last >= waitsec) { switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s\n", buf);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
last = switch_time_now(); last = switch_time_now();
} }
switch_yield(50000); 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); tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL); 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))) { 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.datalen = samples * 2;
tech_pvt->read_frame.samples = samples; 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)) { if(!switch_test_flag(tech_pvt, TFLAG_IO)) {
return SWITCH_STATUS_FALSE; 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))); WriteAudioStream(tech_pvt->audio_out, (short *)frame->data, (int)(frame->datalen / sizeof(SAMPLE)));
//XXX send voice //XXX send voice

View 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) 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) 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) 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_profile *caller_profile;
switch_caller_extension *extension; 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))) { if (!(caller_profile = switch_channel_get_caller_profile(session->channel))) {
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't get profile!\n"); switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't get profile!\n");
switch_channel_set_state(session->channel, CS_HANGUP); 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) static void switch_core_standard_on_execute(switch_core_session *session)
{ {

View File

@ -1,6 +1,6 @@
 
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchConsole", "FreeSwitchConsole.vcproj", "{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchConsole", "FreeSwitchConsole.vcproj", "{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@ -68,6 +68,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_speexcodec", "mod_speex
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_test", "mod_event_test.vcproj", "{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}"
ProjectSection(ProjectDependencies) = postProject
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug DLL|Win32 = Debug DLL|Win32 Debug DLL|Win32 = Debug DLL|Win32
@ -188,6 +193,14 @@ Global
{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release DLL|Win32.Build.0 = Release|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release DLL|Win32.Build.0 = Release|Win32
{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.ActiveCfg = Release|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.ActiveCfg = Release|Win32
{5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.Build.0 = Release|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.Build.0 = Release|Win32
{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Debug DLL|Win32.ActiveCfg = Debug|Win32
{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Debug DLL|Win32.Build.0 = Debug|Win32
{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Debug|Win32.ActiveCfg = Debug|Win32
{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Debug|Win32.Build.0 = Debug|Win32
{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Release DLL|Win32.ActiveCfg = Release|Win32
{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Release DLL|Win32.Build.0 = Release|Win32
{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Release|Win32.ActiveCfg = Release|Win32
{3A2A7795-C216-4FFF-B8EF-4D17A84BACCC}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE