mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-24 11:48:48 +00:00
ok we have 22k chatting with 8k
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@294 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
fabaf64c3c
commit
26e057a32d
@ -62,7 +62,7 @@ static switch_status switch_raw_encode(switch_codec *codec,
|
|||||||
{
|
{
|
||||||
|
|
||||||
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary.*/
|
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary.*/
|
||||||
if (decoded_rate != other_codec->implementation->samples_per_second) {
|
if (codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
|
||||||
memcpy(encoded_data, decoded_data, decoded_data_len);
|
memcpy(encoded_data, decoded_data, decoded_data_len);
|
||||||
*encoded_data_len = decoded_data_len;
|
*encoded_data_len = decoded_data_len;
|
||||||
return SWITCH_STATUS_RESAMPLE;
|
return SWITCH_STATUS_RESAMPLE;
|
||||||
@ -80,7 +80,7 @@ static switch_status switch_raw_decode(switch_codec *codec,
|
|||||||
int *decoded_rate,
|
int *decoded_rate,
|
||||||
unsigned int *flag)
|
unsigned int *flag)
|
||||||
{
|
{
|
||||||
if (encoded_rate != other_codec->implementation->samples_per_second) {
|
if (codec->implementation->samples_per_second != other_codec->implementation->samples_per_second) {
|
||||||
memcpy(decoded_data, encoded_data, encoded_data_len);
|
memcpy(decoded_data, encoded_data, encoded_data_len);
|
||||||
*decoded_data_len = encoded_data_len;
|
*decoded_data_len = encoded_data_len;
|
||||||
return SWITCH_STATUS_RESAMPLE;
|
return SWITCH_STATUS_RESAMPLE;
|
||||||
|
@ -161,11 +161,11 @@ SWITCH_DECLARE(FILE *) switch_core_data_channel(switch_text_channel channel)
|
|||||||
FILE *handle = stdout;
|
FILE *handle = stdout;
|
||||||
|
|
||||||
switch (channel) {
|
switch (channel) {
|
||||||
case SWITCH_CHANNEL_ID_CONSOLE:
|
case SWITCH_CHANNEL_ID_CONSOLE:
|
||||||
case SWITCH_CHANNEL_ID_CONSOLE_CLEAN:
|
case SWITCH_CHANNEL_ID_CONSOLE_CLEAN:
|
||||||
handle = runtime.console;
|
handle = runtime.console;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
handle = stdout;
|
handle = stdout;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -279,7 +279,17 @@ SWITCH_DECLARE(switch_status) switch_core_codec_encode(switch_codec *codec,
|
|||||||
return SWITCH_STATUS_GENERR;
|
return SWITCH_STATUS_GENERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return codec->implementation->encode(codec, other_codec, decoded_data, decoded_data_len, decoded_rate, encoded_data, encoded_data_len, encoded_rate, flag);
|
*encoded_data_len = decoded_data_len;
|
||||||
|
return codec->implementation->encode(codec,
|
||||||
|
other_codec,
|
||||||
|
decoded_data,
|
||||||
|
decoded_data_len,
|
||||||
|
decoded_rate,
|
||||||
|
encoded_data,
|
||||||
|
encoded_data_len,
|
||||||
|
encoded_rate,
|
||||||
|
flag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status) switch_core_codec_decode(switch_codec *codec,
|
SWITCH_DECLARE(switch_status) switch_core_codec_decode(switch_codec *codec,
|
||||||
@ -306,7 +316,18 @@ SWITCH_DECLARE(switch_status) switch_core_codec_decode(switch_codec *codec,
|
|||||||
return SWITCH_STATUS_GENERR;
|
return SWITCH_STATUS_GENERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return codec->implementation->decode(codec, other_codec, encoded_data, encoded_data_len, encoded_rate, decoded_data, decoded_data_len, decoded_rate, flag);
|
*decoded_data_len = encoded_data_len;
|
||||||
|
|
||||||
|
return codec->implementation->decode(codec,
|
||||||
|
other_codec,
|
||||||
|
encoded_data,
|
||||||
|
encoded_data_len,
|
||||||
|
encoded_rate,
|
||||||
|
decoded_data,
|
||||||
|
decoded_data_len,
|
||||||
|
decoded_rate,
|
||||||
|
flag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status) switch_core_codec_destroy(switch_codec *codec)
|
SWITCH_DECLARE(switch_status) switch_core_codec_destroy(switch_codec *codec)
|
||||||
@ -458,11 +479,11 @@ static void *switch_core_service_thread(switch_thread *thread, void *obj)
|
|||||||
|
|
||||||
while(data->running > 0) {
|
while(data->running > 0) {
|
||||||
switch(switch_core_session_read_frame(session, &read_frame, -1)) {
|
switch(switch_core_session_read_frame(session, &read_frame, -1)) {
|
||||||
case SWITCH_STATUS_SUCCESS:
|
case SWITCH_STATUS_SUCCESS:
|
||||||
break;
|
break;
|
||||||
case SWITCH_STATUS_TIMEOUT:
|
case SWITCH_STATUS_TIMEOUT:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
data->running = -1;
|
data->running = -1;
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
@ -504,7 +525,7 @@ SWITCH_DECLARE(switch_memory_pool *) switch_core_session_get_pool(switch_core_se
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* **ONLY** alloc things with this function that **WILL NOT** outlive
|
/* **ONLY** alloc things with this function that **WILL NOT** outlive
|
||||||
the session itself or expect an earth shattering KABOOM!*/
|
the session itself or expect an earth shattering KABOOM!*/
|
||||||
SWITCH_DECLARE(void *)switch_core_session_alloc(switch_core_session *session, size_t memory)
|
SWITCH_DECLARE(void *)switch_core_session_alloc(switch_core_session *session, size_t memory)
|
||||||
{
|
{
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
@ -518,7 +539,7 @@ SWITCH_DECLARE(void *)switch_core_session_alloc(switch_core_session *session, si
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* **ONLY** alloc things with these functions that **WILL NOT** need
|
/* **ONLY** alloc things with these functions that **WILL NOT** need
|
||||||
to be freed *EVER* ie this is for *PERMENANT* memory allocation */
|
to be freed *EVER* ie this is for *PERMENANT* memory allocation */
|
||||||
|
|
||||||
SWITCH_DECLARE(void *) switch_core_permenant_alloc(size_t memory)
|
SWITCH_DECLARE(void *) switch_core_permenant_alloc(size_t memory)
|
||||||
{
|
{
|
||||||
@ -713,14 +734,14 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session
|
|||||||
session->read_codec,
|
session->read_codec,
|
||||||
read_frame->data,
|
read_frame->data,
|
||||||
read_frame->datalen,
|
read_frame->datalen,
|
||||||
read_frame->rate,
|
session->read_codec->implementation->samples_per_second,
|
||||||
session->raw_read_frame.data,
|
session->raw_read_frame.data,
|
||||||
&session->raw_read_frame.datalen,
|
&session->raw_read_frame.datalen,
|
||||||
&session->raw_read_frame.rate,
|
&session->raw_read_frame.rate,
|
||||||
&flag);
|
&flag);
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SWITCH_STATUS_RESAMPLE:
|
case SWITCH_STATUS_RESAMPLE:
|
||||||
if (!session->read_resampler) {
|
if (!session->read_resampler) {
|
||||||
switch_resample_create(&session->read_resampler,
|
switch_resample_create(&session->read_resampler,
|
||||||
read_frame->codec->implementation->samples_per_second,
|
read_frame->codec->implementation->samples_per_second,
|
||||||
@ -729,13 +750,13 @@ case SWITCH_STATUS_RESAMPLE:
|
|||||||
session->read_codec->implementation->bytes_per_frame * 10,
|
session->read_codec->implementation->bytes_per_frame * 10,
|
||||||
session->pool);
|
session->pool);
|
||||||
}
|
}
|
||||||
case SWITCH_STATUS_SUCCESS:
|
case SWITCH_STATUS_SUCCESS:
|
||||||
read_frame = &session->raw_read_frame;
|
read_frame = &session->raw_read_frame;
|
||||||
break;
|
break;
|
||||||
case SWITCH_STATUS_NOOP:
|
case SWITCH_STATUS_NOOP:
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s decoder error!\n", session->read_codec->codec_interface->interface_name);
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s decoder error!\n", session->read_codec->codec_interface->interface_name);
|
||||||
return status;
|
return status;
|
||||||
break;
|
break;
|
||||||
@ -776,6 +797,7 @@ default:
|
|||||||
|
|
||||||
if (perfect) {
|
if (perfect) {
|
||||||
enc_frame = *frame;
|
enc_frame = *frame;
|
||||||
|
session->raw_read_frame.rate = (*frame)->rate;
|
||||||
} else {
|
} else {
|
||||||
session->raw_read_frame.datalen = switch_buffer_read(session->raw_read_buffer,
|
session->raw_read_frame.datalen = switch_buffer_read(session->raw_read_buffer,
|
||||||
session->raw_read_frame.data,
|
session->raw_read_frame.data,
|
||||||
@ -788,7 +810,7 @@ default:
|
|||||||
(*frame)->codec,
|
(*frame)->codec,
|
||||||
session->raw_read_frame.data,
|
session->raw_read_frame.data,
|
||||||
session->raw_read_frame.datalen,
|
session->raw_read_frame.datalen,
|
||||||
session->raw_read_frame.rate,
|
(*frame)->codec->implementation->samples_per_second,
|
||||||
session->enc_read_frame.data,
|
session->enc_read_frame.data,
|
||||||
&session->enc_read_frame.datalen,
|
&session->enc_read_frame.datalen,
|
||||||
&session->enc_read_frame.rate,
|
&session->enc_read_frame.rate,
|
||||||
@ -796,14 +818,16 @@ default:
|
|||||||
|
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SWITCH_STATUS_SUCCESS:
|
case SWITCH_STATUS_RESAMPLE:
|
||||||
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "fixme 1\n");
|
||||||
|
case SWITCH_STATUS_SUCCESS:
|
||||||
*frame = &session->enc_read_frame;
|
*frame = &session->enc_read_frame;
|
||||||
break;
|
break;
|
||||||
case SWITCH_STATUS_NOOP:
|
case SWITCH_STATUS_NOOP:
|
||||||
*frame = &session->raw_read_frame;
|
*frame = &session->raw_read_frame;
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s encoder error!\n", session->read_codec->codec_interface->interface_name);
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s encoder error!\n", session->read_codec->codec_interface->interface_name);
|
||||||
*frame = NULL;
|
*frame = NULL;
|
||||||
status = SWITCH_STATUS_GENERR;
|
status = SWITCH_STATUS_GENERR;
|
||||||
@ -860,14 +884,14 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio
|
|||||||
session->write_codec,
|
session->write_codec,
|
||||||
frame->data,
|
frame->data,
|
||||||
frame->datalen,
|
frame->datalen,
|
||||||
frame->rate,
|
session->write_codec->implementation->samples_per_second,
|
||||||
session->raw_write_frame.data,
|
session->raw_write_frame.data,
|
||||||
&session->raw_write_frame.datalen,
|
&session->raw_write_frame.datalen,
|
||||||
&session->raw_write_frame.rate,
|
&session->raw_write_frame.rate,
|
||||||
&flag);
|
&flag);
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SWITCH_STATUS_RESAMPLE:
|
case SWITCH_STATUS_RESAMPLE:
|
||||||
write_frame = &session->raw_write_frame;
|
write_frame = &session->raw_write_frame;
|
||||||
if (!session->write_resampler) {
|
if (!session->write_resampler) {
|
||||||
status = switch_resample_create(&session->write_resampler,
|
status = switch_resample_create(&session->write_resampler,
|
||||||
@ -878,14 +902,14 @@ case SWITCH_STATUS_RESAMPLE:
|
|||||||
session->pool);
|
session->pool);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SWITCH_STATUS_SUCCESS:
|
case SWITCH_STATUS_SUCCESS:
|
||||||
write_frame = &session->raw_write_frame;
|
write_frame = &session->raw_write_frame;
|
||||||
break;
|
break;
|
||||||
case SWITCH_STATUS_NOOP:
|
case SWITCH_STATUS_NOOP:
|
||||||
write_frame = frame;
|
write_frame = frame;
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s decoder error!\n", frame->codec->codec_interface->interface_name);
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s decoder error!\n", frame->codec->codec_interface->interface_name);
|
||||||
return status;
|
return status;
|
||||||
break;
|
break;
|
||||||
@ -901,7 +925,7 @@ default:
|
|||||||
session->write_resampler->to,
|
session->write_resampler->to,
|
||||||
(int)session->write_resampler->to_size,
|
(int)session->write_resampler->to_size,
|
||||||
0);
|
0);
|
||||||
switch_float_to_short(session->write_resampler->to, data, write_frame->datalen);
|
switch_float_to_short(session->write_resampler->to, data, write_frame->datalen * 2);
|
||||||
write_frame->samples = session->write_resampler->to_len;
|
write_frame->samples = session->write_resampler->to_len;
|
||||||
write_frame->datalen = session->write_resampler->to_len * 2;
|
write_frame->datalen = session->write_resampler->to_len * 2;
|
||||||
write_frame->rate = session->write_resampler->to_rate;
|
write_frame->rate = session->write_resampler->to_rate;
|
||||||
@ -935,21 +959,23 @@ default:
|
|||||||
frame->codec,
|
frame->codec,
|
||||||
enc_frame->data,
|
enc_frame->data,
|
||||||
enc_frame->datalen,
|
enc_frame->datalen,
|
||||||
enc_frame->rate,
|
session->write_codec->implementation->samples_per_second,
|
||||||
session->enc_write_frame.data,
|
session->enc_write_frame.data,
|
||||||
&session->enc_write_frame.datalen,
|
&session->enc_write_frame.datalen,
|
||||||
&session->enc_write_frame.rate,
|
&session->enc_write_frame.rate,
|
||||||
&flag);
|
&flag);
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SWITCH_STATUS_SUCCESS:
|
case SWITCH_STATUS_RESAMPLE:
|
||||||
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "fixme 2\n");
|
||||||
|
case SWITCH_STATUS_SUCCESS:
|
||||||
write_frame = &session->enc_write_frame;
|
write_frame = &session->enc_write_frame;
|
||||||
break;
|
break;
|
||||||
case SWITCH_STATUS_NOOP:
|
case SWITCH_STATUS_NOOP:
|
||||||
write_frame = enc_frame;
|
write_frame = enc_frame;
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s encoder error!\n", session->read_codec->codec_interface->interface_name);
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s encoder error!\n", session->read_codec->codec_interface->interface_name);
|
||||||
write_frame = NULL;
|
write_frame = NULL;
|
||||||
return status;
|
return status;
|
||||||
@ -979,7 +1005,7 @@ default:
|
|||||||
frame->codec,
|
frame->codec,
|
||||||
enc_frame->data,
|
enc_frame->data,
|
||||||
enc_frame->datalen,
|
enc_frame->datalen,
|
||||||
enc_frame->rate,
|
frame->codec->implementation->samples_per_second,
|
||||||
session->enc_write_frame.data,
|
session->enc_write_frame.data,
|
||||||
&session->enc_write_frame.datalen,
|
&session->enc_write_frame.datalen,
|
||||||
&session->enc_write_frame.rate,
|
&session->enc_write_frame.rate,
|
||||||
@ -988,19 +1014,48 @@ default:
|
|||||||
|
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SWITCH_STATUS_SUCCESS:
|
case SWITCH_STATUS_RESAMPLE:
|
||||||
|
write_frame = &session->enc_write_frame;
|
||||||
|
if (!session->read_resampler) {
|
||||||
|
status = switch_resample_create(&session->read_resampler,
|
||||||
|
frame->codec->implementation->samples_per_second,
|
||||||
|
frame->codec->implementation->bytes_per_frame * 10,
|
||||||
|
session->write_codec->implementation->samples_per_second,
|
||||||
|
session->write_codec->implementation->bytes_per_frame * 10,
|
||||||
|
session->pool);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SWITCH_STATUS_SUCCESS:
|
||||||
write_frame = &session->enc_write_frame;
|
write_frame = &session->enc_write_frame;
|
||||||
break;
|
break;
|
||||||
case SWITCH_STATUS_NOOP:
|
case SWITCH_STATUS_NOOP:
|
||||||
write_frame = enc_frame;
|
write_frame = enc_frame;
|
||||||
status = SWITCH_STATUS_SUCCESS;
|
status = SWITCH_STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s encoder error!\n", session->read_codec->codec_interface->interface_name);
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec %s encoder error!\n", session->read_codec->codec_interface->interface_name);
|
||||||
write_frame = NULL;
|
write_frame = NULL;
|
||||||
return status;
|
return status;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (session->read_resampler) {
|
||||||
|
short *data = write_frame->data;
|
||||||
|
|
||||||
|
session->read_resampler->from_len = switch_short_to_float(data,
|
||||||
|
session->read_resampler->from,
|
||||||
|
(int)write_frame->datalen / 2);
|
||||||
|
session->read_resampler->to_len = switch_resample_process(session->read_resampler,
|
||||||
|
session->read_resampler->from,
|
||||||
|
session->read_resampler->from_len,
|
||||||
|
session->read_resampler->to,
|
||||||
|
(int)session->read_resampler->to_size,
|
||||||
|
0);
|
||||||
|
switch_float_to_short(session->read_resampler->to, data, write_frame->datalen * 2);
|
||||||
|
write_frame->samples = session->read_resampler->to_len;
|
||||||
|
write_frame->datalen = session->read_resampler->to_len * 2;
|
||||||
|
write_frame->rate = session->read_resampler->to_rate;
|
||||||
|
}
|
||||||
status = perform_write(session, write_frame, timeout, io_flag);
|
status = perform_write(session, write_frame, timeout, io_flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1431,13 +1486,13 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch ( state ) {
|
switch ( state ) {
|
||||||
case CS_NEW: /* Just created, Waiting for first instructions */
|
case CS_NEW: /* Just created, Waiting for first instructions */
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State NEW\n");
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State NEW\n");
|
||||||
break;
|
break;
|
||||||
case CS_DONE:
|
case CS_DONE:
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
case CS_HANGUP: /* Deactivate and end the thread */
|
case CS_HANGUP: /* Deactivate and end the thread */
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State HANGUP\n");
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State HANGUP\n");
|
||||||
if (!driver_event_handlers->on_hangup ||
|
if (!driver_event_handlers->on_hangup ||
|
||||||
(driver_event_handlers->on_hangup &&
|
(driver_event_handlers->on_hangup &&
|
||||||
@ -1452,7 +1507,7 @@ case CS_HANGUP: /* Deactivate and end the thread */
|
|||||||
}
|
}
|
||||||
switch_channel_set_state(session->channel, CS_DONE);
|
switch_channel_set_state(session->channel, CS_DONE);
|
||||||
break;
|
break;
|
||||||
case CS_INIT: /* Basic setup tasks */
|
case CS_INIT: /* Basic setup tasks */
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State INIT\n");
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State INIT\n");
|
||||||
if (!driver_event_handlers->on_init ||
|
if (!driver_event_handlers->on_init ||
|
||||||
(driver_event_handlers->on_init &&
|
(driver_event_handlers->on_init &&
|
||||||
@ -1466,7 +1521,7 @@ case CS_INIT: /* Basic setup tasks */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CS_RING: /* Look for a dialplan and find something to do */
|
case CS_RING: /* Look for a dialplan and find something to do */
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State RING\n");
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State RING\n");
|
||||||
if (!driver_event_handlers->on_ring ||
|
if (!driver_event_handlers->on_ring ||
|
||||||
(driver_event_handlers->on_ring &&
|
(driver_event_handlers->on_ring &&
|
||||||
@ -1480,7 +1535,7 @@ case CS_RING: /* Look for a dialplan and find something to do */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CS_EXECUTE: /* Execute an Operation*/
|
case CS_EXECUTE: /* Execute an Operation*/
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State EXECUTE\n");
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State EXECUTE\n");
|
||||||
if (!driver_event_handlers->on_execute ||
|
if (!driver_event_handlers->on_execute ||
|
||||||
(driver_event_handlers->on_execute &&
|
(driver_event_handlers->on_execute &&
|
||||||
@ -1494,7 +1549,7 @@ case CS_EXECUTE: /* Execute an Operation*/
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CS_LOOPBACK: /* loop all data back to source */
|
case CS_LOOPBACK: /* loop all data back to source */
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State LOOPBACK\n");
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State LOOPBACK\n");
|
||||||
if (!driver_event_handlers->on_loopback ||
|
if (!driver_event_handlers->on_loopback ||
|
||||||
(driver_event_handlers->on_loopback &&
|
(driver_event_handlers->on_loopback &&
|
||||||
@ -1508,7 +1563,7 @@ case CS_LOOPBACK: /* loop all data back to source */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CS_TRANSMIT: /* send/recieve data to/from another channel */
|
case CS_TRANSMIT: /* send/recieve data to/from another channel */
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State TRANSMIT\n");
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "State TRANSMIT\n");
|
||||||
if (!driver_event_handlers->on_transmit ||
|
if (!driver_event_handlers->on_transmit ||
|
||||||
(driver_event_handlers->on_transmit &&
|
(driver_event_handlers->on_transmit &&
|
||||||
@ -1581,16 +1636,16 @@ SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash *hash, char *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This function abstracts the thread creation for modules by allowing you to pass a function ptr and
|
/* This function abstracts the thread creation for modules by allowing you to pass a function ptr and
|
||||||
a void object and trust that that the function will be run in a thread with arg This lets
|
a void object and trust that that the function will be run in a thread with arg This lets
|
||||||
you request and activate a thread without giving up any knowledge about what is in the thread
|
you request and activate a thread without giving up any knowledge about what is in the thread
|
||||||
neither the core nor the calling module know anything about each other.
|
neither the core nor the calling module know anything about each other.
|
||||||
|
|
||||||
This thread is expected to never exit until the application exits so the func is responsible
|
This thread is expected to never exit until the application exits so the func is responsible
|
||||||
to make sure that is the case.
|
to make sure that is the case.
|
||||||
|
|
||||||
The typical use for this is so switch_loadable_module.c can start up a thread for each module
|
The typical use for this is so switch_loadable_module.c can start up a thread for each module
|
||||||
passing the table of module methods as a session obj into the core without actually allowing
|
passing the table of module methods as a session obj into the core without actually allowing
|
||||||
the core to have any clue and keeping switch_loadable_module.c from needing any thread code.
|
the core to have any clue and keeping switch_loadable_module.c from needing any thread code.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1770,12 +1825,13 @@ static void core_event_handler (switch_event *event)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
switch(event->event_id) {
|
switch(event->event_id) {
|
||||||
case SWITCH_EVENT_LOG:
|
case SWITCH_EVENT_LOG:
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
switch_event_serialize(event, buf, sizeof(buf), NULL);
|
buf[0] = '\0';
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nCORE EVENT\n--------------------------------\n%s\n", buf);
|
//switch_event_serialize(event, buf, sizeof(buf), NULL);
|
||||||
|
//switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nCORE EVENT\n--------------------------------\n%s\n", buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user