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, '/'))) {
}
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);
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));
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");
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));
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);
}
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;
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
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)
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);
}
}
}
-
- switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard RING\n");
-}
+ }
static void switch_core_standard_on_execute(switch_core_session *session)
{
\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
{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
{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