mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-30 15:14:17 +00:00
Gut Logger and put it back modular style
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1117 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
628e59a3ae
commit
559b8ab26c
47 files changed
+1313
-913
No files matched your search
@@ -65,7 +65,7 @@ static void audio_bridge_function(switch_core_session *session, char *data)
|
||||
|
||||
if (switch_core_session_outgoing_channel(session, chan_type, caller_profile, &peer_session, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Create Outgoing Channel!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Create Outgoing Channel!\n");
|
||||
switch_channel_hangup(caller_channel);
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -41,7 +41,7 @@ static const char modname[] = "mod_ivrtest";
|
||||
*/
|
||||
static switch_status on_dtmf(switch_core_session *session, char *dtmf, void *buf, unsigned int buflen)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Digits %s\n", dtmf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digits %s\n", dtmf);
|
||||
|
||||
switch_copy_string((char *)buf, dtmf, buflen);
|
||||
return SWITCH_STATUS_BREAK;
|
||||
@@ -64,7 +64,7 @@ static void dirtest_function(switch_core_session *session, char *data)
|
||||
"cn=Manager,dc=freeswitch,dc=org",
|
||||
"test",
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't connect\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't connect\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ static void dirtest_function(switch_core_session *session, char *data)
|
||||
switch_core_directory_query(&dh, "ou=dialplan,dc=freeswitch,dc=org", "(objectClass=*)");
|
||||
while (switch_core_directory_next(&dh) == SWITCH_STATUS_SUCCESS) {
|
||||
while (switch_core_directory_next_pair(&dh, &var, &val) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "VALUE [%s]=[%s]\n", var, val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VALUE [%s]=[%s]\n", var, val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ static void dirtest_function(switch_core_session *session, char *data)
|
||||
|
||||
static switch_status show_dtmf(switch_core_session *session, char *dtmf, void *buf, unsigned int buflen)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Digits %s\n", dtmf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digits %s\n", dtmf);
|
||||
|
||||
switch_copy_string((char *)buf, dtmf, buflen);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -122,7 +122,7 @@ static void tts_function(switch_core_session *session, char *data)
|
||||
codec = switch_core_session_get_read_codec(session);
|
||||
|
||||
switch_ivr_speak_text(session, tts_name, voice_name, NULL, codec->implementation->samples_per_second, show_dtmf, text, buf, sizeof(buf));
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Done\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Done\n");
|
||||
}
|
||||
|
||||
static void ivrtest_function(switch_core_session *session, char *data)
|
||||
@@ -143,7 +143,7 @@ static void ivrtest_function(switch_core_session *session, char *data)
|
||||
|
||||
while (switch_channel_get_state(channel) == CS_EXECUTE) {
|
||||
memset(buf, 0, sizeof(buf));
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Enter up to 10 digits, press # to terminate, * to hangup\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Enter up to 10 digits, press # to terminate, * to hangup\n");
|
||||
|
||||
if (data) {
|
||||
/* you could have passed NULL instead of on_dtmf to get this exact behaviour (copy the digits to buf and stop playing)
|
||||
@@ -166,7 +166,7 @@ static void ivrtest_function(switch_core_session *session, char *data)
|
||||
break;
|
||||
}
|
||||
snprintf(say, sizeof(say), "You Dialed [%s]\n", buf);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, say);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, say);
|
||||
switch_ivr_speak_text(session, "cepstral", "david", NULL, codec->implementation->samples_per_second, NULL, say, NULL, 0);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ static switch_status my_on_hangup(switch_core_session *session)
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "I globally hooked to [%s] on the hangup event\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "I globally hooked to [%s] on the hangup event\n", switch_channel_get_name(channel));
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ static const char modname[] = "mod_playback";
|
||||
*/
|
||||
static switch_status on_dtmf(switch_core_session *session, char *dtmf, void *buf, unsigned int buflen)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Digits %s\n", dtmf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digits %s\n", dtmf);
|
||||
|
||||
if (*dtmf == '*') {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
||||
@@ -51,7 +51,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*interface = &skel_module_interface;
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hello World!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hello World!\n");
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
@@ -92,7 +92,7 @@ static switch_status cepstral_speech_open(switch_speech_handle *sh, char *voice_
|
||||
}
|
||||
|
||||
if (switch_buffer_create(sh->memory_pool, &cepstral->audio_buffer, SWITCH_RECCOMMENDED_BUFFER_SIZE) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Buffer Failed!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Buffer Failed!\n");
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
|
||||
@@ -108,26 +108,26 @@ static switch_status cepstral_speech_open(switch_speech_handle *sh, char *voice_
|
||||
|
||||
/* Open a Swift Port through which to make TTS calls */
|
||||
if (SWIFT_FAILED(cepstral->port = swift_port_open(engine, cepstral->params))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Failed to open Swift Port.");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to open Swift Port.");
|
||||
goto all_done;
|
||||
}
|
||||
|
||||
|
||||
if (voice_name && SWIFT_FAILED(swift_port_set_voice_by_name(cepstral->port, voice_name))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid voice %s!\n", voice_name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid voice %s!\n", voice_name);
|
||||
voice_name = NULL;
|
||||
}
|
||||
|
||||
if (!voice_name) {
|
||||
/* Find the first voice on the system */
|
||||
if ((cepstral->voice = swift_port_find_first_voice(cepstral->port, NULL, NULL)) == NULL) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Failed to find any voices!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to find any voices!\n");
|
||||
goto all_done;
|
||||
}
|
||||
|
||||
/* Set the voice found by find_first_voice() as the port's current voice */
|
||||
if ( SWIFT_FAILED(swift_port_set_voice(cepstral->port, cepstral->voice)) ) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Failed to set voice.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to set voice.\n");
|
||||
goto all_done;
|
||||
}
|
||||
}
|
||||
@@ -274,7 +274,7 @@ switch_status switch_module_load(const switch_loadable_module_interface **interf
|
||||
|
||||
/* Open the Swift TTS Engine */
|
||||
if ( SWIFT_FAILED(engine = swift_engine_open(NULL)) ) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Failed to open Swift Engine.");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to open Swift Engine.");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ static switch_status switch_g729_encode(switch_codec *codec,
|
||||
if (new_len <= *encoded_data_len) {
|
||||
*encoded_data_len = new_len;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -198,13 +198,13 @@ static switch_status switch_g729_decode(switch_codec *codec,
|
||||
|
||||
} else {
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "buffer overflow!!!\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "yo this frame is an odd size [%d]\n", encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "yo this frame is an odd size [%d]\n", encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ static switch_status switch_gsm_encode(switch_codec *codec, switch_codec *other_
|
||||
if (new_len <= *encoded_data_len) {
|
||||
*encoded_data_len = new_len;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -121,11 +121,11 @@ static switch_status switch_gsm_decode(switch_codec *codec, switch_codec *other_
|
||||
if (new_len <= *decoded_data_len) {
|
||||
*decoded_data_len = new_len;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!! %u %u\n", new_len, *decoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "buffer overflow!!! %u %u\n", new_len, *decoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "yo this frame is an odd size [%u]\n", encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "yo this frame is an odd size [%u]\n", encoded_data_len);
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ static switch_status switch_ilbc_encode(switch_codec *codec,
|
||||
if (new_len <= *encoded_data_len) {
|
||||
*encoded_data_len = new_len;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -144,11 +144,11 @@ static switch_status switch_ilbc_decode(switch_codec *codec,
|
||||
if (new_len <= *decoded_data_len) {
|
||||
*decoded_data_len = new_len;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "buffer overflow!!!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "buffer overflow!!!\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "yo this frame is an odd size [%d]\n", encoded_data_len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "yo this frame is an odd size [%d]\n", encoded_data_len);
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -52,11 +52,11 @@ static switch_caller_extension *demo_dialplan_hunt(switch_core_session *session)
|
||||
caller_profile = switch_channel_get_caller_profile(channel);
|
||||
//switch_channel_set_variable(channel, "pleasework", "yay");
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hello %s You Dialed %s!\n", caller_profile->caller_id_name,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hello %s You Dialed %s!\n", caller_profile->caller_id_name,
|
||||
caller_profile->destination_number);
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
switch_channel_hangup(channel);
|
||||
return NULL;
|
||||
}
|
||||
@@ -73,14 +73,14 @@ static switch_caller_extension *demo_dialplan_hunt(switch_core_session *session)
|
||||
*data = '\0';
|
||||
data++;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "invalid extension on line %d\n", cfg.lineno);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "invalid extension on line %d\n", cfg.lineno);
|
||||
continue;
|
||||
}
|
||||
if (!extension) {
|
||||
if ((extension =
|
||||
switch_caller_extension_new(session, caller_profile->destination_number,
|
||||
caller_profile->destination_number)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "memory error!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "memory error!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ static void load_config(void)
|
||||
char *var, *val;
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ static switch_caller_extension *directory_dialplan_hunt(switch_core_session *ses
|
||||
|
||||
caller_profile = switch_channel_get_caller_profile(channel);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hello %s You Dialed %s!\n", caller_profile->caller_id_name,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hello %s You Dialed %s!\n", caller_profile->caller_id_name,
|
||||
caller_profile->destination_number);
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ static switch_caller_extension *directory_dialplan_hunt(switch_core_session *ses
|
||||
globals.dn,
|
||||
globals.pass,
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't connect\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't connect\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -121,12 +121,12 @@ static switch_caller_extension *directory_dialplan_hunt(switch_core_session *ses
|
||||
switch_core_directory_query(&dh, globals.base, filter);
|
||||
while (switch_core_directory_next(&dh) == SWITCH_STATUS_SUCCESS) {
|
||||
while (switch_core_directory_next_pair(&dh, &var, &val) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "DIRECTORY VALUE [%s]=[%s]\n", var, val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DIRECTORY VALUE [%s]=[%s]\n", var, val);
|
||||
if(!strcasecmp(var, "callflow")) {
|
||||
if (!extension) {
|
||||
if ((extension = switch_caller_extension_new(session, caller_profile->destination_number,
|
||||
caller_profile->destination_number)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "memory error!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "memory error!\n");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,11 +61,11 @@ static switch_caller_extension *dialplan_hunt(switch_core_session *session)
|
||||
channel = switch_core_session_get_channel(session);
|
||||
caller_profile = switch_channel_get_caller_profile(channel);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Processing %s->%s!\n", caller_profile->caller_id_name,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Processing %s->%s!\n", caller_profile->caller_id_name,
|
||||
caller_profile->destination_number);
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
switch_channel_hangup(channel);
|
||||
return NULL;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ static switch_caller_extension *dialplan_hunt(switch_core_session *session)
|
||||
&erroffset, /* for error offset */
|
||||
NULL); /* use default character tables */
|
||||
if (error) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "COMPILE ERROR: %d [%s]\n", erroffset, error);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "COMPILE ERROR: %d [%s]\n", erroffset, error);
|
||||
cleanre();
|
||||
switch_channel_hangup(channel);
|
||||
return NULL;
|
||||
@@ -116,7 +116,7 @@ static switch_caller_extension *dialplan_hunt(switch_core_session *session)
|
||||
sizeof(ovector) / sizeof(ovector[0])); /* number of elements (NOT size in bytes) */
|
||||
} else if (match_count > 0 && !strcasecmp(var, "match")) {
|
||||
if (!re) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "ERROR: match without regex in %s line %d\n", cfg.path,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ERROR: match without regex in %s line %d\n", cfg.path,
|
||||
cfg.lineno);
|
||||
continue;
|
||||
} else {
|
||||
@@ -164,7 +164,7 @@ static switch_caller_extension *dialplan_hunt(switch_core_session *session)
|
||||
if (!extension) {
|
||||
if ((extension =
|
||||
switch_caller_extension_new(session, exten_name, caller_profile->destination_number)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "memory error!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "memory error!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,12 +159,12 @@ static void get_codecs(struct private_object *tech_pvt)
|
||||
SWITCH_MAX_CODECS,
|
||||
globals.codec_order,
|
||||
globals.codec_order_last)) <= 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "NO codecs?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NO codecs?\n");
|
||||
return;
|
||||
}
|
||||
} else if (((tech_pvt->num_codecs =
|
||||
switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "NO codecs?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NO codecs?\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread *thread, void *o
|
||||
ldl_handle_run(handle);
|
||||
globals.handles--;
|
||||
ldl_handle_destroy(&handle);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Handle %s [%s] Destroyed\n", profile->name, profile->login);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s [%s] Destroyed\n", profile->name, profile->login);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void
|
||||
char *stun_ip = advip + 5;
|
||||
|
||||
if (!stun_ip) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Failed! NO STUN SERVER!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! NO STUN SERVER!\n");
|
||||
switch_channel_hangup(channel);
|
||||
break;
|
||||
}
|
||||
@@ -284,11 +284,11 @@ static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void
|
||||
SWITCH_STUN_DEFAULT_PORT,
|
||||
&err,
|
||||
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_channel_hangup(channel);
|
||||
break;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
|
||||
cand[0].type = "stun";
|
||||
} else {
|
||||
cand[0].type = "local";
|
||||
@@ -324,14 +324,14 @@ static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
switch_channel_hangup(channel);
|
||||
return NULL;
|
||||
}
|
||||
tech_pvt->read_frame.rate = tech_pvt->read_codec.implementation->samples_per_second;
|
||||
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Set Read Codec to %s\n", tech_pvt->codec_name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Read Codec to %s\n", tech_pvt->codec_name);
|
||||
|
||||
if (switch_core_codec_init(&tech_pvt->write_codec,
|
||||
tech_pvt->codec_name,
|
||||
@@ -340,11 +340,11 @@ static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
switch_channel_hangup(channel);
|
||||
return NULL;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Set Write Codec to %s\n", tech_pvt->codec_name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Write Codec to %s\n", tech_pvt->codec_name);
|
||||
|
||||
switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
|
||||
switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
|
||||
@@ -410,7 +410,7 @@ static switch_status channel_on_ring(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -427,7 +427,7 @@ static switch_status channel_on_execute(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -455,7 +455,7 @@ static switch_status channel_on_hangup(switch_core_session *session)
|
||||
|
||||
if (tech_pvt->rtp_session) {
|
||||
switch_rtp_destroy(&tech_pvt->rtp_session);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "NUKE RTP\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NUKE RTP\n");
|
||||
tech_pvt->rtp_session = NULL;
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ static switch_status channel_on_hangup(switch_core_session *session)
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -489,7 +489,7 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
|
||||
if (tech_pvt->rtp_session) {
|
||||
switch_rtp_kill_socket(tech_pvt->rtp_session);
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,13 +498,13 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
|
||||
|
||||
static switch_status channel_on_loopback(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "CHANNEL LOOPBACK\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status channel_on_transmit(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "CHANNEL TRANSMIT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -827,7 +827,7 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
if ((callto = strchr(profile_name, '/'))) {
|
||||
*callto++ = '\0';
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid URL!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid URL!\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -835,17 +835,17 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
|
||||
if ((mdl_profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
|
||||
if (!ldl_handle_ready(mdl_profile->handle)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Doh! we are not logged in yet!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! we are not logged in yet!\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
if (!(full_id = ldl_handle_probe(mdl_profile->handle, callto, idbuf, sizeof(idbuf)))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Unknown Recipient!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown Recipient!\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Unknown Profile!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown Profile!\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -859,7 +859,7 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
tech_pvt->codec_index = -1;
|
||||
tech_pvt->local_port = switch_rtp_request_port();
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -874,7 +874,7 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
switch_channel_set_caller_profile(channel, caller_profile);
|
||||
tech_pvt->caller_profile = caller_profile;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Doh! no caller profile\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! no caller profile\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -903,7 +903,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
{
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -945,12 +945,12 @@ static void init_profile(struct mdl_profile *profile)
|
||||
handle_response,
|
||||
profile) == LDL_STATUS_SUCCESS) {
|
||||
profile->handle = handle;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Started Thread for %s@%s\n", profile->login, profile->dialplan);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Started Thread for %s@%s\n", profile->login, profile->dialplan);
|
||||
switch_core_hash_insert(globals.profile_hash, profile->name, profile);
|
||||
handle_thread_launch(handle);
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid Profile\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid Profile\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -986,7 +986,7 @@ static switch_status load_config(void)
|
||||
|
||||
switch_core_hash_init(&globals.profile_hash, module_pool);
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -1070,7 +1070,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
assert(handle != NULL);
|
||||
|
||||
if (!(profile = ldl_handle_get_private(handle))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "ERROR NO PROFILE!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ERROR NO PROFILE!\n");
|
||||
return LDL_STATUS_FALSE;
|
||||
}
|
||||
|
||||
@@ -1081,16 +1081,16 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "using Existing session for %s\n", ldl_session_get_id(dlsession));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using Existing session for %s\n", ldl_session_get_id(dlsession));
|
||||
|
||||
if (switch_channel_get_state(channel) >= CS_HANGUP) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Call %s is already over\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call %s is already over\n", switch_channel_get_name(channel));
|
||||
return LDL_STATUS_FALSE;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (signal != LDL_SIGNAL_INITIATE) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Session is already dead\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session is already dead\n");
|
||||
return LDL_STATUS_FALSE;
|
||||
}
|
||||
if ((session = switch_core_session_request(&channel_endpoint_interface, NULL)) != 0) {
|
||||
@@ -1104,12 +1104,12 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
tech_pvt->profile = profile;
|
||||
tech_pvt->local_port = switch_rtp_request_port();
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(&session);
|
||||
return LDL_STATUS_FALSE;
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Creating a session for %s\n", ldl_session_get_id(dlsession));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Creating a session for %s\n", ldl_session_get_id(dlsession));
|
||||
|
||||
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
|
||||
profile->dialplan,
|
||||
@@ -1137,11 +1137,11 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
|
||||
switch(signal) {
|
||||
case LDL_SIGNAL_NONE:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "ERROR\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ERROR\n");
|
||||
break;
|
||||
case LDL_SIGNAL_MSG:
|
||||
if (msg) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "MSG [%s]\n", msg);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "MSG [%s]\n", msg);
|
||||
if (*msg == '+') {
|
||||
switch_channel_queue_dtmf(channel, msg + 1);
|
||||
}
|
||||
@@ -1154,7 +1154,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
unsigned int len = 0;
|
||||
|
||||
if (tech_pvt->codec_index > -1) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Already decided on a codec\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Already decided on a codec\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1167,13 +1167,13 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
|
||||
if (ldl_session_get_payloads(dlsession, &payloads, &len) == LDL_STATUS_SUCCESS) {
|
||||
unsigned int x, y;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%u payloads\n", len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%u payloads\n", len);
|
||||
for(x = 0; x < len; x++) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Available Payload %s %u\n", payloads[x].name, payloads[x].id);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name, payloads[x].id);
|
||||
for(y = 0; y < tech_pvt->num_codecs; y++) {
|
||||
if (payloads[x].id == tech_pvt->codecs[y]->ianacode) {
|
||||
tech_pvt->codec_index = y;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Choosing Payload index %u %s %u\n", y, payloads[x].name, payloads[x].id);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n", y, payloads[x].name, payloads[x].id);
|
||||
tech_pvt->codec_name = tech_pvt->codecs[y]->iananame;
|
||||
tech_pvt->codec_num = tech_pvt->codecs[y]->ianacode;
|
||||
switch_set_flag(tech_pvt, TFLAG_CODEC_READY);
|
||||
@@ -1196,13 +1196,13 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
|
||||
|
||||
if (tech_pvt->remote_ip) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Already picked an IP [%s]\n", tech_pvt->remote_ip);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Already picked an IP [%s]\n", tech_pvt->remote_ip);
|
||||
break;
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%u candidates\n", len);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%u candidates\n", len);
|
||||
for(x = 0; x < len; x++) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "candidates %s:%d\n", candidates[x].address, candidates[x].port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidates %s:%d\n", candidates[x].address, candidates[x].port);
|
||||
if (!strcasecmp(candidates[x].protocol, "udp") &&
|
||||
((profile->lanaddr && !strncasecmp(candidates[x].address, profile->lanaddr, strlen(profile->lanaddr))) ||
|
||||
(strncasecmp(candidates[x].address, "10.", 3) && strncasecmp(candidates[x].address, "192.168.", 8)))) {
|
||||
@@ -1211,7 +1211,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
|
||||
memset(payloads, 0, sizeof(payloads));
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Acceptable Candidate %s:%d\n", candidates[x].address, candidates[x].port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Acceptable Candidate %s:%d\n", candidates[x].address, candidates[x].port);
|
||||
|
||||
|
||||
if (!tech_pvt->num_codecs) {
|
||||
@@ -1228,7 +1228,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
|
||||
|
||||
if (tech_pvt->codec_index < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Don't have my codec yet here's one\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't have my codec yet here's one\n");
|
||||
tech_pvt->codec_name = tech_pvt->codecs[0]->iananame;
|
||||
tech_pvt->codec_num = tech_pvt->codecs[0]->ianacode;
|
||||
tech_pvt->codec_index = 0;
|
||||
@@ -1253,7 +1253,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
char *stun_ip = advip + 5;
|
||||
|
||||
if (!stun_ip) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Failed! NO STUN SERVER!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! NO STUN SERVER!\n");
|
||||
switch_channel_hangup(channel);
|
||||
break;
|
||||
}
|
||||
@@ -1265,11 +1265,11 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
SWITCH_STUN_DEFAULT_PORT,
|
||||
&err,
|
||||
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_channel_hangup(channel);
|
||||
return LDL_STATUS_FALSE;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success %s:%d\n", cand[0].address, cand[0].port);
|
||||
cand[0].type = "stun";
|
||||
} else {
|
||||
cand[0].type = "local";
|
||||
@@ -1287,7 +1287,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
|
||||
if (!tech_pvt->rtp_session) {
|
||||
const char *err;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "SETUP RTP %s:%d -> %s:%d\n", profile->ip, tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", profile->ip, tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
|
||||
|
||||
if (!(tech_pvt->rtp_session = switch_rtp_new(profile->ip,
|
||||
tech_pvt->local_port,
|
||||
@@ -1299,7 +1299,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
0,
|
||||
NULL,
|
||||
&err, switch_core_session_get_pool(tech_pvt->session)))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "RTP ERROR %s\n", err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
|
||||
switch_channel_hangup(channel);
|
||||
return LDL_STATUS_FALSE;
|
||||
}
|
||||
@@ -1317,16 +1317,16 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
||||
case LDL_SIGNAL_TERMINATE:
|
||||
if (channel) {
|
||||
switch_channel_state state = switch_channel_get_state(channel);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "hungup %s %u %d\n", switch_channel_get_name(channel), state, CS_INIT);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hungup %s %u %d\n", switch_channel_get_name(channel), state, CS_INIT);
|
||||
switch_set_flag(tech_pvt, TFLAG_BYE);
|
||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||
switch_channel_hangup(channel);
|
||||
|
||||
if (state <= CS_INIT && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Destroy unused Session\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy unused Session\n");
|
||||
switch_core_session_destroy(&session);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "End Call\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "End Call\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ static switch_status exosip_on_init(switch_core_session *session)
|
||||
|
||||
tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN;
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "EXOSIP INIT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXOSIP INIT\n");
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
|
||||
char *dest_uri;
|
||||
@@ -263,7 +263,7 @@ static switch_status exosip_on_init(switch_core_session *session)
|
||||
char *stun_ip = globals.extip + 5;
|
||||
|
||||
if (!stun_ip) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Failed! NO STUN SERVER\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! NO STUN SERVER\n");
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -273,11 +273,11 @@ static switch_status exosip_on_init(switch_core_session *session)
|
||||
SWITCH_STUN_DEFAULT_PORT,
|
||||
&err,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Success [%s]:[%d]\n", ip, sdp_port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success [%s]:[%d]\n", ip, sdp_port);
|
||||
} else {
|
||||
ip = globals.extip;
|
||||
}
|
||||
@@ -341,7 +341,7 @@ static switch_status exosip_on_init(switch_core_session *session)
|
||||
eXosip_lock();
|
||||
if ((dest_uri =
|
||||
(char *) switch_core_session_alloc(session, strlen(tech_pvt->caller_profile->destination_number) + 10)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "AIEEEE!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AIEEEE!\n");
|
||||
assert(dest_uri != NULL);
|
||||
}
|
||||
sprintf(dest_uri, "sip:%s", tech_pvt->caller_profile->destination_number);
|
||||
@@ -351,7 +351,7 @@ static switch_status exosip_on_init(switch_core_session *session)
|
||||
sdp_message_to_str(tech_pvt->local_sdp, &buf);
|
||||
osip_message_set_body(invite, buf, strlen(buf));
|
||||
osip_message_set_content_type(invite, "application/sdp");
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OUTBOUND SDP:\n%s\n", buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OUTBOUND SDP:\n%s\n", buf);
|
||||
free(buf);
|
||||
/* Send the INVITE */
|
||||
|
||||
@@ -384,7 +384,7 @@ static switch_status exosip_on_ring(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "EXOSIP RING\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXOSIP RING\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -416,20 +416,20 @@ static switch_status exosip_on_hangup(switch_core_session *session)
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "EXOSIP HANGUP %s %d/%d=%d\n", switch_channel_get_name(channel),
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXOSIP HANGUP %s %d/%d=%d\n", switch_channel_get_name(channel),
|
||||
tech_pvt->cid, tech_pvt->did, i);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status exosip_on_loopback(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "EXOSIP LOOPBACK\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXOSIP LOOPBACK\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status exosip_on_transmit(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "EXOSIP TRANSMIT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXOSIP TRANSMIT\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ static switch_status activate_rtp(struct private_object *tech_pvt)
|
||||
bw *= 8;
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Activating RTP %s:%d->%s:%d codec: %u ms: %d\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activating RTP %s:%d->%s:%d codec: %u ms: %d\n",
|
||||
tech_pvt->local_sdp_audio_ip,
|
||||
tech_pvt->local_sdp_audio_port,
|
||||
tech_pvt->remote_sdp_audio_ip,
|
||||
@@ -486,13 +486,13 @@ static switch_status activate_rtp(struct private_object *tech_pvt)
|
||||
|
||||
if (tech_pvt->realm) {
|
||||
if (!(key = (char *) switch_core_hash_find(globals.srtp_hash, tech_pvt->realm))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "undefined Realm %s\n", tech_pvt->realm);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "undefined Realm %s\n", tech_pvt->realm);
|
||||
switch_channel_hangup(channel);
|
||||
switch_set_flag(tech_pvt, TFLAG_BYE);
|
||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "using Realm %s\n", tech_pvt->realm);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "using Realm %s\n", tech_pvt->realm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -512,7 +512,7 @@ static switch_status activate_rtp(struct private_object *tech_pvt)
|
||||
switch_set_flag(tech_pvt, TFLAG_RTP);
|
||||
} else {
|
||||
switch_channel *channel = switch_core_session_get_channel(tech_pvt->session);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "RTP REPORTS ERROR: [%s]\n", err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP REPORTS ERROR: [%s]\n", err);
|
||||
switch_channel_hangup(channel);
|
||||
switch_set_flag(tech_pvt, TFLAG_BYE);
|
||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||
@@ -884,7 +884,7 @@ static switch_status exosip_receive_message(switch_core_session *session, switch
|
||||
char *buf = NULL;
|
||||
osip_message_t *progress = NULL;
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Asked to send early media by %s\n", msg->from);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Asked to send early media by %s\n", msg->from);
|
||||
|
||||
/* Transmit 183 Progress with SDP */
|
||||
eXosip_lock();
|
||||
@@ -963,7 +963,7 @@ static switch_status exosip_outgoing_channel(switch_core_session *session, switc
|
||||
switch_core_session_set_private(*new_session, tech_pvt);
|
||||
tech_pvt->session = *new_session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -997,7 +997,7 @@ static switch_status exosip_outgoing_channel(switch_core_session *session, switc
|
||||
switch_channel_set_caller_profile(channel, caller_profile);
|
||||
tech_pvt->caller_profile = caller_profile;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Doh! no caller profile\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! no caller profile\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -1029,7 +1029,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -1095,7 +1095,7 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||
switch_core_session_set_private(session, tech_pvt);
|
||||
tech_pvt->session = session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(&session);
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
@@ -1154,7 +1154,7 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||
|
||||
|
||||
if ((remote_sdp = eXosip_get_sdp_info(event->request)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Find Remote SDP!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Find Remote SDP!\n");
|
||||
exosip_on_hangup(session);
|
||||
switch_core_session_destroy(&session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
@@ -1175,7 +1175,7 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||
if (!strncasecmp(globals.extip, "stun:", 5)) {
|
||||
char *stun_ip = globals.extip + 5;
|
||||
if (!stun_ip) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Failed! NO STUN SERVER\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! NO STUN SERVER\n");
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -1185,11 +1185,11 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||
SWITCH_STUN_DEFAULT_PORT,
|
||||
&err,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Stun Success [%s]:[%d]\n", ip, sdp_port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success [%s]:[%d]\n", ip, sdp_port);
|
||||
} else {
|
||||
ip = globals.extip;
|
||||
}
|
||||
@@ -1230,13 +1230,13 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||
sdp_message_parse(tech_pvt->local_sdp, local_sdp_str);
|
||||
|
||||
sdp_message_to_str(remote_sdp, &remote_sdp_str);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "LOCAL SDP:\n%s\nREMOTE SDP:\n%s", local_sdp_str, remote_sdp_str);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "LOCAL SDP:\n%s\nREMOTE SDP:\n%s", local_sdp_str, remote_sdp_str);
|
||||
|
||||
mline = 0;
|
||||
while (0 == osip_rfc3264_match(tech_pvt->sdp_config, remote_sdp, audio_tab, video_tab, t38_tab, app_tab, mline)) {
|
||||
if (audio_tab[0] == NULL && video_tab[0] == NULL && t38_tab[0] == NULL && app_tab[0] == NULL) {
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Got no compatible codecs!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got no compatible codecs!\n");
|
||||
break;
|
||||
}
|
||||
for (pos = 0; audio_tab[pos] != NULL; pos++) {
|
||||
@@ -1287,7 +1287,7 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
@@ -1298,7 +1298,7 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
@@ -1306,7 +1306,7 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||
tech_pvt->read_frame.rate = rate;
|
||||
switch_set_flag(tech_pvt, TFLAG_USING_CODEC);
|
||||
ms = tech_pvt->write_codec.implementation->microseconds_per_frame / 1000;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Activate Inbound Codec %s/%d %d ms\n", dname, rate, ms);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate Inbound Codec %s/%d %d ms\n", dname, rate, ms);
|
||||
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
|
||||
switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
|
||||
switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
|
||||
@@ -1328,7 +1328,7 @@ static switch_status exosip_create_call(eXosip_event_t * event)
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Create new Inbound Channel!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Create new Inbound Channel!\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
@@ -1343,7 +1343,7 @@ static void destroy_call_by_event(eXosip_event_t * event)
|
||||
switch_channel *channel = NULL;
|
||||
|
||||
if ((tech_pvt = get_pvt_by_call_id(event->cid)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Um in case you are interested, Can't find the pvt [%d]!\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Um in case you are interested, Can't find the pvt [%d]!\n",
|
||||
event->cid);
|
||||
return;
|
||||
}
|
||||
@@ -1351,7 +1351,7 @@ static void destroy_call_by_event(eXosip_event_t * event)
|
||||
channel = switch_core_session_get_channel(tech_pvt->session);
|
||||
assert(channel != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "destroy %s\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "destroy %s\n", switch_channel_get_name(channel));
|
||||
exosip_kill_channel(tech_pvt->session, SWITCH_SIG_KILL);
|
||||
switch_channel_hangup(channel);
|
||||
|
||||
@@ -1386,7 +1386,7 @@ static switch_status parse_sdp_media(sdp_media_t * media, char **dname, char **d
|
||||
*dname = strdup("L16");
|
||||
*drate = strdup("8000");
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Found negotiated codec Payload: %s Name: %s Rate: %s\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found negotiated codec Payload: %s Name: %s Rate: %s\n",
|
||||
*dpayload, *dname, *drate);
|
||||
break;
|
||||
}
|
||||
@@ -1409,7 +1409,7 @@ static void handle_answer(eXosip_event_t * event)
|
||||
|
||||
|
||||
if ((tech_pvt = get_pvt_by_call_id(event->cid)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Um in case you are interested, Can't find the pvt!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Um in case you are interested, Can't find the pvt!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1417,14 +1417,14 @@ static void handle_answer(eXosip_event_t * event)
|
||||
assert(channel != NULL);
|
||||
|
||||
if (!event->response) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Someone answered... with no SDP information - WTF?!?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Someone answered... with no SDP information - WTF?!?\n");
|
||||
switch_channel_hangup(channel);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get all of the remote SDP elements... stuff */
|
||||
if ((remote_sdp = eXosip_get_sdp_info(event->response)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cant Find SDP?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cant Find SDP?\n");
|
||||
switch_channel_hangup(channel);
|
||||
return;
|
||||
}
|
||||
@@ -1458,7 +1458,7 @@ static void handle_answer(eXosip_event_t * event)
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
switch_channel_hangup(channel);
|
||||
return;
|
||||
} else {
|
||||
@@ -1470,7 +1470,7 @@ static void handle_answer(eXosip_event_t * event)
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL,
|
||||
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
switch_channel_hangup(channel);
|
||||
return;
|
||||
} else {
|
||||
@@ -1478,7 +1478,7 @@ static void handle_answer(eXosip_event_t * event)
|
||||
tech_pvt->read_frame.rate = rate;
|
||||
switch_set_flag(tech_pvt, TFLAG_USING_CODEC);
|
||||
ms = tech_pvt->write_codec.implementation->microseconds_per_frame / 1000;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Activate Outbound Codec %s/%d %d ms\n", dname, rate, ms);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate Outbound Codec %s/%d %d ms\n", dname, rate, ms);
|
||||
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
|
||||
switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
|
||||
switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
|
||||
@@ -1625,7 +1625,7 @@ static void log_event(eXosip_event_t * je)
|
||||
snprintf(buf, 99, "<- (c=%i|d=%i|s=%i|n=%i|t=%i) %s",
|
||||
je->cid, je->did, je->sid, je->nid, je->tid, je->textinfo);
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\n%s\n", buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\n%s\n", buf);
|
||||
/* Print it out */
|
||||
}
|
||||
|
||||
@@ -1641,7 +1641,7 @@ static int config_exosip(int reload)
|
||||
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -1662,7 +1662,7 @@ static int config_exosip(int reload)
|
||||
} else if (!strncasecmp(var, "srtp:", 5)) {
|
||||
char *name = var + 5;
|
||||
if (name) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Add Realm [%s][%s]\n", name, val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Add Realm [%s][%s]\n", name, val);
|
||||
switch_core_hash_insert(globals.srtp_hash, switch_core_strdup(module_pool, name), switch_core_strdup(module_pool, val));
|
||||
}
|
||||
} else if (!strcmp(var, "codec_prefs")) {
|
||||
@@ -1675,14 +1675,14 @@ static int config_exosip(int reload)
|
||||
if (dur > 10 && dur < 8000) {
|
||||
globals.dtmf_duration = dur;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Duration out of bounds!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!globals.ip) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Setting ip to 'guess'\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting ip to 'guess'\n");
|
||||
set_global_ip("guess");
|
||||
}
|
||||
|
||||
@@ -1724,12 +1724,12 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
}
|
||||
|
||||
if (eXosip_init()) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "eXosip_init initialization failed!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "eXosip_init initialization failed!\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (eXosip_listen_addr(IPPROTO_UDP, NULL, globals.port, AF_INET, 0)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "eXosip_listen_addr failed!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "eXosip_listen_addr failed!\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -1755,14 +1755,14 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
switch (event->type) {
|
||||
case EXOSIP_CALL_INVITE:
|
||||
if (exosip_create_call(event) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "invite failure\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "invite failure\n");
|
||||
destroy_call_by_event(event);
|
||||
}
|
||||
break;
|
||||
case EXOSIP_CALL_REINVITE:
|
||||
/* See what the reinvite is about - on hold or whatever */
|
||||
//handle_reinvite(event);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Got a reinvite.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got a reinvite.\n");
|
||||
break;
|
||||
case EXOSIP_CALL_MESSAGE_NEW:
|
||||
if (event->request != NULL && MSG_IS_REFER(event->request)) {
|
||||
@@ -1773,7 +1773,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
/* If audio is not flowing and this has SDP - fire it up! */
|
||||
break;
|
||||
case EXOSIP_CALL_ANSWERED:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "The call was answered.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "The call was answered.\n");
|
||||
handle_answer(event);
|
||||
break;
|
||||
case EXOSIP_CALL_PROCEEDING:
|
||||
@@ -1783,7 +1783,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
//handle_ringing(event);
|
||||
break;
|
||||
case EXOSIP_CALL_REDIRECTED:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Call was redirect\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call was redirect\n");
|
||||
break;
|
||||
case EXOSIP_CALL_CLOSED:
|
||||
destroy_call_by_event(event);
|
||||
@@ -1792,38 +1792,38 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
destroy_call_by_event(event);
|
||||
break;
|
||||
case EXOSIP_CALL_NOANSWER:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "The call was not answered.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "The call was not answered.\n");
|
||||
destroy_call_by_event(event);
|
||||
break;
|
||||
case EXOSIP_CALL_REQUESTFAILURE:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Request failure\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Request failure\n");
|
||||
destroy_call_by_event(event);
|
||||
break;
|
||||
case EXOSIP_CALL_SERVERFAILURE:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Server failure\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Server failure\n");
|
||||
destroy_call_by_event(event);
|
||||
break;
|
||||
case EXOSIP_CALL_GLOBALFAILURE:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Global failure\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Global failure\n");
|
||||
destroy_call_by_event(event);
|
||||
break;
|
||||
/* Registration related stuff */
|
||||
case EXOSIP_REGISTRATION_NEW:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Received registration attempt\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received registration attempt\n");
|
||||
break;
|
||||
default:
|
||||
/* Unknown event... casually absorb it for now */
|
||||
break;
|
||||
}
|
||||
|
||||
//switch_console_printf(SWITCH_CHANNEL_CONSOLE, "There was an event (%d) [%s]\n", event->type, event->textinfo);
|
||||
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "There was an event (%d) [%s]\n", event->type, event->textinfo);
|
||||
/* Free the event */
|
||||
eXosip_event_free(event);
|
||||
}
|
||||
|
||||
eXosip_quit();
|
||||
globals.running = 0;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Monitor Thread Exiting\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Exiting\n");
|
||||
//switch_sleep(2000000);
|
||||
|
||||
return SWITCH_STATUS_TERM;
|
||||
|
||||
@@ -189,7 +189,7 @@ static unsigned short iax_build_codec_rates(void)
|
||||
samples |= IAX_RATE_48KHZ;
|
||||
break;
|
||||
default:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "I don't know rate %d\n", rate);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "I don't know rate %d\n", rate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -219,13 +219,13 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
|
||||
SWITCH_MAX_CODECS,
|
||||
globals.codec_order,
|
||||
globals.codec_order_last)) <= 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "NO codecs?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NO codecs?\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
} else
|
||||
if (((num_codecs =
|
||||
switch_loadable_module_get_codecs(switch_core_session_get_pool(tech_pvt->session), codecs, SWITCH_MAX_CODECS))) <= 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "NO codecs?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NO codecs?\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
|
||||
strncat(pref_str, x == len - 1 ? ")" : ",", sizeof(pref_str));
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Codec Prefs Detected: %s\n", pref_str);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec Prefs Detected: %s\n", pref_str);
|
||||
|
||||
for (x = 0; x < len; x++) {
|
||||
if ((prefs[x] & mixed_cap)) {
|
||||
@@ -308,7 +308,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
|
||||
}
|
||||
|
||||
if (!dname && !chosen) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "NO codecs?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NO codecs?\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
} else {
|
||||
if (switch_core_codec_init(&tech_pvt->write_codec,
|
||||
@@ -360,7 +360,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
} else {
|
||||
@@ -369,7 +369,7 @@ static switch_status iax_set_codec(struct private_object *tech_pvt, struct iax_s
|
||||
ms = tech_pvt->write_codec.implementation->microseconds_per_frame / 1000;
|
||||
rate = tech_pvt->write_codec.implementation->samples_per_second;
|
||||
tech_pvt->read_frame.rate = rate;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Activate Codec %s/%d %d ms\n", dname, rate, ms);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate Codec %s/%d %d ms\n", dname, rate, ms);
|
||||
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
|
||||
switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
|
||||
switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
|
||||
@@ -402,13 +402,13 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
|
||||
|
||||
static void iax_err_cb(const char *s)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "IAX ERR: %s", s);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "IAX ERR: %s", s);
|
||||
}
|
||||
|
||||
static void iax_out_cb(const char *s)
|
||||
{
|
||||
if (globals.debug) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "IAX INFO: %s", s);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "IAX INFO: %s", s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ static switch_status channel_on_ring(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -473,7 +473,7 @@ static switch_status channel_on_execute(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -510,7 +510,7 @@ static switch_status channel_on_hangup(switch_core_session *session)
|
||||
iax_session_destroy(&tech_pvt->iax_session);
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -531,7 +531,7 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
|
||||
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));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -539,13 +539,13 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
|
||||
|
||||
static switch_status channel_on_loopback(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "CHANNEL LOOPBACK\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status channel_on_transmit(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "CHANNEL TRANSMIT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
switch_core_session_set_private(*new_session, tech_pvt);
|
||||
tech_pvt->session = *new_session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -752,7 +752,7 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
switch_channel_set_caller_profile(channel, caller_profile);
|
||||
tech_pvt->caller_profile = caller_profile;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Doh! no caller profile\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! no caller profile\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -790,7 +790,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
{
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -820,7 +820,7 @@ static switch_status load_config(void)
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -874,7 +874,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
iax_enable_debug();
|
||||
}
|
||||
if (iax_init(globals.port) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error Binding Port!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error Binding Port!\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -882,7 +882,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
iax_set_output(iax_out_cb);
|
||||
//netfd = iax_get_fd();
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "IAX Ready Port %d\n", globals.port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IAX Ready Port %d\n", globals.port);
|
||||
|
||||
if (switch_event_create(&s_event, SWITCH_EVENT_PUBLISH) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "service", "_iax2._udp");
|
||||
@@ -904,17 +904,17 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
struct private_object *tech_pvt = iax_get_private(iaxevent->session);
|
||||
|
||||
if (globals.debug && iaxevent->etype != IAX_EVENT_VOICE) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Event %d [%s]!\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Event %d [%s]!\n",
|
||||
iaxevent->etype, IAXNAMES[iaxevent->etype]);
|
||||
}
|
||||
switch (iaxevent->etype) {
|
||||
case IAX_EVENT_REGACK:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Registration completed successfully.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Registration completed successfully.\n");
|
||||
//if (iaxevent->ies.refresh)
|
||||
//refresh = iaxevent->ies.refresh;
|
||||
break;
|
||||
case IAX_EVENT_REGREJ:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Registration failed.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Registration failed.\n");
|
||||
break;
|
||||
case IAX_EVENT_TIMEOUT:
|
||||
break;
|
||||
@@ -925,16 +925,16 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
|
||||
if (iax_set_codec(tech_pvt, iaxevent->session, &format, &cap, &iaxevent->ies.samprate, IAX_SET) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WTF? %u %u\n", iaxevent->ies.format,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WTF? %u %u\n", iaxevent->ies.format,
|
||||
iaxevent->ies.capability);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Call accepted.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call accepted.\n");
|
||||
break;
|
||||
case IAX_EVENT_RINGA:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Ringing heard.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ringing heard.\n");
|
||||
break;
|
||||
case IAX_EVENT_PONG:
|
||||
// informative only
|
||||
@@ -945,10 +945,10 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
switch_channel *channel;
|
||||
if ((channel = switch_core_session_get_channel(tech_pvt->session)) != 0) {
|
||||
if (switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WTF Mutiple Answer %s?\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WTF Mutiple Answer %s?\n",
|
||||
switch_channel_get_name(channel));
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Answer %s\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Answer %s\n",
|
||||
switch_channel_get_name(channel));
|
||||
switch_channel_answer(channel);
|
||||
}
|
||||
@@ -958,7 +958,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
break;
|
||||
case IAX_EVENT_CONNECT:
|
||||
// incoming call detected
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Incoming call connected %s, %s, %s %u/%u\n",
|
||||
iaxevent->ies.called_number,
|
||||
iaxevent->ies.calling_number,
|
||||
@@ -967,7 +967,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
if (iaxevent) {
|
||||
switch_core_session *session;
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "New Inbound Channel %s!\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New Inbound Channel %s!\n",
|
||||
iaxevent->ies.calling_name);
|
||||
if ((session = switch_core_session_request(&channel_endpoint_interface, NULL)) != 0) {
|
||||
struct private_object *tech_pvt;
|
||||
@@ -982,7 +982,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
switch_core_session_set_private(session, tech_pvt);
|
||||
tech_pvt->session = session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(&session);
|
||||
break;
|
||||
}
|
||||
@@ -1021,7 +1021,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
}
|
||||
break;
|
||||
case IAX_EVENT_REJECT:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Rejected call.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Rejected call.\n");
|
||||
case IAX_EVENT_BUSY:
|
||||
case IAX_EVENT_HANGUP:
|
||||
if (tech_pvt) {
|
||||
@@ -1030,20 +1030,20 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||
switch_clear_flag(tech_pvt, TFLAG_VOICE);
|
||||
if ((channel = switch_core_session_get_channel(tech_pvt->session)) != 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hangup %s\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hangup %s\n", switch_channel_get_name(channel));
|
||||
switch_set_flag(tech_pvt, TFLAG_HANGUP);
|
||||
switch_channel_hangup(channel);
|
||||
//switch_thread_cond_signal(tech_pvt->cond);
|
||||
iaxevent->session = NULL;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "No Session? %s\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No Session? %s\n",
|
||||
switch_test_flag(tech_pvt, TFLAG_VOICE) ? "yes" : "no");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IAX_EVENT_CNG:
|
||||
// pseudo-silence
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "sending silence\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sending silence\n");
|
||||
break;
|
||||
case IAX_EVENT_VOICE:
|
||||
if (tech_pvt && (tech_pvt->read_frame.datalen = iaxevent->datalen) != 0) {
|
||||
@@ -1061,7 +1061,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
}
|
||||
break;
|
||||
case IAX_EVENT_TRANSFER:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Call transfer occurred.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call transfer occurred.\n");
|
||||
//session[0] = iaxevent->session;
|
||||
break;
|
||||
case IAX_EVENT_DTMF:
|
||||
@@ -1070,7 +1070,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
if ((channel = switch_core_session_get_channel(tech_pvt->session)) != 0) {
|
||||
char str[2] = { (char)iaxevent->subclass };
|
||||
if (globals.debug) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s DTMF %s\n", str,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s DTMF %s\n", str,
|
||||
switch_channel_get_name(channel));
|
||||
}
|
||||
switch_channel_queue_dtmf(channel, str);
|
||||
@@ -1079,7 +1079,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
|
||||
break;
|
||||
default:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Don't know what to do with IAX event %d.\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Don't know what to do with IAX event %d.\n",
|
||||
iaxevent->etype);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ static switch_status channel_on_ring(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ static switch_status channel_on_execute(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -141,7 +141,7 @@ static switch_status channel_on_hangup(switch_core_session *session)
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_channel_hangup(channel);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -166,13 +166,13 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
|
||||
|
||||
static switch_status channel_on_loopback(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "CHANNEL LOOPBACK\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status channel_on_transmit(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "CHANNEL TRANSMIT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
switch_core_session_set_private(*new_session, tech_pvt);
|
||||
tech_pvt->session = *new_session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -209,7 +209,7 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
snprintf(name, sizeof(name), "Opal/%s-%04x", caller_profile->destination_number, rand() & 0xffff);
|
||||
switch_channel_set_name(channel, name);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Doh! no caller profile\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! no caller profile\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ static switch_status channel_on_ring(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL RING\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ static switch_status channel_on_execute(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -215,7 +215,7 @@ static switch_status channel_on_hangup(switch_core_session *session)
|
||||
|
||||
deactivate_audio_device(tech_pvt);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
|
||||
deactivate_audio_device(tech_pvt);
|
||||
switch_channel_hangup(channel);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -243,7 +243,7 @@ static switch_status channel_kill_channel(switch_core_session *session, int sig)
|
||||
|
||||
static switch_status channel_on_loopback(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "CHANNEL LOOPBACK\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ static switch_status channel_on_transmit(switch_core_session *session)
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s\n", buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
|
||||
last = switch_time_now();
|
||||
}
|
||||
switch_yield(50000);
|
||||
@@ -285,7 +285,7 @@ static switch_status channel_on_transmit(switch_core_session *session)
|
||||
|
||||
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "CHANNEL TRANSMIT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ static switch_status channel_send_dtmf(switch_core_session *session, char *dtmf)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "DTMF ON CALL %s [%s]\n", tech_pvt->call_id, dtmf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF ON CALL %s [%s]\n", tech_pvt->call_id, dtmf);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -491,7 +491,7 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
switch_core_session_set_private(*new_session, tech_pvt);
|
||||
tech_pvt->session = *new_session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -507,7 +507,7 @@ static switch_status channel_outgoing_channel(switch_core_session *session, swit
|
||||
switch_channel_set_caller_profile(channel, caller_profile);
|
||||
tech_pvt->caller_profile = caller_profile;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Doh! no caller profile\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! no caller profile\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -527,7 +527,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
{
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -540,7 +540,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
dump_info();
|
||||
|
||||
if (switch_event_reserve_subclass(MY_EVENT_RINGING) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't register subclass!");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't register subclass!");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ static switch_status load_config(void)
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -632,7 +632,7 @@ static int get_dev_by_name(char *name, int in)
|
||||
numDevices = Pa_CountDevices();
|
||||
|
||||
if (numDevices < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
|
||||
return -2;
|
||||
}
|
||||
|
||||
@@ -658,55 +658,55 @@ static int dump_info(void)
|
||||
PaError err;
|
||||
numDevices = Pa_CountDevices();
|
||||
if (numDevices < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: Pa_CountDevices returned 0x%x\n", numDevices);
|
||||
err = numDevices;
|
||||
goto error;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "Number of devices = %d\n", numDevices);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Number of devices = %d\n", numDevices);
|
||||
for (i = 0; i < numDevices; i++) {
|
||||
pdi = Pa_GetDeviceInfo(i);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "---------------------------------------------- #%d", i);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "---------------------------------------------- #%d", i);
|
||||
if (i == Pa_GetDefaultInputDeviceID())
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, " DefaultInput");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, " DefaultInput");
|
||||
if (i == Pa_GetDefaultOutputDeviceID())
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, " DefaultOutput");
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "\nName = %s\n", pdi->name);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "Max Inputs = %d", pdi->maxInputChannels);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, ", Max Outputs = %d\n", pdi->maxOutputChannels);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, " DefaultOutput");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\nName = %s\n", pdi->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Max Inputs = %d", pdi->maxInputChannels);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, ", Max Outputs = %d\n", pdi->maxOutputChannels);
|
||||
if (pdi->numSampleRates == -1) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "Sample Rate Range = %f to %f\n", pdi->sampleRates[0],
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Sample Rate Range = %f to %f\n", pdi->sampleRates[0],
|
||||
pdi->sampleRates[1]);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "Sample Rates =");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Sample Rates =");
|
||||
for (j = 0; j < pdi->numSampleRates; j++) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, " %8.2f,", pdi->sampleRates[j]);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, " %8.2f,", pdi->sampleRates[j]);
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n");
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "Native Sample Formats = ");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Native Sample Formats = ");
|
||||
if (pdi->nativeSampleFormats & paInt8)
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "paInt8, ");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "paInt8, ");
|
||||
if (pdi->nativeSampleFormats & paUInt8)
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "paUInt8, ");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "paUInt8, ");
|
||||
if (pdi->nativeSampleFormats & paInt16)
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "paInt16, ");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "paInt16, ");
|
||||
if (pdi->nativeSampleFormats & paInt32)
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "paInt32, ");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "paInt32, ");
|
||||
if (pdi->nativeSampleFormats & paFloat32)
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "paFloat32, ");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "paFloat32, ");
|
||||
if (pdi->nativeSampleFormats & paInt24)
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "paInt24, ");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "paInt24, ");
|
||||
if (pdi->nativeSampleFormats & paPackedInt24)
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "paPackedInt24, ");
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "paPackedInt24, ");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n");
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "----------------------------------------------\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "----------------------------------------------\n");
|
||||
return 0;
|
||||
error:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "An error occured while using the portaudio stream\n");
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "Error number: %d\n", err);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "Error message: %s\n", Pa_GetErrorText(err));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "An error occured while using the portaudio stream\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Error number: %d\n", err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Error message: %s\n", Pa_GetErrorText(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ static switch_status engage_device(struct private_object *tech_pvt)
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
if (switch_core_codec_init(&tech_pvt->write_codec,
|
||||
@@ -736,12 +736,12 @@ static switch_status engage_device(struct private_object *tech_pvt)
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't load codec?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't load codec?\n");
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Loaded codec L16 %dhz %dms on %s\n", sample_rate, codec_ms,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loaded codec L16 %dhz %dms on %s\n", sample_rate, codec_ms,
|
||||
switch_channel_get_name(channel));
|
||||
tech_pvt->read_frame.rate = sample_rate;
|
||||
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
|
||||
@@ -758,12 +758,12 @@ static switch_status engage_device(struct private_object *tech_pvt)
|
||||
if ((tech_pvt->err =
|
||||
OpenAudioStream(&tech_pvt->audio_out, sample_rate, SAMPLE_TYPE, PABLIO_WRITE | PABLIO_MONO, -1,
|
||||
tech_pvt->outdev)) != paNoError) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't open audio out [%d]!\n", tech_pvt->outdev);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't open audio out [%d]!\n", tech_pvt->outdev);
|
||||
CloseAudioStream(tech_pvt->audio_in);
|
||||
tech_pvt->audio_in = NULL;
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't open audio in [%d]!\n", tech_pvt->indev);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't open audio in [%d]!\n", tech_pvt->indev);
|
||||
}
|
||||
switch_mutex_unlock(globals.device_lock);
|
||||
|
||||
@@ -803,7 +803,7 @@ static switch_status place_call(char *dest, char *out, size_t outlen)
|
||||
switch_core_session_set_private(session, tech_pvt);
|
||||
tech_pvt->session = session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(&session);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
@@ -242,15 +242,15 @@ static switch_status wanpipe_on_init(switch_core_session *session)
|
||||
err = sangoma_tdm_set_codec(tech_pvt->socket, &tdm_api, WP_SLINEAR);
|
||||
|
||||
mtu_mru = sangoma_tdm_get_usr_mtu_mru(tech_pvt->socket, &tdm_api);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WANPIPE INIT MTU is %d\n", mtu_mru);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE INIT MTU is %d\n", mtu_mru);
|
||||
|
||||
if (mtu_mru != globals.mtu) {
|
||||
sangoma_tdm_set_usr_period(tech_pvt->socket, &tdm_api, 40);
|
||||
err = sangoma_tdm_set_usr_period(tech_pvt->socket, &tdm_api, new_mtu);
|
||||
mtu_mru = sangoma_tdm_get_usr_mtu_mru(tech_pvt->socket, &tdm_api);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "ADJUSTED MTU AFTER SETTING IT TO %d is %d %d [%s]\n", new_mtu, mtu_mru, err, strerror(err));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ADJUSTED MTU AFTER SETTING IT TO %d is %d %d [%s]\n", new_mtu, mtu_mru, err, strerror(err));
|
||||
if (mtu_mru != globals.mtu) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Failure to adjust MTU\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failure to adjust MTU\n");
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ static switch_status wanpipe_on_init(switch_core_session *session)
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->read_codec, "L16", rate, 20, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ static switch_status wanpipe_on_init(switch_core_session *session)
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->write_codec, "L16", rate, 20, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -317,7 +317,7 @@ static switch_status wanpipe_on_ring(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WANPIPE RING\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE RING\n");
|
||||
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ static switch_status wanpipe_on_hangup(switch_core_session *session)
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WANPIPE HANGUP\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE HANGUP\n");
|
||||
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_NOSIG)) {
|
||||
pri_hangup(tech_pvt->spri->pri, tech_pvt->call, tech_pvt->cause);
|
||||
@@ -374,7 +374,7 @@ static switch_status wanpipe_on_hangup(switch_core_session *session)
|
||||
|
||||
static switch_status wanpipe_on_loopback(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WANPIPE LOOPBACK\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE LOOPBACK\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ static switch_status wanpipe_on_transmit(switch_core_session *session)
|
||||
|
||||
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WANPIPE TRANSMIT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE TRANSMIT\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ static switch_status wanpipe_read_frame(switch_core_session *session, switch_fra
|
||||
if(digit_str[0]) {
|
||||
switch_channel_queue_dtmf(channel, digit_str);
|
||||
if (globals.debug) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "DTMF DETECTED: [%s]\n", digit_str);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str);
|
||||
}
|
||||
if (globals.supress_dtmf_tone) {
|
||||
memset(tech_pvt->read_frame.data, 0, tech_pvt->read_frame.datalen);
|
||||
@@ -537,13 +537,13 @@ static switch_status wanpipe_write_frame(switch_core_session *session, switch_fr
|
||||
result = sangoma_sendmsg_socket(tech_pvt->socket,
|
||||
&tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), dtmf, bread, 0);
|
||||
if (result < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Bad Write %d bytes returned %d (%s)!\n", bread,
|
||||
result, strerror(errno));
|
||||
if (errno == EBUSY) {
|
||||
continue;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Failed!\n");
|
||||
status = SWITCH_STATUS_GENERR;
|
||||
break;
|
||||
} else {
|
||||
@@ -579,13 +579,13 @@ static switch_status wanpipe_write_frame(switch_core_session *session, switch_fr
|
||||
result = sangoma_sendmsg_socket(tech_pvt->socket,
|
||||
&tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), bp, towrite, 0);
|
||||
if (result < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Bad Write frame len %u write %d bytes returned %d (%s)!\n", frame->datalen,
|
||||
globals.mtu, result, strerror(errno));
|
||||
if (errno == EBUSY) {
|
||||
continue;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Write Failed!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Failed!\n");
|
||||
status = SWITCH_STATUS_GENERR;
|
||||
break;
|
||||
} else {
|
||||
@@ -614,12 +614,12 @@ static switch_status wanpipe_send_dtmf(switch_core_session *session, char *digit
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
if (!tech_pvt->dtmf_buffer) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocate DTMF Buffer....");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Allocate DTMF Buffer....");
|
||||
if (switch_buffer_create(switch_core_session_get_pool(session), &tech_pvt->dtmf_buffer, 3192) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "FAILURE!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "FAILURE!\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "SUCCESS!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "SUCCESS!\n");
|
||||
}
|
||||
}
|
||||
for (cur = digits; *cur; cur++) {
|
||||
@@ -716,7 +716,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
}
|
||||
outbound_profile->destination_number++;
|
||||
} else if (!globals.configured_spans) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error No Spans Configured.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error No Spans Configured.\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
switch_core_session_set_private(*new_session, tech_pvt);
|
||||
tech_pvt->session = *new_session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -755,7 +755,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
if (num && *num > 47 && *num < 58) {
|
||||
span = atoi(num);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invlid Syntax\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invlid Syntax\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -773,13 +773,13 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
} else if (num && *num > 47 && *num < 58) {
|
||||
channo = atoi(num);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invlid Syntax\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invlid Syntax\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
caller_profile->destination_number = p;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invlid Syntax\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invlid Syntax\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -795,7 +795,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
sangoma_span_chan_fromif(bchan, &span, &chan);
|
||||
if (sangoma_span_chan_fromif(bchan, &span, &chan)) {
|
||||
if ((tech_pvt->socket = sangoma_open_tdmapi_span_chan(span, chan)) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't open fd!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't open fd!\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -804,7 +804,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
switch_channel_set_name(channel, name);
|
||||
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid address\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid address\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -819,21 +819,21 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
if (autochan > 0) {
|
||||
for(channo = 1; channo < SANGOMA_MAX_CHAN_PER_SPAN; channo++) {
|
||||
if ((SPANS[span]->bchans & (1 << channo)) && !chanmap->map[channo]) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Choosing channel %d\n", channo);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel %d\n", channo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (autochan < 0) {
|
||||
for(channo = SANGOMA_MAX_CHAN_PER_SPAN; channo > 0; channo--) {
|
||||
if ((SPANS[span]->bchans & (1 << channo)) && !chanmap->map[channo]) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Choosing channel %d\n", channo);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel %d\n", channo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (channo <= 0 || channo == (SANGOMA_MAX_CHAN_PER_SPAN)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "No Free Channels!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No Free Channels!\n");
|
||||
channo = 0;
|
||||
}
|
||||
}
|
||||
@@ -844,7 +844,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
} while(autospan && span < MAX_SPANS && !spri && !channo);
|
||||
|
||||
if (!spri || channo == 0 || channo == (SANGOMA_MAX_CHAN_PER_SPAN)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "No Free Channels!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No Free Channels!\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -876,7 +876,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
}
|
||||
|
||||
if ((tech_pvt->socket = sangoma_open_tdmapi_span_chan(spri->span, channo)) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't open fd!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't open fd!\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
pri_sr_free(sr);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
@@ -887,7 +887,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Doh! no caller profile\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! no caller profile\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -906,7 +906,7 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
|
||||
static void s_pri_error(struct pri *pri, char *s)
|
||||
{
|
||||
if (globals.debug) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, s);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
pri_set_message(s_pri_message);
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -949,9 +949,9 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
|
||||
static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "number is: %s\n", event->ring.callednum);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "number is: %s\n", event->ring.callednum);
|
||||
if (strlen(event->ring.callednum) > 3) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "final number is: %s\n", event->ring.callednum);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "final number is: %s\n", event->ring.callednum);
|
||||
pri_answer(spri->pri, event->ring.call, 0, 1);
|
||||
}
|
||||
return 0;
|
||||
@@ -983,7 +983,7 @@ static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, p
|
||||
chanmap->map[event->hangup.channel] = NULL;
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Hanging up channel s%dc%d\n", spri->span, event->hangup.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Hanging up channel s%dc%d\n", spri->span, event->hangup.channel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -997,12 +997,12 @@ static int on_answer(struct sangoma_pri *spri, sangoma_pri_event_t event_type, p
|
||||
chanmap = spri->private_info;
|
||||
|
||||
if ((session = chanmap->map[event->answer.channel])) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Answer on channel s%dc%d\n", spri->span, event->answer.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Answer on channel s%dc%d\n", spri->span, event->answer.channel);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
switch_channel_answer(channel);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Answer on channel s%dc%d but it's not in use?\n", spri->span, event->answer.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Answer on channel s%dc%d but it's not in use?\n", spri->span, event->answer.channel);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1020,14 +1020,14 @@ static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
if ((session = chanmap->map[event->proceeding.channel])) {
|
||||
switch_caller_profile *originator;
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Proceeding on channel s%dc%d\n", spri->span, event->proceeding.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Proceeding on channel s%dc%d\n", spri->span, event->proceeding.channel);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
if ((originator = switch_channel_get_originator_caller_profile(channel))) {
|
||||
switch_core_session_message msg;
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Passing progress to Originator %s\n", originator->chan_name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Passing progress to Originator %s\n", originator->chan_name);
|
||||
|
||||
msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
|
||||
msg.from = switch_channel_get_name(channel);
|
||||
@@ -1039,7 +1039,7 @@ static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
|
||||
//switch_channel_answer(channel);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Proceeding on channel s%dc%d but it's not in use?\n", spri->span, event->proceeding.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Proceeding on channel s%dc%d but it's not in use?\n", spri->span, event->proceeding.channel);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1056,7 +1056,7 @@ static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
chanmap = spri->private_info;
|
||||
|
||||
if ((session = chanmap->map[event->ringing.channel])) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Ringing on channel s%dc%d\n", spri->span, event->ringing.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d\n", spri->span, event->ringing.channel);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
@@ -1070,7 +1070,7 @@ static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
tech_pvt->callno = event->ring.channel;
|
||||
tech_pvt->span = spri->span;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Ringing on channel s%dc%d but it's not in use?\n", spri->span, event->ringing.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d but it's not in use?\n", spri->span, event->ringing.channel);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1088,12 +1088,12 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
|
||||
|
||||
chanmap = spri->private_info;
|
||||
if (chanmap->map[event->ring.channel]) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "--Duplicate Ring on channel s%dc%d (ignored)\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "--Duplicate Ring on channel s%dc%d (ignored)\n",
|
||||
spri->span, event->ring.channel);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Ring on channel s%dc%d (from %s to %s)\n", spri->span, event->ring.channel,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ring on channel s%dc%d (from %s to %s)\n", spri->span, event->ring.channel,
|
||||
event->ring.callingnum, event->ring.callednum);
|
||||
|
||||
|
||||
@@ -1115,7 +1115,7 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
|
||||
switch_channel_set_name(channel, name);
|
||||
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(&session);
|
||||
return 0;
|
||||
}
|
||||
@@ -1147,7 +1147,7 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
|
||||
tech_pvt->span = spri->span;
|
||||
|
||||
if ((fd = sangoma_open_tdmapi_span_chan(spri->span, event->ring.channel)) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't open fd!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't open fd!\n");
|
||||
}
|
||||
//sangoma_tdm_set_hw_period(fd, &tdm_api, 480);
|
||||
|
||||
@@ -1157,7 +1157,7 @@ static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri
|
||||
switch_channel_set_state(channel, CS_INIT);
|
||||
switch_core_session_thread_launch(session);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Create new Inbound Channel!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Create new Inbound Channel!\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -1177,7 +1177,7 @@ static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
struct channel_map *chanmap;
|
||||
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Restarting s%dc%d\n", spri->span, event->restart.channel);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Restarting s%dc%d\n", spri->span, event->restart.channel);
|
||||
|
||||
if (event->restart.channel < 1) {
|
||||
return 0;
|
||||
@@ -1189,12 +1189,12 @@ static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
if ((session = chanmap->map[event->restart.channel])) {
|
||||
switch_channel *channel;
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hanging Up channel %s\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hanging Up channel %s\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel);
|
||||
}
|
||||
|
||||
if ((fd = sangoma_open_tdmapi_span_chan(spri->span, event->restart.channel)) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't open fd [%s]!\n", strerror(errno));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't open fd [%s]!\n", strerror(errno));
|
||||
} else {
|
||||
close(fd);
|
||||
}
|
||||
@@ -1205,7 +1205,7 @@ static int on_dchan_up(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
|
||||
{
|
||||
|
||||
if (!switch_test_flag(spri, SANGOMA_PRI_READY)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Span %d D-Chan UP!\n", spri->span);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Span %d D-Chan UP!\n", spri->span);
|
||||
switch_set_flag(spri, SANGOMA_PRI_READY);
|
||||
}
|
||||
|
||||
@@ -1216,7 +1216,7 @@ static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_typ
|
||||
{
|
||||
|
||||
if (switch_test_flag(spri, SANGOMA_PRI_READY)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Span %d D-Chan DOWN!\n", spri->span);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Span %d D-Chan DOWN!\n", spri->span);
|
||||
switch_clear_flag(spri, SANGOMA_PRI_READY);
|
||||
}
|
||||
|
||||
@@ -1226,7 +1226,7 @@ static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_typ
|
||||
static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event)
|
||||
{
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Caught Event span %d %u (%s)\n", spri->span, event_type,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span, event_type,
|
||||
sangoma_pri_event_str(event_type));
|
||||
return 0;
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@ static switch_status config_wanpipe(int reload)
|
||||
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -1310,13 +1310,13 @@ static switch_status config_wanpipe(int reload)
|
||||
if (!strcmp(var, "span")) {
|
||||
current_span = atoi(val);
|
||||
if (current_span <= 0 || current_span > MAX_SPANS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid SPAN!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid SPAN!\n");
|
||||
current_span = 0;
|
||||
continue;
|
||||
}
|
||||
if (!SPANS[current_span]) {
|
||||
if (!(SPANS[current_span] = switch_core_alloc(module_pool, sizeof(*SPANS[current_span])))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "MEMORY ERROR\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "MEMORY ERROR\n");
|
||||
break;;
|
||||
}
|
||||
SPANS[current_span]->span = current_span;
|
||||
@@ -1324,7 +1324,7 @@ static switch_status config_wanpipe(int reload)
|
||||
|
||||
} else {
|
||||
if (!current_span) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid option %s when no span defined.\n", var);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid option %s when no span defined.\n", var);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1344,14 +1344,14 @@ static switch_status config_wanpipe(int reload)
|
||||
SPANS[current_span]->bchans |= (1 << x);
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid bchan range!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid bchan range!\n");
|
||||
}
|
||||
} else {
|
||||
int i = atoi(val);
|
||||
if (i > 0 && i < 31) {
|
||||
SPANS[current_span]->bchans |= (1 << i);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid bchan!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid bchan!\n");
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(var, "node")) {
|
||||
@@ -1370,7 +1370,7 @@ static switch_status config_wanpipe(int reload)
|
||||
if (mtu >= 10 && mtu < 960) {
|
||||
SPANS[current_span]->mtu = mtu;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid MTU (%s)!\n", val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid MTU (%s)!\n", val);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1396,10 +1396,10 @@ static switch_status config_wanpipe(int reload)
|
||||
SPANS[current_span]->pswitch,
|
||||
SPANS[current_span]->node,
|
||||
globals.debug)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot launch span %d\n", current_span);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot launch span %d\n", current_span);
|
||||
continue;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Launch span %d\n", current_span);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Launch span %d\n", current_span);
|
||||
pri_thread_launch(&SPANS[current_span]->spri);
|
||||
globals.configured_spans++;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ static switch_status woomerachan_on_init(switch_core_session *session)
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->read_codec, "L16", rate, 30, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ static switch_status woomerachan_on_init(switch_core_session *session)
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->write_codec, "L16", rate, 30, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Cannot set read codec\n", switch_channel_get_name(channel));
|
||||
switch_channel_hangup(channel);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ static switch_status woomerachan_on_init(switch_core_session *session)
|
||||
|
||||
switch_core_session_launch_thread(session, woomera_channel_thread_run, session);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s WOOMERACHAN INIT\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN INIT\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ static switch_status woomerachan_on_ring(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s WOOMERACHAN RING\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN RING\n", switch_channel_get_name(channel));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ static switch_status woomerachan_on_execute(switch_core_session *session)
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s WOOMERACHAN EXECUTE\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN EXECUTE\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -287,7 +287,7 @@ static switch_status woomerachan_on_hangup(switch_core_session *session)
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s WOOMERACHAN HANGUP\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN HANGUP\n", switch_channel_get_name(channel));
|
||||
tech_destroy(tech_pvt);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@@ -329,7 +329,7 @@ static switch_status woomerachan_kill_channel(switch_core_session *session, int
|
||||
udp_socket_close(tech_pvt);
|
||||
|
||||
switch_channel_hangup(channel);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel));
|
||||
|
||||
|
||||
|
||||
@@ -338,13 +338,13 @@ static switch_status woomerachan_kill_channel(switch_core_session *session, int
|
||||
|
||||
static switch_status woomerachan_on_loopback(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WOOMERACHAN LOOPBACK\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WOOMERACHAN LOOPBACK\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status woomerachan_on_transmit(switch_core_session *session)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "WOOMERACHAN TRANSMIT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WOOMERACHAN TRANSMIT\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ static switch_status woomerachan_outgoing_channel(switch_core_session *session,
|
||||
switch_core_session_set_private(*new_session, tech_pvt);
|
||||
tech_pvt->session = *new_session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -499,7 +499,7 @@ static switch_status woomerachan_outgoing_channel(switch_core_session *session,
|
||||
switch_channel_set_caller_profile(channel, caller_profile);
|
||||
tech_pvt->caller_profile = caller_profile;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Doh! no caller profile\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doh! no caller profile\n");
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
@@ -519,7 +519,7 @@ static void tech_destroy(private_object * tech_pvt)
|
||||
woomera_message wmsg;
|
||||
|
||||
if (globals.debug > 1) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, WOOMERA_DEBUG_PREFIX "+++DESTROY\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, WOOMERA_DEBUG_PREFIX "+++DESTROY\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -527,7 +527,7 @@ static void tech_destroy(private_object * tech_pvt)
|
||||
WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse
|
||||
(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "{%s} Already Disconnected\n", tech_pvt->profile->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} Already Disconnected\n", tech_pvt->profile->name);
|
||||
}
|
||||
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "bye%s", WOOMERA_RECORD_SEPERATOR);
|
||||
@@ -551,10 +551,10 @@ static void woomera_printf(woomera_profile * profile, switch_socket_t *socket, c
|
||||
#endif
|
||||
va_end(ap);
|
||||
if (res == -1) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Out of memory\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Out of memory\n");
|
||||
} else {
|
||||
if (profile && globals.debug) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Send Message: {%s} [%s/%d]\n%s\n%s", profile->name,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send Message: {%s} [%s/%d]\n%s\n%s", profile->name,
|
||||
profile->woomera_host, profile->woomera_port, WOOMERA_DEBUG_LINE, stuff);
|
||||
}
|
||||
len = strlen(stuff);
|
||||
@@ -596,7 +596,7 @@ static int woomera_enqueue_event(woomera_event_queue * event_queue, woomera_mess
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Memory Allocation Error!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Memory Allocation Error!\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -660,7 +660,7 @@ static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, in
|
||||
next = buf;
|
||||
|
||||
if (globals.debug) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Receive Message: {%s} [%s/%d]\n%s\n%s", profile->name,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Receive Message: {%s} [%s/%d]\n%s\n%s", profile->name,
|
||||
profile->woomera_host, profile->woomera_port, WOOMERA_DEBUG_LINE, buf);
|
||||
}
|
||||
|
||||
@@ -704,14 +704,14 @@ static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, in
|
||||
cur++;
|
||||
wmsg->mval = atoi(buf);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Malformed Message!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Malformed Message!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cur) {
|
||||
strncpy(wmsg->command, cur, WOOMERA_STRLEN);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Malformed Message!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Malformed Message!\n");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -743,13 +743,13 @@ static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, in
|
||||
switch_socket_recv(fd, wmsg->body, &len);
|
||||
|
||||
if (globals.debug) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s\n", wmsg->body);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", wmsg->body);
|
||||
}
|
||||
}
|
||||
|
||||
if (event_queue && switch_test_flag(wmsg, WFLAG_EVENT)) {
|
||||
if (globals.debug) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Queue Event: {%s} [%s]\n", profile->name, wmsg->command);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Queue Event: {%s} [%s]\n", profile->name, wmsg->command);
|
||||
}
|
||||
/* we don't want events we want a reply so we will stash them for later */
|
||||
woomera_enqueue_event(event_queue, wmsg);
|
||||
@@ -785,7 +785,7 @@ static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile
|
||||
/*
|
||||
status = switch_socket_bind((*new_sock), sa);
|
||||
if (0 && status != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't Bind to %s:%d!\n", profile->woomera_host, profile->woomera_port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't Bind to %s:%d!\n", profile->woomera_host, profile->woomera_port);
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
@@ -820,7 +820,7 @@ static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **wo
|
||||
if (!woomera_profile_thread_running(profile, 0, 0)) {
|
||||
break;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "{%s} Cannot Reconnect to Woomera! retry in 5 seconds\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} Cannot Reconnect to Woomera! retry in 5 seconds\n",
|
||||
profile->name);
|
||||
switch_sleep(WOOMERA_RECONNECT_TIME);
|
||||
}
|
||||
@@ -830,7 +830,7 @@ static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **wo
|
||||
woomera_printf(profile, *woomera_socket, "LISTEN%s", WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse(*woomera_socket,
|
||||
&wmsg, WOOMERA_HARD_TIMEOUT, profile, &profile->event_queue) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "{%s} HELP! Woomera is broken!\n", profile->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} HELP! Woomera is broken!\n", profile->name);
|
||||
globals.panic = 1;
|
||||
woomera_profile_thread_running(&default_profile, 1, 0);
|
||||
switch_sleep(WOOMERA_RECONNECT_TIME);
|
||||
@@ -859,7 +859,7 @@ static int tech_create_read_socket(private_object * tech_pvt)
|
||||
tech_pvt->port = globals.next_woomera_port = WOOMERA_MIN_PORT;
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "connect %s:%d\n", tech_pvt->profile->audio_ip, tech_pvt->port);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d\n", tech_pvt->profile->audio_ip, tech_pvt->port);
|
||||
//tech_pvt->udp_socket = create_udp_socket(tech_pvt->profile->audio_ip, tech_pvt->port, &tech_pvt->udpread, 0);
|
||||
|
||||
switch_sockaddr_info_get(&tech_pvt->udpread, tech_pvt->profile->audio_ip, SWITCH_UNSPEC, tech_pvt->port, 0, pool);
|
||||
@@ -879,9 +879,9 @@ static int tech_activate(private_object * tech_pvt)
|
||||
|
||||
if (tech_pvt) {
|
||||
if ((connect_woomera(&tech_pvt->command_channel, tech_pvt->profile, 0))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "connected to woomera!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connected to woomera!\n");
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't connect to woomera!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Can't connect to woomera!\n");
|
||||
switch_sleep(WOOMERA_RECONNECT_TIME);
|
||||
return -1;
|
||||
}
|
||||
@@ -906,14 +906,14 @@ static int tech_activate(private_object * tech_pvt)
|
||||
woomera_printf(tech_pvt->profile, tech_pvt->command_channel, "LISTEN%s", WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse(tech_pvt->command_channel,
|
||||
&wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "{%s} HELP! Woomera is broken!\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} HELP! Woomera is broken!\n",
|
||||
tech_pvt->profile->name);
|
||||
switch_set_flag(tech_pvt, TFLAG_ABORT);
|
||||
globals.panic = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Where's my tech_pvt?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Where's my tech_pvt?\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -968,7 +968,7 @@ static void *woomera_channel_thread_run(switch_thread *thread, void *obj)
|
||||
if (woomera_message_parse
|
||||
(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile,
|
||||
&tech_pvt->event_queue) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "{%s} HELP! Woomera is broken!\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} HELP! Woomera is broken!\n",
|
||||
tech_pvt->profile->name);
|
||||
switch_set_flag(tech_pvt, TFLAG_ABORT);
|
||||
globals.panic = 1;
|
||||
@@ -984,7 +984,7 @@ static void *woomera_channel_thread_run(switch_thread *thread, void *obj)
|
||||
if (woomera_message_parse
|
||||
(tech_pvt->command_channel, &wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile,
|
||||
&tech_pvt->event_queue) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "{%s} HELP! Woomera is broken!\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} HELP! Woomera is broken!\n",
|
||||
tech_pvt->profile->name);
|
||||
switch_set_flag(tech_pvt, TFLAG_ABORT);
|
||||
globals.panic = 1;
|
||||
@@ -1027,7 +1027,7 @@ static void *woomera_channel_thread_run(switch_thread *thread, void *obj)
|
||||
dtmf_frame.subclass = wmsg.command_args[x];
|
||||
ast_queue_frame(tech_pvt->owner, ast_frdup(&dtmf_frame));
|
||||
if (globals.debug > 1) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, WOOMERA_DEBUG_PREFIX "SEND DTMF [%c] to %s\n", dtmf_frame.subclass, tech_pvt->owner->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, WOOMERA_DEBUG_PREFIX "SEND DTMF [%c] to %s\n", dtmf_frame.subclass, tech_pvt->owner->name);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1082,7 +1082,7 @@ static void *woomera_channel_thread_run(switch_thread *thread, void *obj)
|
||||
|
||||
if (woomera_message_parse(tech_pvt->command_channel,
|
||||
&wmsg, WOOMERA_HARD_TIMEOUT, tech_pvt->profile, &tech_pvt->event_queue) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "{%s} HELP! Woomera is broken!\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} HELP! Woomera is broken!\n",
|
||||
tech_pvt->profile->name);
|
||||
switch_set_flag(tech_pvt, TFLAG_ABORT);
|
||||
globals.panic = 1;
|
||||
@@ -1117,7 +1117,7 @@ static void *woomera_channel_thread_run(switch_thread *thread, void *obj)
|
||||
switch_core_session_get_pool(tech_pvt->session)) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
if (globals.debug) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
WOOMERA_DEBUG_PREFIX "{%s} Cannot resolve %s\n",
|
||||
tech_pvt->profile->name, ip);
|
||||
}
|
||||
@@ -1127,12 +1127,12 @@ static void *woomera_channel_thread_run(switch_thread *thread, void *obj)
|
||||
}
|
||||
}
|
||||
if (globals.debug > 2) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, WOOMERA_DEBUG_PREFIX "CHECK {%s}(%d)\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, WOOMERA_DEBUG_PREFIX "CHECK {%s}(%d)\n",
|
||||
tech_pvt->profile->name, res);
|
||||
}
|
||||
}
|
||||
if (globals.debug > 1) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, WOOMERA_DEBUG_PREFIX "Monitor thread for %s done.\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, WOOMERA_DEBUG_PREFIX "Monitor thread for %s done.\n",
|
||||
tech_pvt->profile->name);
|
||||
}
|
||||
|
||||
@@ -1150,7 +1150,7 @@ static void *woomera_thread_run(void *obj)
|
||||
woomera_profile *profile;
|
||||
|
||||
profile = obj;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Started Woomera Thread {%s}.\n", profile->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Started Woomera Thread {%s}.\n", profile->name);
|
||||
|
||||
profile->thread_running = 1;
|
||||
profile->woomera_socket = NULL;
|
||||
@@ -1159,7 +1159,7 @@ static void *woomera_thread_run(void *obj)
|
||||
while (woomera_profile_thread_running(profile, 0, 0)) {
|
||||
/* listen on socket and handle events */
|
||||
if (globals.panic == 2) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Woomera is disabled!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Woomera is disabled!\n");
|
||||
switch_sleep(WOOMERA_RECONNECT_TIME);
|
||||
continue;
|
||||
}
|
||||
@@ -1171,14 +1171,14 @@ static void *woomera_thread_run(void *obj)
|
||||
if (!woomera_profile_thread_running(profile, 0, 0)) {
|
||||
break;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Woomera Thread Up {%s} %s/%d\n", profile->name,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Woomera Thread Up {%s} %s/%d\n", profile->name,
|
||||
profile->woomera_host, profile->woomera_port);
|
||||
|
||||
}
|
||||
|
||||
if (globals.panic) {
|
||||
if (globals.panic != 2) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Help I'm in a state of panic!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Help I'm in a state of panic!\n");
|
||||
globals.panic = 0; //fix
|
||||
}
|
||||
woomera_socket_close(&profile->woomera_socket);
|
||||
@@ -1192,7 +1192,7 @@ static void *woomera_thread_run(void *obj)
|
||||
/* if we are not stingy with threads we can block forever */
|
||||
0, profile, NULL))) != 0)) {
|
||||
if (res < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "{%s} HELP! I lost my connection to woomera!\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} HELP! I lost my connection to woomera!\n",
|
||||
profile->name);
|
||||
woomera_socket_close(&profile->woomera_socket);
|
||||
|
||||
@@ -1206,14 +1206,14 @@ static void *woomera_thread_run(void *obj)
|
||||
woomera_printf(profile, profile->woomera_socket, "LISTEN%s", WOOMERA_RECORD_SEPERATOR);
|
||||
if (woomera_message_parse(profile->woomera_socket,
|
||||
&wmsg, WOOMERA_HARD_TIMEOUT, profile, &profile->event_queue) < 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "{%s} HELP! Woomera is broken!\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "{%s} HELP! Woomera is broken!\n",
|
||||
profile->name);
|
||||
globals.panic = 1;
|
||||
woomera_socket_close(&profile->woomera_socket);
|
||||
}
|
||||
}
|
||||
if (profile->woomera_socket) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Woomera Thread Up {%s} %s/%d\n", profile->name,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Woomera Thread Up {%s} %s/%d\n", profile->name,
|
||||
profile->woomera_host, profile->woomera_port);
|
||||
}
|
||||
}*/
|
||||
@@ -1228,7 +1228,7 @@ static void *woomera_thread_run(void *obj)
|
||||
name = woomera_message_header(&wmsg, "Channel-Name");
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "New Inbound Channel %s!\n", name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New Inbound Channel %s!\n", name);
|
||||
if ((session = switch_core_session_request(&woomerachan_endpoint_interface, NULL)) != 0) {
|
||||
struct private_object *tech_pvt;
|
||||
switch_channel *channel;
|
||||
@@ -1243,7 +1243,7 @@ static void *woomera_thread_run(void *obj)
|
||||
switch_core_session_set_private(session, tech_pvt);
|
||||
tech_pvt->session = session;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hey where is my memory pool?\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n");
|
||||
switch_core_session_destroy(&session);
|
||||
break;
|
||||
}
|
||||
@@ -1254,7 +1254,7 @@ static void *woomera_thread_run(void *obj)
|
||||
}
|
||||
|
||||
if (globals.debug > 2) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Main Thread {%s} Select Return %d\n", profile->name, res);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Main Thread {%s} Select Return %d\n", profile->name, res);
|
||||
}
|
||||
|
||||
switch_yield(100);
|
||||
@@ -1266,7 +1266,7 @@ static void *woomera_thread_run(void *obj)
|
||||
woomera_socket_close(&profile->woomera_socket);
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Ended Woomera Thread {%s}.\n", profile->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ended Woomera Thread {%s}.\n", profile->name);
|
||||
woomera_profile_thread_running(profile, 1, -1);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1305,7 +1305,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
globals.next_woomera_port = WOOMERA_MIN_PORT;
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -1350,10 +1350,10 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
//switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
//switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
@@ -1362,7 +1362,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
|
||||
|
||||
if (switch_mutex_init(&default_profile.iolock, SWITCH_MUTEX_NESTED, module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no lock\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no lock\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,12 +56,12 @@ static switch_status load_config(void)
|
||||
char *cf = "event_multicast.conf";
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (switch_event_reserve_subclass(MULTICAST_EVENT) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't register subclass!");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't register subclass!");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ static void event_handler(switch_event *event)
|
||||
default:
|
||||
switch_event_serialize(event, buf, sizeof(buf), NULL);
|
||||
len = strlen(buf);
|
||||
//switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nEVENT\n--------------------------------\n%s\n", buf);
|
||||
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT\n--------------------------------\n%s\n", buf);
|
||||
switch_socket_sendto(globals.udp_socket, globals.addr, 0, buf, &len);
|
||||
break;
|
||||
}
|
||||
@@ -120,39 +120,39 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if (load_config() != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Configure\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Configure\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (switch_sockaddr_info_get(&globals.addr, globals.address, SWITCH_UNSPEC, globals.port, 0, module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot find address\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot find address\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (switch_socket_create(&globals.udp_socket, AF_INET, SOCK_DGRAM, 0, module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Socket Error\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket Error\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (switch_socket_opt_set(globals.udp_socket, SWITCH_SO_REUSEADDR, 1) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Socket Option Error\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket Option Error\n");
|
||||
switch_socket_close(globals.udp_socket);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (switch_mcast_join(globals.udp_socket, globals.addr, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Multicast Error\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Multicast Error\n");
|
||||
switch_socket_close(globals.udp_socket);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
if (switch_socket_bind(globals.udp_socket, globals.addr) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Bind Error\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Bind Error\n");
|
||||
switch_socket_close(globals.udp_socket);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
@@ -163,7 +163,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't bind!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't bind!\n");
|
||||
switch_socket_close(globals.udp_socket);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ static void event_handler(switch_event *event)
|
||||
return;
|
||||
default:
|
||||
switch_event_serialize(event, buf, sizeof(buf), NULL);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nEVENT\n--------------------------------\n%s\n", buf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT\n--------------------------------\n%s\n", buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ static void *torture_thread(switch_thread *thread, void *obj)
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Thread Ended\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread Ended\n");
|
||||
}
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
|
||||
@@ -111,13 +111,13 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
*interface = &event_test_module_interface;
|
||||
|
||||
if (switch_event_reserve_subclass(MY_EVENT_COOL) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't register subclass!");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't register subclass!");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't bind!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ static void event_handler(switch_event *event)
|
||||
while (!globals.session.authorized) {
|
||||
switch_yield(100000);
|
||||
if (loops++ > 5) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Nothing to do with this Event!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Nothing to do with this Event!\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ static void event_handler(switch_event *event)
|
||||
switch (event->event_id) {
|
||||
default:
|
||||
switch_event_serialize(event, buf, sizeof(buf), NULL);
|
||||
//switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nEVENT\n--------------------------------\n%s\n", buf);
|
||||
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT\n--------------------------------\n%s\n", buf);
|
||||
msg = iks_make_msg(IKS_TYPE_NONE, globals.target_jid, buf);
|
||||
iks_insert_attrib(msg, "subject", "Event");
|
||||
iks_send(globals.session.parser, msg);
|
||||
@@ -106,7 +106,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_jid, globals.jid)
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_jid, globals.jid)
|
||||
/* TBD use config to pick what events to bind to */
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't bind!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -185,9 +185,9 @@ static int on_stream(struct session *sess, int type, iks * node)
|
||||
iks_start_sasl(sess->parser, IKS_SASL_PLAIN, sess->acc->user, sess->pass);
|
||||
}
|
||||
} else if (strcmp("failure", iks_name(node)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "sasl authentication failed\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sasl authentication failed\n");
|
||||
} else if (strcmp("success", iks_name(node)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "server connected\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "server connected\n");
|
||||
sess->authorized = 1;
|
||||
iks_send_header(sess->parser, sess->acc->server);
|
||||
} else {
|
||||
@@ -201,11 +201,11 @@ static int on_stream(struct session *sess, int type, iks * node)
|
||||
break;
|
||||
#if 0
|
||||
case IKS_NODE_STOP:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "server disconnected\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "server disconnected\n");
|
||||
break;
|
||||
|
||||
case IKS_NODE_ERROR:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "stream error\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "stream error\n");
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -240,7 +240,7 @@ static int on_msg(void *user_data, ikspak * pak)
|
||||
|
||||
static int on_error(void *user_data, ikspak * pak)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "authorization failed\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "authorization failed\n");
|
||||
return IKS_FILTER_EAT;
|
||||
}
|
||||
|
||||
@@ -296,11 +296,11 @@ static void xmpp_connect(char *jabber_id, char *pass)
|
||||
case IKS_OK:
|
||||
break;
|
||||
case IKS_NET_NODNS:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "hostname lookup failed\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hostname lookup failed\n");
|
||||
case IKS_NET_NOCONN:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "connection failed\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connection failed\n");
|
||||
default:
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "io error %d\n", e);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "io error %d\n", e);
|
||||
switch_sleep(5000000);
|
||||
continue;
|
||||
}
|
||||
@@ -318,20 +318,20 @@ static void xmpp_connect(char *jabber_id, char *pass)
|
||||
}
|
||||
|
||||
if (IKS_OK != e) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "io error %d\n", e);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "io error %d\n", e);
|
||||
switch_sleep(5000000);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!globals.session.authorized) {
|
||||
if (IKS_NET_TLSFAIL == e) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "tls handshake failed\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "tls handshake failed\n");
|
||||
switch_sleep(5000000);
|
||||
break;
|
||||
}
|
||||
|
||||
if (globals.session.counter == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "network timeout\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "network timeout\n");
|
||||
switch_sleep(5000000);
|
||||
break;
|
||||
}
|
||||
@@ -386,6 +386,6 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
|
||||
{
|
||||
RUNNING = 1;
|
||||
xmpp_connect(globals.jid, globals.passwd);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "disconnecting client %d\n", RUNNING);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "disconnecting client %d\n", RUNNING);
|
||||
return RUNNING ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_TERM;
|
||||
}
|
||||
@@ -57,44 +57,44 @@ static sw_result HOWL_API my_browser(sw_discovery discovery,
|
||||
switch (status) {
|
||||
case SW_DISCOVERY_BROWSE_INVALID:
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "browse reply: Invalid\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "browse reply: Invalid\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case SW_DISCOVERY_BROWSE_RELEASE:
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "browse reply: Release\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "browse reply: Release\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case SW_DISCOVERY_BROWSE_ADD_DOMAIN:
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "browse reply: Add Domain\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "browse reply: Add Domain\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case SW_DISCOVERY_BROWSE_ADD_DEFAULT_DOMAIN:
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "browse reply: Add Default Domain\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "browse reply: Add Default Domain\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case SW_DISCOVERY_BROWSE_REMOVE_DOMAIN:
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "browse reply: Remove Domain\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "browse reply: Remove Domain\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case SW_DISCOVERY_BROWSE_REMOVE_SERVICE:
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "browse reply: Remove Service\n");
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "remove service: 0x%x %s %s %s\n", interface_index, name, type, domain);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "browse reply: Remove Service\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "remove service: 0x%x %s %s %s\n", interface_index, name, type, domain);
|
||||
}
|
||||
break;
|
||||
|
||||
case SW_DISCOVERY_BROWSE_RESOLVED:
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "browse reply: Resolved\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "browse reply: Resolved\n");
|
||||
}
|
||||
break;
|
||||
case SW_DISCOVERY_BROWSE_ADD_SERVICE:
|
||||
@@ -116,7 +116,7 @@ static sw_result HOWL_API my_service_reply(sw_discovery discovery,
|
||||
"Invalid"
|
||||
};
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "publish reply: %s\n", status_text[status]);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "publish reply: %s\n", status_text[status]);
|
||||
return SW_OKAY;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ static void event_handler(switch_event *event)
|
||||
switch (event->event_id) {
|
||||
case SWITCH_EVENT_PUBLISH:
|
||||
if (sw_text_record_init(&text_record) != SW_OKAY) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "sw_text_record_init() failed\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sw_text_record_init() failed\n");
|
||||
return;
|
||||
} else {
|
||||
switch_event_header *hp;
|
||||
@@ -146,7 +146,7 @@ static void event_handler(switch_event *event)
|
||||
|
||||
snprintf(data, len, "%s=%s", hp->name, hp->value);
|
||||
if (sw_text_record_add_string(text_record, data) != SW_OKAY) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "unable to add service text: %s\n", data);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to add service text: %s\n", data);
|
||||
free(data);
|
||||
return;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ static void event_handler(switch_event *event)
|
||||
my_service_reply,
|
||||
NULL,
|
||||
&globals.disc_id)) != SW_OKAY) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "publish failed: %u\n", result);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "publish failed: %u\n", result);
|
||||
sw_text_record_fina(text_record);
|
||||
switch_mutex_unlock(globals.zc_lock);
|
||||
return;
|
||||
@@ -201,7 +201,7 @@ static switch_status load_config(void)
|
||||
sw_discovery_oid *oid;
|
||||
|
||||
if (!switch_config_open_file(&cfg, cf)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "open of %s failed\n", cf);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open of %s failed\n", cf);
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ static switch_status load_config(void)
|
||||
if (!strcasecmp(cfg.category, "settings")) {
|
||||
if (!strcmp(var, "browse")) {
|
||||
if ((oid = switch_core_alloc(module_pool, sizeof(*oid))) != 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Bind browser to to %s\n", val);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Bind browser to to %s\n", val);
|
||||
switch_mutex_lock(globals.zc_lock);
|
||||
sw_discovery_browse(globals.discovery, 0, val, NULL, my_browser, NULL, oid);
|
||||
switch_mutex_unlock(globals.zc_lock);
|
||||
@@ -220,13 +220,13 @@ static switch_status load_config(void)
|
||||
} else if (!strcasecmp(var, "publish") && !strcasecmp(val, "yes")) {
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_PUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't bind!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_bind((char *) modname, SWITCH_EVENT_UNPUBLISH, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't bind!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't bind!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
}
|
||||
@@ -270,14 +270,14 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
memset(&globals, 0, sizeof(globals));
|
||||
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
switch_mutex_init(&globals.zc_lock, SWITCH_MUTEX_NESTED, module_pool);
|
||||
|
||||
if (sw_discovery_init(&globals.discovery) != SW_OKAY) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "sw_discovery_init() failed\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sw_discovery_init() failed\n");
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
||||
@@ -286,12 +286,12 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
}
|
||||
|
||||
if (switch_event_reserve_subclass(MY_EVENT_PUBLISH) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't register subclass!");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't register subclass!");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (switch_event_reserve_subclass(MY_EVENT_UNPUBLISH) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't register subclass!");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Couldn't register subclass!");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ static switch_status sndfile_file_open(switch_file_handle *handle, char *path)
|
||||
int ready = 1;
|
||||
|
||||
if ((ext = strrchr(path, '.')) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid Format\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid Format\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
ext++;
|
||||
@@ -64,7 +64,7 @@ static switch_status sndfile_file_open(switch_file_handle *handle, char *path)
|
||||
}
|
||||
|
||||
if (!mode) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid Mode!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid Mode!\n");
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
@@ -120,18 +120,18 @@ static switch_status sndfile_file_open(switch_file_handle *handle, char *path)
|
||||
|
||||
|
||||
if ((mode & SFM_WRITE) && sf_format_check (&context->sfinfo) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error : file format is invalid (0x%08X).\n", context->sfinfo.format);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error : file format is invalid (0x%08X).\n", context->sfinfo.format);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
};
|
||||
|
||||
|
||||
if ((context->handle = sf_open(path, mode, &context->sfinfo)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error Opening File [%s] [%s]\n", path,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error Opening File [%s] [%s]\n", path,
|
||||
sf_strerror(context->handle));
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Opening File [%s] %dhz\n", path, context->sfinfo.samplerate);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] %dhz\n", path, context->sfinfo.samplerate);
|
||||
handle->samples = (unsigned int) context->sfinfo.frames;
|
||||
handle->samplerate = context->sfinfo.samplerate;
|
||||
handle->channels = (uint8_t)context->sfinfo.channels;
|
||||
@@ -158,7 +158,7 @@ static switch_status sndfile_file_seek(switch_file_handle *handle, unsigned int
|
||||
sndfile_context *context = handle->private_info;
|
||||
|
||||
if (!handle->seekable) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "File is not seekable\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "File is not seekable\n");
|
||||
return SWITCH_STATUS_NOTIMPL;
|
||||
}
|
||||
|
||||
@@ -252,13 +252,13 @@ static switch_status setup_formats(void)
|
||||
|
||||
sf_command(NULL, SFC_GET_LIB_VERSION, buffer, sizeof(buffer));
|
||||
if (strlen(buffer) < 1) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "Line %d: could not retrieve lib version.\n", __LINE__);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Line %d: could not retrieve lib version.\n", __LINE__);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "\nLibSndFile Version : %s Supported Formats\n", buffer);
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nLibSndFile Version : %s Supported Formats\n", buffer);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
|
||||
"================================================================================\n");
|
||||
sf_command(NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof(int));
|
||||
sf_command(NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof(int));
|
||||
@@ -272,7 +272,7 @@ static switch_status setup_formats(void)
|
||||
skip = 0;
|
||||
info.format = m;
|
||||
sf_command(NULL, SFC_GET_FORMAT_MAJOR, &info, sizeof(info));
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, "%s (extension \"%s\")\n", info.name, info.extension);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "%s (extension \"%s\")\n", info.name, info.extension);
|
||||
for (x = 0; x < len; x++) {
|
||||
if (supported_formats[x] == info.extension) {
|
||||
skip++;
|
||||
@@ -291,7 +291,7 @@ static switch_status setup_formats(void)
|
||||
sfinfo.format = format;
|
||||
/*
|
||||
if (sf_format_check(&sfinfo)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, " %s\n", info.name);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, " %s\n", info.name);
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -303,7 +303,7 @@ static switch_status setup_formats(void)
|
||||
|
||||
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN,
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG,
|
||||
"================================================================================\n");
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
@@ -105,7 +105,7 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_shutdown(void)
|
||||
perl_destruct(globals.my_perl);
|
||||
perl_free(globals.my_perl);
|
||||
globals.my_perl = NULL;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Unallocated perl interpreter.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unallocated perl interpreter.\n");
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -117,11 +117,11 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
char code[1024];
|
||||
|
||||
if (!(my_perl = perl_alloc())) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Could not allocate perl intrepreter\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not allocate perl intrepreter\n");
|
||||
switch_core_destroy();
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocated perl intrepreter.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Allocated perl intrepreter.\n");
|
||||
|
||||
PERL_SET_CONTEXT(my_perl);
|
||||
perl_construct(my_perl);
|
||||
|
||||
@@ -56,12 +56,12 @@ int fs_console_loop(void)
|
||||
|
||||
void fs_console_log(char *msg)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, msg);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, msg);
|
||||
}
|
||||
|
||||
void fs_console_clean(char *msg)
|
||||
{
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, msg);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, msg);
|
||||
}
|
||||
|
||||
struct switch_core_session *fs_core_session_locate(char *uuid)
|
||||
|
||||
@@ -152,7 +152,7 @@ struct db_obj {
|
||||
static void js_error(JSContext *cx, const char *message, JSErrorReport *report)
|
||||
{
|
||||
if (message) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "%s\n", message);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -765,7 +765,7 @@ static JSBool js_fetchurl_hash(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
||||
curl_easy_perform(curl_handle);
|
||||
curl_easy_cleanup(curl_handle);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error!\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@@ -803,10 +803,10 @@ static JSBool js_fetchurl_file(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
||||
curl_easy_cleanup(curl_handle);
|
||||
close(config_data.fd);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error!\n");
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error!\n");
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
@@ -1012,7 +1012,7 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
}
|
||||
|
||||
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@@ -1028,10 +1028,10 @@ static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
switch_set_flag(jss, S_HUP);
|
||||
return JS_TRUE;
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Create Channel\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Create Channel\n");
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Missing Args\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Missing Args\n");
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
@@ -1091,7 +1091,7 @@ static JSBool fileio_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *
|
||||
}
|
||||
switch_core_new_memory_pool(&pool);
|
||||
if (switch_file_open(&fd, path, flags, SWITCH_FPROT_UREAD|SWITCH_FPROT_UWRITE, pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Open File!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Open File!\n");
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
return JS_FALSE;
|
||||
}
|
||||
@@ -1240,7 +1240,7 @@ static JSBool db_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
|
||||
char *dbname = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
|
||||
switch_core_new_memory_pool(&pool);
|
||||
if (! (db = switch_core_db_open_file(dbname))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Open DB!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Open DB!\n");
|
||||
switch_core_destroy_memory_pool(&pool);
|
||||
return JS_FALSE;
|
||||
}
|
||||
@@ -1318,7 +1318,7 @@ static JSBool db_exec(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
||||
|
||||
switch_core_db_exec(dbo->db, sql, cb_func, arg, &err);
|
||||
if (err) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error %s\n", err);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error %s\n", err);
|
||||
switch_core_db_free(err);
|
||||
*rval = BOOLEAN_TO_JSVAL( JS_FALSE );
|
||||
}
|
||||
@@ -1396,7 +1396,7 @@ static JSBool db_prepare(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
char *sql = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
|
||||
|
||||
if(switch_core_db_prepare(dbo->db, sql, 0, &dbo->stmt, 0)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error %s\n", switch_core_db_errmsg(dbo->db));
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error %s\n", switch_core_db_errmsg(dbo->db));
|
||||
} else {
|
||||
*rval = BOOLEAN_TO_JSVAL( JS_TRUE );
|
||||
}
|
||||
@@ -1469,15 +1469,15 @@ static JSBool teletone_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
if (argc > 0) {
|
||||
if (JS_ValueToObject(cx, argv[0], &session_obj)) {
|
||||
if (!(jss = JS_GetPrivate(cx, session_obj))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Find Session [1]\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Find Session [1]\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Find Session [2]\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Find Session [2]\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Missing Session Arg\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Missing Session Arg\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (argc > 1) {
|
||||
@@ -1486,14 +1486,14 @@ static JSBool teletone_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
|
||||
if (argc > 2) {
|
||||
if (!JS_ValueToInt32(cx, argv[2], &memory)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Convert to INT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Convert to INT\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
switch_core_new_memory_pool(&pool);
|
||||
|
||||
if (!(tto = switch_core_alloc(pool, sizeof(*tto)))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Memory Error\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Memory Error\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@@ -1506,9 +1506,9 @@ static JSBool teletone_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
read_codec->implementation->number_of_channels,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, pool) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activated\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Raw Codec Activation Failed\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@@ -1520,9 +1520,9 @@ static JSBool teletone_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
(read_codec->implementation->samples_per_second / 50) * read_codec->implementation->number_of_channels,
|
||||
pool) == SWITCH_STATUS_SUCCESS) {
|
||||
tto->timer = &tto->timer_base;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Timer INIT Success %u\n", ms);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timer INIT Success %u\n", ms);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Timer INIT Failed\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timer INIT Failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1602,7 +1602,7 @@ static JSBool teletone_generate(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
|
||||
if (argc > 1) {
|
||||
if (!JS_ValueToInt32(cx, argv[1], &loops)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Convert to INT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Convert to INT\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
loops--;
|
||||
@@ -1686,7 +1686,7 @@ static JSBool teletone_generate(JSContext *cx, JSObject *obj, uintN argc, jsval
|
||||
write_frame.samples = write_frame.datalen / 2;
|
||||
for (stream_id = 0; stream_id < switch_core_session_get_stream_count(session); stream_id++) {
|
||||
if (switch_core_session_write_frame(session, &write_frame, -1, stream_id) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Bad Write\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Bad Write\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1744,7 +1744,7 @@ static JSBool js_log(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
||||
char *msg;
|
||||
|
||||
if ((msg = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "JS_LOG: %s", msg);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "JS_LOG: %s", msg);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
@@ -1758,7 +1758,7 @@ static JSBool js_include(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
eval_some_js(code, cx, obj, rval);
|
||||
return JS_TRUE;
|
||||
}
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid Arguements\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid Arguements\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@@ -1801,13 +1801,13 @@ static JSBool js_bridge(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
||||
if (argc > 1) {
|
||||
if (JS_ValueToObject(cx, argv[0], &session_obj_a)) {
|
||||
if (!(jss_a = JS_GetPrivate(cx, session_obj_a))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Find Session [1]\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Find Session [1]\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
if (JS_ValueToObject(cx, argv[1], &session_obj_b)) {
|
||||
if (!(jss_b = JS_GetPrivate(cx, session_obj_b))) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Find Session [1]\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Find Session [1]\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -1815,12 +1815,12 @@ static JSBool js_bridge(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
||||
|
||||
if (argc > 3) {
|
||||
if (!JS_ValueToInt32(cx, argv[3], &timelimit)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Cannot Convert to INT\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot Convert to INT\n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
if (!(jss_a && jss_b)) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Failure! %s %s\n", jss_a ? "y" : "n", jss_b ? "y" : "n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failure! %s %s\n", jss_a ? "y" : "n", jss_b ? "y" : "n");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
@@ -1938,9 +1938,9 @@ static JSBool js_email(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
||||
|
||||
|
||||
if (file) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Emailed file [%s] to [%s]\n", filename, to);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed file [%s] to [%s]\n", filename, to);
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Emailed data to [%s]\n", to);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed data to [%s]\n", to);
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
@@ -2072,7 +2072,7 @@ static void js_parse_and_execute(switch_core_session *session, char *input_code)
|
||||
JS_SetPrivate(cx, javascript_global_object, session);
|
||||
}
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Allocation Error!\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Allocation Error!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2128,7 +2128,7 @@ static void js_thread_launch(char *text)
|
||||
|
||||
if (!module_pool) {
|
||||
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "OH OH no pool\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OH OH no pool\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2191,8 +2191,6 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_modul
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*interface = &spidermonkey_module_interface;
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Hello World!\n");
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
*
|
||||
* mod_console.c -- Console Logger
|
||||
*
|
||||
*/
|
||||
#include <switch.h>
|
||||
|
||||
static const char modname[] = "mod_console";
|
||||
|
||||
static switch_loadable_module_interface console_module_interface = {
|
||||
/*.module_name */ modname,
|
||||
/*.endpoint_interface */ NULL,
|
||||
/*.timer_interface */ NULL,
|
||||
/*.dialplan_interface */ NULL,
|
||||
/*.codec_interface */ NULL,
|
||||
/*.application_interface */ NULL,
|
||||
/*.api_interface */ NULL,
|
||||
/*.file_interface */ NULL,
|
||||
/*.speech_interface */ NULL,
|
||||
/*.directory_interface */ NULL
|
||||
};
|
||||
|
||||
static switch_status switch_console_logger(const char *data, switch_log_level level)
|
||||
{
|
||||
FILE *handle;
|
||||
|
||||
if ((handle = switch_core_data_channel(SWITCH_CHANNEL_ID_LOG))) {
|
||||
fprintf(handle, data);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MOD_DECLARE(switch_status) switch_module_load(const switch_loadable_module_interface **interface, char *filename)
|
||||
{
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*interface = &console_module_interface;
|
||||
|
||||
/* setup my logger function */
|
||||
switch_log_bind_logger(switch_console_logger, SWITCH_LOG_DEBUG);
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user