mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-21 19:02:06 +00:00
cleanup and formating
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@261 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
900c08571b
commit
bedcabb8ec
@ -61,11 +61,11 @@ static void *audio_bridge_thread(switch_thread *thread, void *obj)
|
|||||||
switch_channel_state b_state = switch_channel_get_state(chan_b);
|
switch_channel_state b_state = switch_channel_get_state(chan_b);
|
||||||
|
|
||||||
switch (b_state) {
|
switch (b_state) {
|
||||||
case CS_HANGUP:
|
case CS_HANGUP:
|
||||||
data->running = -1;
|
data->running = -1;
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,3 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
|||||||
/* indicate that the module should continue to be loaded */
|
/* indicate that the module should continue to be loaded */
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define HAVE_APR
|
#define HAVE_APR
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <jrtp4c.h>
|
#include <jrtp4c.h>
|
||||||
@ -191,15 +190,15 @@ static int sdp_add_codec(struct osip_rfc3264 *cnf, int codec_type, int payload,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (codec_type) {
|
switch (codec_type) {
|
||||||
case SWITCH_CODEC_TYPE_AUDIO:
|
case SWITCH_CODEC_TYPE_AUDIO:
|
||||||
med->m_media = osip_strdup("audio");
|
med->m_media = osip_strdup("audio");
|
||||||
osip_rfc3264_add_audio_media(cnf, med, -1);
|
osip_rfc3264_add_audio_media(cnf, med, -1);
|
||||||
break;
|
break;
|
||||||
case SWITCH_CODEC_TYPE_VIDEO:
|
case SWITCH_CODEC_TYPE_VIDEO:
|
||||||
med->m_media = osip_strdup("video");
|
med->m_media = osip_strdup("video");
|
||||||
osip_rfc3264_add_video_media(cnf, med, -1);
|
osip_rfc3264_add_video_media(cnf, med, -1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -207,9 +206,9 @@ static int sdp_add_codec(struct osip_rfc3264 *cnf, int codec_type, int payload,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
State methods they get called when the state changes to the specific state
|
State methods they get called when the state changes to the specific state
|
||||||
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
|
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
|
||||||
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
|
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
|
||||||
*/
|
*/
|
||||||
static switch_status exosip_on_init(switch_core_session *session)
|
static switch_status exosip_on_init(switch_core_session *session)
|
||||||
{
|
{
|
||||||
|
@ -344,9 +344,9 @@ static void iax_out_cb(const char *s)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
State methods they get called when the state changes to the specific state
|
State methods they get called when the state changes to the specific state
|
||||||
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
|
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
|
||||||
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
|
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
|
||||||
*/
|
*/
|
||||||
static switch_status channel_on_init(switch_core_session *session)
|
static switch_status channel_on_init(switch_core_session *session)
|
||||||
{
|
{
|
||||||
@ -475,7 +475,7 @@ static switch_status channel_on_transmit(switch_core_session *session)
|
|||||||
|
|
||||||
|
|
||||||
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
|
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
|
||||||
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
|
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
|
||||||
*/
|
*/
|
||||||
static switch_status channel_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile, switch_core_session **new_session)
|
static switch_status channel_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile, switch_core_session **new_session)
|
||||||
{
|
{
|
||||||
|
@ -188,8 +188,8 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 'switch_module_runtime' will start up in a thread by itself just by having it exist
|
/* 'switch_module_runtime' will start up in a thread by itself just by having it exist
|
||||||
if it returns anything but SWITCH_STATUS_TERM it will be called again automaticly
|
if it returns anything but SWITCH_STATUS_TERM it will be called again automaticly
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//switch_status switch_module_runtime(void)
|
//switch_status switch_module_runtime(void)
|
||||||
|
@ -95,40 +95,6 @@ static switch_status switch_raw_destroy(switch_codec *codec)
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
switch_status raw_file_open(switch_file_handle *handle, char *path)
|
|
||||||
{
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_status raw_file_close(switch_file_handle *handle)
|
|
||||||
{
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_status raw_file_seek(switch_file_handle *handle, unsigned int *cur_sample, unsigned int samples, int whence)
|
|
||||||
{
|
|
||||||
return SWITCH_STATUS_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Registration */
|
|
||||||
|
|
||||||
|
|
||||||
static char *supported_formats[] = {"raw", "r8k", NULL};
|
|
||||||
|
|
||||||
static const switch_file_interface raw_file_interface = {
|
|
||||||
/*.interface_name*/ "raw",
|
|
||||||
/*.file_open*/ raw_file_open,
|
|
||||||
/*.file_close*/ raw_file_close,
|
|
||||||
/*.file_read*/ NULL,
|
|
||||||
/*.file_write*/ NULL,
|
|
||||||
/*.file_seek*/ raw_file_seek,
|
|
||||||
/*.extens*/ supported_formats,
|
|
||||||
/*.next*/ NULL,
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const switch_codec_implementation raw_32k_implementation = {
|
static const switch_codec_implementation raw_32k_implementation = {
|
||||||
/*.samples_per_second = */ 32000,
|
/*.samples_per_second = */ 32000,
|
||||||
/*.bits_per_second = */ 512000,
|
/*.bits_per_second = */ 512000,
|
||||||
|
@ -150,7 +150,7 @@ struct private_object {
|
|||||||
struct woomera_profile *profile;
|
struct woomera_profile *profile;
|
||||||
char dest[WOOMERA_STRLEN];
|
char dest[WOOMERA_STRLEN];
|
||||||
int port;
|
int port;
|
||||||
struct timeval started;
|
switch_time_t started;
|
||||||
int timeout;
|
int timeout;
|
||||||
char dtmfbuf[WOOMERA_STRLEN];
|
char dtmfbuf[WOOMERA_STRLEN];
|
||||||
switch_caller_profile *caller_profile;
|
switch_caller_profile *caller_profile;
|
||||||
|
@ -296,85 +296,85 @@ SWITCH_DECLARE(switch_channel_state) switch_channel_set_state(switch_channel *ch
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
switch(last_state) {
|
switch(last_state) {
|
||||||
case CS_NEW:
|
case CS_NEW:
|
||||||
switch(state) {
|
switch(state) {
|
||||||
default:
|
default:
|
||||||
ok++;
|
ok++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CS_INIT:
|
case CS_INIT:
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case CS_LOOPBACK:
|
case CS_LOOPBACK:
|
||||||
case CS_TRANSMIT:
|
case CS_TRANSMIT:
|
||||||
case CS_RING:
|
case CS_RING:
|
||||||
case CS_EXECUTE:
|
case CS_EXECUTE:
|
||||||
case CS_HANGUP:
|
case CS_HANGUP:
|
||||||
ok++;
|
ok++;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CS_LOOPBACK:
|
case CS_LOOPBACK:
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case CS_TRANSMIT:
|
case CS_TRANSMIT:
|
||||||
case CS_RING:
|
case CS_RING:
|
||||||
case CS_EXECUTE:
|
case CS_EXECUTE:
|
||||||
case CS_HANGUP:
|
case CS_HANGUP:
|
||||||
ok++;
|
ok++;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CS_TRANSMIT:
|
case CS_TRANSMIT:
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case CS_LOOPBACK:
|
case CS_LOOPBACK:
|
||||||
case CS_RING:
|
case CS_RING:
|
||||||
case CS_EXECUTE:
|
case CS_EXECUTE:
|
||||||
case CS_HANGUP:
|
case CS_HANGUP:
|
||||||
ok++;
|
ok++;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CS_RING:
|
case CS_RING:
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case CS_LOOPBACK:
|
case CS_LOOPBACK:
|
||||||
case CS_EXECUTE:
|
case CS_EXECUTE:
|
||||||
case CS_HANGUP:
|
case CS_HANGUP:
|
||||||
case CS_TRANSMIT:
|
case CS_TRANSMIT:
|
||||||
ok++;
|
ok++;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CS_EXECUTE:
|
case CS_EXECUTE:
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case CS_LOOPBACK:
|
case CS_LOOPBACK:
|
||||||
case CS_TRANSMIT:
|
case CS_TRANSMIT:
|
||||||
case CS_RING:
|
case CS_RING:
|
||||||
case CS_HANGUP:
|
case CS_HANGUP:
|
||||||
ok++;
|
ok++;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CS_HANGUP:
|
case CS_HANGUP:
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case CS_DONE:
|
case CS_DONE:
|
||||||
ok++;
|
ok++;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
static int switch_console_process(char *cmd)
|
static int switch_console_process(char *cmd)
|
||||||
{
|
{
|
||||||
char *arg = NULL;
|
char *arg = NULL;
|
||||||
char retbuf[1024] = "";
|
char retbuf[1024] = "";
|
||||||
|
|
||||||
#ifdef EMBED_PERL
|
#ifdef EMBED_PERL
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
@ -458,11 +458,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 +504,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 +518,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)
|
||||||
{
|
{
|
||||||
@ -720,7 +720,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session
|
|||||||
&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 +729,13 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session
|
|||||||
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;
|
||||||
@ -796,14 +796,14 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session
|
|||||||
|
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SWITCH_STATUS_SUCCESS:
|
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;
|
||||||
@ -867,7 +867,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio
|
|||||||
&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 +878,14 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio
|
|||||||
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;
|
||||||
@ -942,14 +942,14 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio
|
|||||||
&flag);
|
&flag);
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SWITCH_STATUS_SUCCESS:
|
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;
|
||||||
@ -988,14 +988,14 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio
|
|||||||
|
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SWITCH_STATUS_SUCCESS:
|
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;
|
||||||
@ -1324,7 +1324,7 @@ static void switch_core_standard_on_ring(switch_core_session *session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void switch_core_standard_on_execute(switch_core_session *session)
|
static void switch_core_standard_on_execute(switch_core_session *session)
|
||||||
{
|
{
|
||||||
@ -1431,13 +1431,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 +1452,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||||||
}
|
}
|
||||||
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 +1466,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 +1480,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 +1494,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 +1508,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
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 +1581,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.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -1766,10 +1766,10 @@ 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);
|
switch_event_serialize(event, buf, sizeof(buf), NULL);
|
||||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nCORE EVENT\n--------------------------------\n%s\n", buf);
|
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nCORE EVENT\n--------------------------------\n%s\n", buf);
|
||||||
break;
|
break;
|
||||||
|
@ -84,7 +84,7 @@ static void *locked_dup(char *str)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* make sure this is synced with the switch_event_t enum in switch_types.h
|
/* make sure this is synced with the switch_event_t enum in switch_types.h
|
||||||
also never put any new ones before EVENT_ALL
|
also never put any new ones before EVENT_ALL
|
||||||
*/
|
*/
|
||||||
static char *EVENT_NAMES[] = {
|
static char *EVENT_NAMES[] = {
|
||||||
"CUSTOM",
|
"CUSTOM",
|
||||||
|
@ -72,21 +72,16 @@ SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll,
|
|||||||
switch_pollset_t *pollset;
|
switch_pollset_t *pollset;
|
||||||
switch_status status;
|
switch_status status;
|
||||||
|
|
||||||
|
|
||||||
if ((status = switch_pollset_create(&pollset, 1, pool, flags)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = switch_pollset_create(&pollset, 1, pool, flags)) != SWITCH_STATUS_SUCCESS) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
poll->desc_type = SWITCH_POLL_SOCKET;
|
poll->desc_type = SWITCH_POLL_SOCKET;
|
||||||
poll->reqevents = flags;
|
poll->reqevents = flags;
|
||||||
poll->desc.s = sock;
|
poll->desc.s = sock;
|
||||||
poll->client_data = sock;
|
poll->client_data = sock;
|
||||||
|
|
||||||
return switch_pollset_add(pollset, poll);
|
return switch_pollset_add(pollset, poll);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -102,54 +97,6 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms)
|
|||||||
return nsds;
|
return nsds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_TIMEVAL_STRUCT
|
|
||||||
#define ONE_MILLION 1000000
|
|
||||||
/*
|
|
||||||
* put timeval in a valid range. usec is 0..999999
|
|
||||||
* negative values are not allowed and truncated.
|
|
||||||
*/
|
|
||||||
static struct timeval tvfix(struct timeval a)
|
|
||||||
{
|
|
||||||
if (a.tv_usec >= ONE_MILLION) {
|
|
||||||
a.tv_sec += a.tv_usec % ONE_MILLION;
|
|
||||||
a.tv_usec %= ONE_MILLION;
|
|
||||||
} else if (a.tv_usec < 0) {
|
|
||||||
a.tv_usec = 0;
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct timeval switch_tvadd(struct timeval a, struct timeval b)
|
|
||||||
{
|
|
||||||
/* consistency checks to guarantee usec in 0..999999 */
|
|
||||||
a = tvfix(a);
|
|
||||||
b = tvfix(b);
|
|
||||||
a.tv_sec += b.tv_sec;
|
|
||||||
a.tv_usec += b.tv_usec;
|
|
||||||
if (a.tv_usec >= ONE_MILLION) {
|
|
||||||
a.tv_sec++;
|
|
||||||
a.tv_usec -= ONE_MILLION;
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct timeval switch_tvsub(struct timeval a, struct timeval b)
|
|
||||||
{
|
|
||||||
/* consistency checks to guarantee usec in 0..999999 */
|
|
||||||
a = tvfix(a);
|
|
||||||
b = tvfix(b);
|
|
||||||
a.tv_sec -= b.tv_sec;
|
|
||||||
a.tv_usec -= b.tv_usec;
|
|
||||||
if (a.tv_usec < 0) {
|
|
||||||
a.tv_sec-- ;
|
|
||||||
a.tv_usec += ONE_MILLION;
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
#undef ONE_MILLION
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
//this forces certain symbols to not be optimized out of the dll
|
//this forces certain symbols to not be optimized out of the dll
|
||||||
void include_me(void)
|
void include_me(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user