mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
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:
@@ -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);
|
||||
|
@@ -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");
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user