[Freeswitch-branches] [commit] r11117 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax
FreeSWITCH SVN
gmaruzz at freeswitch.org
Sun Jan 11 01:03:00 PST 2009
Author: gmaruzz
Date: Sun Jan 11 03:03:00 2009
New Revision: 11117
Log:
skypiax: cosmetics
Modified:
freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c Sun Jan 11 03:03:00 2009
@@ -23,17 +23,10 @@
switch_mutex_t *mutex;
} globals;
-/*************************************************/
-/*************************************************/
-/*************************************************/
int option_debug = 100;
switch_endpoint_interface_t *skypiax_endpoint_interface;
switch_memory_pool_t *skypiax_module_pool = NULL;
int running = 1;
-//switch_core_session_t *global_session = NULL;
-/*************************************************/
-/*************************************************/
-/*************************************************/
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
@@ -171,7 +164,6 @@
if (strlen(p->skype_call_id)) {
//switch_thread_cond_signal(tech_pvt->cond);
WARNINGA("hanging up skype call: %s\n", SKYPIAX_P_LOG, p->skype_call_id);
- //sprintf(msg_to_skype, "SET CALL %s STATUS FINISHED", p->skype_call_id);
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", p->skype_call_id);
skypiax_skype_write(p, msg_to_skype);
}
@@ -315,8 +307,6 @@
} else {
switch_set_flag_locked(tech_pvt, TFLAG_VOICE);
- //ERRORA( "skypiax_skypeaudio_read SUCCESS\n");
-
}
while (switch_test_flag(tech_pvt, TFLAG_IO)) {
@@ -330,7 +320,6 @@
DEBUGA_SKYPE("CHANNEL READ FRAME not IO\n", SKYPIAX_P_LOG);
return SWITCH_STATUS_FALSE;
}
- //DEBUGA_SKYPE( "============>\n");
if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) {
switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
@@ -375,8 +364,6 @@
unsigned int sent;
struct skypiax_interface *p = NULL;
- //DEBUGA_SKYPE( "CHANNEL WRITE FRAME\n");
-
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -397,7 +384,6 @@
#endif
sent = frame->datalen;
- //DEBUGA_SKYPE("CLI PIPE to write %d\n", SKYPIAX_P_LOG, sent);
#ifdef WIN32
switch_file_write(p->audioskypepipe[1], frame->data, &sent);
#else /* WIN32 */
@@ -405,12 +391,9 @@
#endif /* WIN32 */
if (sent != frame->datalen && sent != -1) {
DEBUGA_SKYPE("CLI PIPE write %d\n", SKYPIAX_P_LOG, sent);
- } else {
- //NOTICA("CLI PIPE write %d\n", SKYPIAX_P_LOG, sent);
}
return SWITCH_STATUS_SUCCESS;
-
}
static switch_status_t channel_answer_channel(switch_core_session_t * session)
@@ -450,7 +433,6 @@
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_ANSWER:
{
- //WARNINGA("TO BE ANSWERED! \n", SKYPIAX_P_LOG);
DEBUGA_SKYPE("MSG_ID=%d, TO BE ANSWERED!\n", SKYPIAX_P_LOG, msg->message_id);
channel_answer_channel(session);
}
@@ -561,8 +543,6 @@
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
}
- //tech_pvt->p = &globals.SKYPIAX_INTERFACES[19]; //FIXME
- //globals.SKYPIAX_INTERFACES[19].tech_pvt = tech_pvt; //FIXME
channel = switch_core_session_get_channel(*new_session);
skypiax_tech_init(tech_pvt, *new_session, NULL);
} else {
@@ -600,12 +580,10 @@
switch_channel_set_flag(channel, CF_OUTBOUND);
switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
switch_channel_set_state(channel, CS_INIT);
- //switch_channel_mark_pre_answered(channel);
return SWITCH_CAUSE_SUCCESS;
}
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
-
}
/*!
@@ -627,9 +605,7 @@
while (forever) {
if (!running)
break;
- //switch_sleep(1000); //cicopet
res = skypiax_skype_read(p);
- //if (res == CALLFLOW_INCOMING_HANGUP && p->interface_state != SKYPIAX_STATE_DOWN)
if (res == CALLFLOW_INCOMING_HANGUP) {
switch_core_session_t *session = NULL;
private_t *tech_pvt = NULL;
@@ -643,20 +619,14 @@
if (session) {
channel = switch_core_session_get_channel(session);
- //DEBUGA_SKYPE("before channel_on_hangup\n", SKYPIAX_P_LOG);
-
if (channel) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
- //DEBUGA_SKYPE("after channel_on_hangup\n", SKYPIAX_P_LOG);
-
} else {
ERRORA("no channel?\n", SKYPIAX_P_LOG);
}
-
} else {
ERRORA("no session?\n", SKYPIAX_P_LOG);
}
-
} else {
ERRORA("no tech_pvt?\n", SKYPIAX_P_LOG);
}
@@ -664,12 +634,8 @@
tech_pvt->session = NULL; //FIXME
}
}
-
- //if (option_debug > 10) {
DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
- //}
return NULL;
-
}
static switch_status_t load_config(void)
@@ -875,8 +841,6 @@
globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port = atoi(tcp_cli_port);
globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port = atoi(tcp_srv_port);
#endif /* WIN32 */
- //switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port, tcp_cli_port);
- //switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port, tcp_srv_port);
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].X11_display,
X11_display);
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].skype_user,
@@ -919,7 +883,6 @@
NOTICA("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
switch_threadattr_create(&do_skype_thd_attr, skypiax_module_pool);
- //switch_threadattr_detach_set(do_skype_thd_attr, 1);
switch_threadattr_stacksize_set(do_skype_thd_attr, SWITCH_THREAD_STACKSIZE);
switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].
skypiax_do_skype_thread_thread, do_skype_thd_attr,
@@ -930,7 +893,6 @@
switch_threadattr_create(&skypiax_do_controldev_thread_thd_attr,
skypiax_module_pool);
- //switch_threadattr_detach_set(skypiax_do_controldev_thread_thd_attr, 1);
switch_threadattr_stacksize_set(skypiax_do_controldev_thread_thd_attr,
SWITCH_THREAD_STACKSIZE);
switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].
@@ -945,8 +907,9 @@
skypiax_skypeaudio_init(&globals.SKYPIAX_INTERFACES[interface_id]);
while (globals.SKYPIAX_INTERFACES[interface_id].AsteriskHandlesAst.
- api_connected == 0)
+ api_connected == 0) {
switch_sleep(1000);
+ }
NOTICA("STARTED interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
} else {
@@ -985,7 +948,6 @@
skypiax_module_pool = pool;
memset(&globals, '\0', sizeof(globals));
- //memset(globals.SKYPIAX_INTERFACES, '\0', sizeof(globals.SKYPIAX_INTERFACES));
load_config();
@@ -1001,13 +963,6 @@
return SWITCH_STATUS_SUCCESS;
}
-/*
-SWITCH_MODULE_RUNTIME_FUNCTION(mod_skypiax_runtime)
-{
- return SWITCH_STATUS_TERM;
-}
-*/
-
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown)
{
int x = 100;
@@ -1016,8 +971,6 @@
unsigned int howmany = 8;
int interface_id;
- //p = &globals.SKYPIAX_INTERFACES[2];
-
running = 0;
for (interface_id = 0; interface_id < SKYPIAX_MAX_INTERFACES; interface_id++) {
More information about the Freeswitch-branches
mailing list