mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-16 20:02:47 +00:00
MODSKYPIAX-35 (part1)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14444 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
2faaeb00a5
commit
1c3978a4e7
@ -128,34 +128,26 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, globals.context);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_destination, globals.destination);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string,
|
||||
globals.codec_rates_string);
|
||||
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string);
|
||||
|
||||
/* BEGIN: Changes here */
|
||||
static switch_status_t interface_exists(char *the_interface);
|
||||
static switch_status_t remove_interface(char *the_interface);
|
||||
/* END: Changes here */
|
||||
|
||||
static switch_status_t channel_on_init(switch_core_session_t * session);
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t * session);
|
||||
static switch_status_t channel_on_destroy(switch_core_session_t * session);
|
||||
static switch_status_t channel_on_routing(switch_core_session_t * session);
|
||||
static switch_status_t channel_on_exchange_media(switch_core_session_t * session);
|
||||
static switch_status_t channel_on_soft_execute(switch_core_session_t * session);
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t * session,
|
||||
switch_event_t * var_event,
|
||||
switch_caller_profile_t *
|
||||
outbound_profile,
|
||||
switch_core_session_t ** new_session,
|
||||
switch_memory_pool_t ** pool,
|
||||
switch_originate_flag_t flags);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t * session,
|
||||
switch_frame_t ** frame, switch_io_flag_t flags,
|
||||
int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t * session,
|
||||
switch_frame_t * frame, switch_io_flag_t flags,
|
||||
int stream_id);
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t * session, int sig);
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_destroy(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_routing(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_event_t *var_event,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
|
||||
|
||||
static switch_status_t skypiax_codec(private_t * tech_pvt, int sample_rate, int codec_ms)
|
||||
{
|
||||
@ -163,16 +155,14 @@ static switch_status_t skypiax_codec(private_t * tech_pvt, int sample_rate, int
|
||||
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->read_codec, "L16", NULL, sample_rate, codec_ms, 1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
ERRORA("Can't load codec?\n", SKYPIAX_P_LOG);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (switch_core_codec_init
|
||||
(&tech_pvt->write_codec, "L16", NULL, sample_rate, codec_ms, 1,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||
ERRORA("Can't load codec?\n", SKYPIAX_P_LOG);
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
@ -192,18 +182,15 @@ static switch_status_t skypiax_codec(private_t * tech_pvt, int sample_rate, int
|
||||
|
||||
}
|
||||
|
||||
void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t * session)
|
||||
void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t *session)
|
||||
{
|
||||
|
||||
tech_pvt->read_frame.data = tech_pvt->databuf;
|
||||
tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
|
||||
switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED,
|
||||
switch_core_session_get_pool(session));
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED,
|
||||
switch_core_session_get_pool(session));
|
||||
switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
|
||||
switch_core_session_set_private(session, tech_pvt);
|
||||
switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(session),
|
||||
sizeof(tech_pvt->session_uuid_str));
|
||||
switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(session), sizeof(tech_pvt->session_uuid_str));
|
||||
if (skypiax_codec(tech_pvt, SAMPLERATE_SKYPIAX, 20) != SWITCH_STATUS_SUCCESS) {
|
||||
ERRORA("skypiax_codec FAILED\n", SKYPIAX_P_LOG);
|
||||
} else {
|
||||
@ -218,13 +205,13 @@ static switch_status_t interface_exists(char *the_interface)
|
||||
int i;
|
||||
int interface_id;
|
||||
|
||||
if ( *the_interface == '#') { /* look by interface id or interface name */
|
||||
if (*the_interface == '#') { /* look by interface id or interface name */
|
||||
the_interface++;
|
||||
switch_assert(the_interface);
|
||||
interface_id = atoi(the_interface);
|
||||
|
||||
/* take a number as interface id */
|
||||
if ( interface_id > 0 || (interface_id == 0 && strcmp(the_interface, "0") == 0 )) {
|
||||
if (interface_id > 0 || (interface_id == 0 && strcmp(the_interface, "0") == 0)) {
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[interface_id].name)) {
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@ -262,12 +249,12 @@ static switch_status_t remove_interface(char *the_interface)
|
||||
//running = 0;
|
||||
|
||||
|
||||
if ( *the_interface == '#') { /* remove by interface id or interface name */
|
||||
if (*the_interface == '#') { /* remove by interface id or interface name */
|
||||
the_interface++;
|
||||
switch_assert(the_interface);
|
||||
interface_id = atoi(the_interface);
|
||||
|
||||
if ( interface_id > 0 || (interface_id == 0 && strcmp(the_interface, "0") == 0 )) {
|
||||
if (interface_id > 0 || (interface_id == 0 && strcmp(the_interface, "0") == 0)) {
|
||||
/* take a number as interface id */
|
||||
tech_pvt = &globals.SKYPIAX_INTERFACES[interface_id];
|
||||
} else {
|
||||
@ -289,8 +276,7 @@ static switch_status_t remove_interface(char *the_interface)
|
||||
}
|
||||
|
||||
if (!tech_pvt) {
|
||||
DEBUGA_SKYPE("interface '%s' does not exist\n", SKYPIAX_P_LOG,
|
||||
the_interface);
|
||||
DEBUGA_SKYPE("interface '%s' does not exist\n", SKYPIAX_P_LOG, the_interface);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -299,7 +285,7 @@ static switch_status_t remove_interface(char *the_interface)
|
||||
goto end;
|
||||
}
|
||||
|
||||
globals.SKYPIAX_INTERFACES[interface_id].running=0;
|
||||
globals.SKYPIAX_INTERFACES[interface_id].running = 0;
|
||||
|
||||
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
|
||||
#ifdef WIN32
|
||||
@ -312,15 +298,12 @@ static switch_status_t remove_interface(char *the_interface)
|
||||
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
|
||||
#ifdef WIN32
|
||||
if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypiax_api_thread_func die
|
||||
DEBUGA_SKYPE
|
||||
("got FALSE here, thread probably was already dead. GetLastError returned: %d\n",
|
||||
SKYPIAX_P_LOG, GetLastError());
|
||||
DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPIAX_P_LOG, GetLastError());
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
|
||||
}
|
||||
#else
|
||||
XEvent e;
|
||||
Atom atom1 =
|
||||
XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
|
||||
Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
|
||||
memset(&e, 0, sizeof(e));
|
||||
e.xclient.type = ClientMessage;
|
||||
e.xclient.message_type = atom1; /* leading message */
|
||||
@ -339,17 +322,15 @@ static switch_status_t remove_interface(char *the_interface)
|
||||
}
|
||||
|
||||
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
|
||||
switch_thread_join(&status,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread);
|
||||
switch_thread_join(&status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread);
|
||||
}
|
||||
|
||||
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
|
||||
switch_thread_join(&status,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
|
||||
switch_thread_join(&status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
|
||||
}
|
||||
|
||||
switch_mutex_lock(globals.mutex);
|
||||
if(globals.sk_console == &globals.SKYPIAX_INTERFACES[interface_id]){
|
||||
if (globals.sk_console == &globals.SKYPIAX_INTERFACES[interface_id]) {
|
||||
DEBUGA_SKYPE("interface '%s' no more console\n", SKYPIAX_P_LOG, the_interface);
|
||||
globals.sk_console = NULL;
|
||||
} else {
|
||||
@ -359,10 +340,9 @@ static switch_status_t remove_interface(char *the_interface)
|
||||
globals.real_interfaces--;
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
|
||||
DEBUGA_SKYPE("interface '%s' deleted successfully\n", SKYPIAX_P_LOG,
|
||||
the_interface);
|
||||
globals.SKYPIAX_INTERFACES[interface_id].running=1;
|
||||
end:
|
||||
DEBUGA_SKYPE("interface '%s' deleted successfully\n", SKYPIAX_P_LOG, the_interface);
|
||||
globals.SKYPIAX_INTERFACES[interface_id].running = 1;
|
||||
end:
|
||||
//running = 1;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@ -374,7 +354,7 @@ end:
|
||||
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
|
||||
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
|
||||
*/
|
||||
static switch_status_t channel_on_init(switch_core_session_t * session)
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt = NULL;
|
||||
@ -400,14 +380,10 @@ static switch_status_t channel_on_init(switch_core_session_t * session)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_destroy(switch_core_session_t * session)
|
||||
static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
||||
{
|
||||
//switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
//channel = switch_core_session_get_channel(session);
|
||||
//switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
if (tech_pvt) {
|
||||
@ -418,12 +394,13 @@ static switch_status_t channel_on_destroy(switch_core_session_t * session)
|
||||
if (switch_core_codec_ready(&tech_pvt->write_codec)) {
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
}
|
||||
switch_core_session_set_private(session, NULL);
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t * session)
|
||||
static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
@ -445,8 +422,8 @@ static switch_status_t channel_on_hangup(switch_core_session_t * session)
|
||||
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id);
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
}
|
||||
|
||||
memset(tech_pvt->session_uuid_str, '\0', sizeof(tech_pvt->session_uuid_str));
|
||||
//memset(tech_pvt->session_uuid_str, '\0', sizeof(tech_pvt->session_uuid_str));
|
||||
*tech_pvt->session_uuid_str = '\0';
|
||||
DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
|
||||
switch_mutex_lock(globals.mutex);
|
||||
globals.calls--;
|
||||
@ -458,7 +435,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t * session)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_routing(switch_core_session_t * session)
|
||||
static switch_status_t channel_on_routing(switch_core_session_t *session)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
@ -474,7 +451,7 @@ static switch_status_t channel_on_routing(switch_core_session_t * session)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_execute(switch_core_session_t * session)
|
||||
static switch_status_t channel_on_execute(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
switch_channel_t *channel = NULL;
|
||||
@ -491,7 +468,7 @@ static switch_status_t channel_on_execute(switch_core_session_t * session)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t * session, int sig)
|
||||
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
@ -504,15 +481,13 @@ static switch_status_t channel_kill_channel(switch_core_session_t * session, int
|
||||
|
||||
switch (sig) {
|
||||
case SWITCH_SIG_KILL:
|
||||
DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_KILL\n", SKYPIAX_P_LOG,
|
||||
switch_channel_get_name(channel));
|
||||
DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_KILL\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_IO);
|
||||
switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
|
||||
break;
|
||||
case SWITCH_SIG_BREAK:
|
||||
DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPIAX_P_LOG,
|
||||
switch_channel_get_name(channel));
|
||||
DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
|
||||
switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
|
||||
break;
|
||||
default:
|
||||
@ -522,22 +497,21 @@ static switch_status_t channel_kill_channel(switch_core_session_t * session, int
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_exchange_media(switch_core_session_t * session)
|
||||
static switch_status_t channel_on_exchange_media(switch_core_session_t *session)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
DEBUGA_SKYPE("CHANNEL LOOPBACK\n", SKYPIAX_P_LOG);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_soft_execute(switch_core_session_t * session)
|
||||
static switch_status_t channel_on_soft_execute(switch_core_session_t *session)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
DEBUGA_SKYPE("CHANNEL TRANSMIT\n", SKYPIAX_P_LOG);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_send_dtmf(switch_core_session_t * session,
|
||||
const switch_dtmf_t * dtmf)
|
||||
static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
|
||||
{
|
||||
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
@ -549,9 +523,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t * session,
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_read_frame(switch_core_session_t * session,
|
||||
switch_frame_t ** frame, switch_io_flag_t flags,
|
||||
int stream_id)
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
@ -562,6 +534,12 @@ static switch_status_t channel_read_frame(switch_core_session_t * session,
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!switch_channel_ready(channel) || !switch_test_flag(tech_pvt, TFLAG_IO)) {
|
||||
ERRORA("CIAPA \n", SKYPIAX_P_LOG);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
tech_pvt->read_frame.flags = SFF_NONE;
|
||||
*frame = NULL;
|
||||
|
||||
@ -608,7 +586,7 @@ static switch_status_t channel_read_frame(switch_core_session_t * session,
|
||||
DEBUGA_SKYPE("CHANNEL READ FALSE\n", SKYPIAX_P_LOG);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
||||
cng:
|
||||
cng:
|
||||
data = (switch_byte_t *) tech_pvt->read_frame.data;
|
||||
data[0] = 65;
|
||||
data[1] = 0;
|
||||
@ -619,9 +597,7 @@ cng:
|
||||
|
||||
}
|
||||
|
||||
static switch_status_t channel_write_frame(switch_core_session_t * session,
|
||||
switch_frame_t * frame, switch_io_flag_t flags,
|
||||
int stream_id)
|
||||
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
|
||||
{
|
||||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
@ -633,7 +609,7 @@ static switch_status_t channel_write_frame(switch_core_session_t * session,
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
|
||||
if (!switch_channel_ready(channel) || !switch_test_flag(tech_pvt, TFLAG_IO)) {
|
||||
ERRORA("CIAPA \n", SKYPIAX_P_LOG);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@ -656,7 +632,7 @@ static switch_status_t channel_write_frame(switch_core_session_t * session,
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_answer_channel(switch_core_session_t * session)
|
||||
static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
||||
{
|
||||
private_t *tech_pvt;
|
||||
switch_channel_t *channel = NULL;
|
||||
@ -672,8 +648,7 @@ static switch_status_t channel_answer_channel(switch_core_session_t * session)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_receive_message(switch_core_session_t * session,
|
||||
switch_core_session_message_t * msg)
|
||||
static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt;
|
||||
@ -701,8 +676,7 @@ static switch_status_t channel_receive_message(switch_core_session_t * session,
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_receive_event(switch_core_session_t * session,
|
||||
switch_event_t * event)
|
||||
static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event)
|
||||
{
|
||||
struct private_object *tech_pvt = switch_core_session_get_private(session);
|
||||
char *body = switch_event_get_body(event);
|
||||
@ -742,28 +716,21 @@ switch_io_routines_t skypiax_io_routines = {
|
||||
/*.receive_event */ channel_receive_event
|
||||
};
|
||||
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t * session,
|
||||
switch_event_t * var_event,
|
||||
switch_caller_profile_t *
|
||||
outbound_profile,
|
||||
switch_core_session_t ** new_session,
|
||||
switch_memory_pool_t ** pool,
|
||||
switch_originate_flag_t flags)
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
|
||||
switch_event_t *var_event,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
|
||||
{
|
||||
if ((*new_session =
|
||||
switch_core_session_request(skypiax_endpoint_interface,
|
||||
SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
|
||||
private_t *tech_pvt;
|
||||
if ((*new_session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
|
||||
private_t *tech_pvt = NULL;
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
char *rdest;
|
||||
int found = 0;
|
||||
char interface_name[256];
|
||||
|
||||
switch_core_session_add_stream(*new_session, NULL);
|
||||
|
||||
if ((tech_pvt =
|
||||
(private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) != 0) {
|
||||
int found = 0;
|
||||
char interface_name[256];
|
||||
|
||||
if (!switch_strlen_zero(outbound_profile->destination_number)) {
|
||||
int i;
|
||||
@ -778,33 +745,30 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t * sess
|
||||
/* we've been asked for the "ANY" interface, let's find the first idle interface */
|
||||
DEBUGA_SKYPE("Finding one available skype interface\n", SKYPIAX_P_LOG);
|
||||
tech_pvt = find_available_skypiax_interface(NULL);
|
||||
if (tech_pvt) found = 1;
|
||||
} else if(strncmp("RR", interface_name, strlen(interface_name)) == 0) {
|
||||
if (tech_pvt)
|
||||
found = 1;
|
||||
} else if (strncmp("RR", interface_name, strlen(interface_name)) == 0) {
|
||||
/* Find the first idle interface using Round Robin */
|
||||
DEBUGA_SKYPE("Finding one available skype interface RR\n", SKYPIAX_P_LOG);
|
||||
tech_pvt = find_available_skypiax_interface_rr();
|
||||
if (tech_pvt) found = 1;
|
||||
if (tech_pvt)
|
||||
found = 1;
|
||||
}
|
||||
|
||||
for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
|
||||
/* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[i].name)
|
||||
&&
|
||||
(strncmp
|
||||
(globals.SKYPIAX_INTERFACES[i].name, interface_name,
|
||||
strlen(interface_name)) == 0)) {
|
||||
&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, interface_name, strlen(interface_name)) == 0)) {
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[i].session_uuid_str)) {
|
||||
DEBUGA_SKYPE
|
||||
("globals.SKYPIAX_INTERFACES[%d].name=|||%s||| session_uuid_str=|||%s||| is BUSY\n",
|
||||
SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name,
|
||||
globals.SKYPIAX_INTERFACES[i].session_uuid_str);
|
||||
SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name, globals.SKYPIAX_INTERFACES[i].session_uuid_str);
|
||||
switch_core_session_destroy(new_session);
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
return SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE;
|
||||
}
|
||||
|
||||
DEBUGA_SKYPE("globals.SKYPIAX_INTERFACES[%d].name=|||%s|||?\n", SKYPIAX_P_LOG,
|
||||
i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
DEBUGA_SKYPE("globals.SKYPIAX_INTERFACES[%d].name=|||%s|||?\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
tech_pvt = &globals.SKYPIAX_INTERFACES[i];
|
||||
found = 1;
|
||||
break;
|
||||
@ -819,20 +783,15 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t * sess
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
ERRORA("Doh! no matching interface for |||%s|||?\n", SKYPIAX_P_LOG,
|
||||
interface_name);
|
||||
ERRORA("Doh! no matching interface for |||%s|||?\n", SKYPIAX_P_LOG, interface_name);
|
||||
switch_core_session_destroy(new_session);
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
|
||||
}
|
||||
|
||||
channel = switch_core_session_get_channel(*new_session);
|
||||
skypiax_tech_init(tech_pvt, *new_session);
|
||||
} else {
|
||||
ERRORA("Hey where is my memory pool?\n", SKYPIAX_P_LOG);
|
||||
switch_core_session_destroy(new_session);
|
||||
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
}
|
||||
|
||||
|
||||
if (outbound_profile) {
|
||||
char name[128];
|
||||
@ -855,9 +814,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t * sess
|
||||
|
||||
skypiax_call(tech_pvt, rdest, 30);
|
||||
|
||||
switch_copy_string(tech_pvt->session_uuid_str,
|
||||
switch_core_session_get_uuid(*new_session),
|
||||
sizeof(tech_pvt->session_uuid_str));
|
||||
switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(*new_session), sizeof(tech_pvt->session_uuid_str));
|
||||
caller_profile = tech_pvt->caller_profile;
|
||||
caller_profile->destination_number = rdest;
|
||||
|
||||
@ -875,17 +832,16 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t * sess
|
||||
* \brief This thread runs during a call, and monitor the interface for signaling, like hangup, caller id, etc most of signaling is handled inside the skypiax_signaling_read function
|
||||
*
|
||||
*/
|
||||
static void *SWITCH_THREAD_FUNC skypiax_signaling_thread_func(switch_thread_t * thread,
|
||||
void *obj)
|
||||
static void *SWITCH_THREAD_FUNC skypiax_signaling_thread_func(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
private_t *tech_pvt = obj;
|
||||
int res;
|
||||
int forever = 1;
|
||||
|
||||
if (!tech_pvt) return NULL;
|
||||
if (!tech_pvt)
|
||||
return NULL;
|
||||
|
||||
DEBUGA_SKYPE("In skypiax_signaling_thread_func: started, p=%p\n", SKYPIAX_P_LOG,
|
||||
(void *) tech_pvt);
|
||||
DEBUGA_SKYPE("In skypiax_signaling_thread_func: started, p=%p\n", SKYPIAX_P_LOG, (void *) tech_pvt);
|
||||
|
||||
while (forever) {
|
||||
if (!(running && tech_pvt->running))
|
||||
@ -914,7 +870,8 @@ static void *SWITCH_THREAD_FUNC skypiax_signaling_thread_func(switch_thread_t *
|
||||
DEBUGA_SKYPE("no session\n", SKYPIAX_P_LOG);
|
||||
}
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
memset(tech_pvt->session_uuid_str, '\0', sizeof(tech_pvt->session_uuid_str));
|
||||
*tech_pvt->session_uuid_str = '\0';
|
||||
//memset(tech_pvt->session_uuid_str, '\0', sizeof(tech_pvt->session_uuid_str));
|
||||
} else {
|
||||
ERRORA("no tech_pvt?\n", SKYPIAX_P_LOG);
|
||||
}
|
||||
@ -972,16 +929,11 @@ static switch_status_t load_config(int reload_type)
|
||||
} else if (!strcmp(var, "codec-prefs")) {
|
||||
set_global_codec_string(val);
|
||||
DEBUGA_SKYPE("globals.codec_string=%s\n", SKYPIAX_P_LOG, globals.codec_string);
|
||||
globals.codec_order_last =
|
||||
switch_separate_string(globals.codec_string, ',', globals.codec_order,
|
||||
SWITCH_MAX_CODECS);
|
||||
globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS);
|
||||
} else if (!strcmp(var, "codec-rates")) {
|
||||
set_global_codec_rates_string(val);
|
||||
DEBUGA_SKYPE("globals.codec_rates_string=%s\n", SKYPIAX_P_LOG,
|
||||
globals.codec_rates_string);
|
||||
globals.codec_rates_last =
|
||||
switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates,
|
||||
SWITCH_MAX_CODECS);
|
||||
DEBUGA_SKYPE("globals.codec_rates_string=%s\n", SKYPIAX_P_LOG, globals.codec_rates_string);
|
||||
globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS);
|
||||
}
|
||||
|
||||
}
|
||||
@ -990,8 +942,7 @@ static switch_status_t load_config(int reload_type)
|
||||
if ((interfaces = switch_xml_child(cfg, "per_interface_settings"))) {
|
||||
int i = 0;
|
||||
|
||||
for (myinterface = switch_xml_child(interfaces, "interface"); myinterface;
|
||||
myinterface = myinterface->next) {
|
||||
for (myinterface = switch_xml_child(interfaces, "interface"); myinterface; myinterface = myinterface->next) {
|
||||
char *id = (char *) switch_xml_attr(myinterface, "id");
|
||||
char *name = (char *) switch_xml_attr(myinterface, "name");
|
||||
char *context = "default";
|
||||
@ -1140,54 +1091,42 @@ static switch_status_t load_config(int reload_type)
|
||||
}
|
||||
DEBUGA_SKYPE("CONFIGURING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
|
||||
#ifdef WIN32
|
||||
globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port =
|
||||
(unsigned short) atoi(tcp_cli_port);
|
||||
globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port =
|
||||
(unsigned short) atoi(tcp_srv_port);
|
||||
globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port = (unsigned short) atoi(tcp_cli_port);
|
||||
globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port = (unsigned short) atoi(tcp_srv_port);
|
||||
#else /* WIN32 */
|
||||
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].X11_display,
|
||||
X11_display);
|
||||
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].skype_user,
|
||||
skype_user);
|
||||
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].X11_display, X11_display);
|
||||
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].skype_user, skype_user);
|
||||
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].context, context);
|
||||
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].dialplan, dialplan);
|
||||
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].destination,
|
||||
destination);
|
||||
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].destination, destination);
|
||||
switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].context, context);
|
||||
|
||||
DEBUGA_SKYPE
|
||||
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].X11_display=%s\n",
|
||||
SKYPIAX_P_LOG, interface_id,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].X11_display);
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].X11_display);
|
||||
DEBUGA_SKYPE
|
||||
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].skype_user=%s\n",
|
||||
SKYPIAX_P_LOG, interface_id,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skype_user);
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
|
||||
DEBUGA_SKYPE
|
||||
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port=%d\n",
|
||||
SKYPIAX_P_LOG, interface_id,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port);
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].tcp_cli_port);
|
||||
DEBUGA_SKYPE
|
||||
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port=%d\n",
|
||||
SKYPIAX_P_LOG, interface_id,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port);
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].tcp_srv_port);
|
||||
DEBUGA_SKYPE("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].name=%s\n",
|
||||
SKYPIAX_P_LOG, interface_id,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].name);
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].name);
|
||||
DEBUGA_SKYPE
|
||||
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].context=%s\n",
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].context);
|
||||
DEBUGA_SKYPE
|
||||
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].dialplan=%s\n",
|
||||
SKYPIAX_P_LOG, interface_id,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].dialplan);
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].dialplan);
|
||||
DEBUGA_SKYPE
|
||||
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].destination=%s\n",
|
||||
SKYPIAX_P_LOG, interface_id,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].destination);
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].destination);
|
||||
DEBUGA_SKYPE
|
||||
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].context=%s\n",
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].context);
|
||||
@ -1196,20 +1135,15 @@ static switch_status_t load_config(int reload_type)
|
||||
switch_threadattr_create(&skypiax_api_thread_attr, skypiax_module_pool);
|
||||
switch_threadattr_stacksize_set(skypiax_api_thread_attr, SWITCH_THREAD_STACKSIZE);
|
||||
switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread,
|
||||
skypiax_api_thread_attr, skypiax_do_skypeapi_thread,
|
||||
&globals.SKYPIAX_INTERFACES[interface_id],
|
||||
skypiax_module_pool);
|
||||
skypiax_api_thread_attr, skypiax_do_skypeapi_thread, &globals.SKYPIAX_INTERFACES[interface_id], skypiax_module_pool);
|
||||
|
||||
switch_sleep(100000);
|
||||
|
||||
switch_threadattr_create(&skypiax_signaling_thread_attr, skypiax_module_pool);
|
||||
switch_threadattr_stacksize_set(skypiax_signaling_thread_attr,
|
||||
SWITCH_THREAD_STACKSIZE);
|
||||
switch_threadattr_stacksize_set(skypiax_signaling_thread_attr, SWITCH_THREAD_STACKSIZE);
|
||||
switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].
|
||||
skypiax_signaling_thread, skypiax_signaling_thread_attr,
|
||||
skypiax_signaling_thread_func,
|
||||
&globals.SKYPIAX_INTERFACES[interface_id],
|
||||
skypiax_module_pool);
|
||||
skypiax_signaling_thread_func, &globals.SKYPIAX_INTERFACES[interface_id], skypiax_module_pool);
|
||||
|
||||
switch_sleep(100000);
|
||||
|
||||
@ -1226,8 +1160,7 @@ static switch_status_t load_config(int reload_type)
|
||||
if (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected) {
|
||||
NOTICA
|
||||
("Found a running Skype client, connected to its SKYPE API for interface_id=%d, waiting 60 seconds for CURRENTUSERHANDLE==%s\n",
|
||||
SKYPIAX_P_LOG, interface_id,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skype_user);
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
|
||||
} else {
|
||||
ERRORA
|
||||
("Failed to connect to a SKYPE API for interface_id=%d, no SKYPE client running, please (re)start Skype client. Skypiax exiting\n",
|
||||
@ -1246,17 +1179,14 @@ static switch_status_t load_config(int reload_type)
|
||||
if (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.currentuserhandle) {
|
||||
WARNINGA
|
||||
("Interface_id=%d is now STARTED, the Skype client to which we are connected gave us the correct CURRENTUSERHANDLE (%s)\n",
|
||||
SKYPIAX_P_LOG, interface_id,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skype_user);
|
||||
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
|
||||
|
||||
skypiax_signaling_write(&globals.SKYPIAX_INTERFACES[interface_id],
|
||||
"SET AUTOAWAY OFF");
|
||||
skypiax_signaling_write(&globals.SKYPIAX_INTERFACES[interface_id], "SET AUTOAWAY OFF");
|
||||
} else {
|
||||
ERRORA
|
||||
("The Skype client to which we are connected FAILED to gave us CURRENTUSERHANDLE=%s, interface_id=%d FAILED to start. No Skype client logged in as '%s' has been found. Please (re)launch a Skype client logged in as '%s'. Skypiax exiting now\n",
|
||||
SKYPIAX_P_LOG, globals.SKYPIAX_INTERFACES[interface_id].skype_user,
|
||||
interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skype_user);
|
||||
interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
|
||||
running = 0;
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
switch_xml_free(xml);
|
||||
@ -1264,8 +1194,7 @@ static switch_status_t load_config(int reload_type)
|
||||
}
|
||||
|
||||
} else {
|
||||
ERRORA("interface id %d is higher than SKYPIAX_MAX_INTERFACES (%d)\n",
|
||||
SKYPIAX_P_LOG, interface_id, SKYPIAX_MAX_INTERFACES);
|
||||
ERRORA("interface id %d is higher than SKYPIAX_MAX_INTERFACES (%d)\n", SKYPIAX_P_LOG, interface_id, SKYPIAX_MAX_INTERFACES);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1278,20 +1207,13 @@ static switch_status_t load_config(int reload_type)
|
||||
|
||||
tech_pvt = &globals.SKYPIAX_INTERFACES[i];
|
||||
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].interface_id=%s\n",
|
||||
SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].interface_id);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].X11_display=%s\n",
|
||||
SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].X11_display);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].name=%s\n", SKYPIAX_P_LOG, i, i,
|
||||
globals.SKYPIAX_INTERFACES[i].name);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].context=%s\n", SKYPIAX_P_LOG, i,
|
||||
i, globals.SKYPIAX_INTERFACES[i].context);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].dialplan=%s\n", SKYPIAX_P_LOG,
|
||||
i, i, globals.SKYPIAX_INTERFACES[i].dialplan);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].destination=%s\n",
|
||||
SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].destination);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].context=%s\n", SKYPIAX_P_LOG, i,
|
||||
i, globals.SKYPIAX_INTERFACES[i].context);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].interface_id=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].interface_id);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].X11_display=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].X11_display);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].name=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].context=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].context);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].dialplan=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].dialplan);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].destination=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].destination);
|
||||
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].context=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].context);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1317,18 +1239,15 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypiax_load)
|
||||
}
|
||||
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
skypiax_endpoint_interface =
|
||||
switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
|
||||
skypiax_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
|
||||
skypiax_endpoint_interface->interface_name = "skypiax";
|
||||
skypiax_endpoint_interface->io_routines = &skypiax_io_routines;
|
||||
skypiax_endpoint_interface->state_handler = &skypiax_state_handlers;
|
||||
|
||||
if (running) {
|
||||
|
||||
SWITCH_ADD_API(commands_api_interface, "sk", "Skypiax console commands", sk_function,
|
||||
SK_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "skypiax", "Skypiax interface commands",
|
||||
skypiax_function, SKYPIAX_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "sk", "Skypiax console commands", sk_function, SK_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "skypiax", "Skypiax interface commands", skypiax_function, SKYPIAX_SYNTAX);
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@ -1360,15 +1279,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown)
|
||||
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
|
||||
#ifdef WIN32
|
||||
if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypiax_api_thread_func die
|
||||
DEBUGA_SKYPE
|
||||
("got FALSE here, thread probably was already dead. GetLastError returned: %d\n",
|
||||
SKYPIAX_P_LOG, GetLastError());
|
||||
DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPIAX_P_LOG, GetLastError());
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
|
||||
}
|
||||
#else
|
||||
XEvent e;
|
||||
Atom atom1 =
|
||||
XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN",
|
||||
Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN",
|
||||
False);
|
||||
memset(&e, 0, sizeof(e));
|
||||
e.xclient.type = ClientMessage;
|
||||
@ -1377,8 +1293,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown)
|
||||
e.xclient.window = tech_pvt->SkypiaxHandles.skype_win;
|
||||
e.xclient.format = 8;
|
||||
|
||||
XSendEvent(tech_pvt->SkypiaxHandles.disp, tech_pvt->SkypiaxHandles.win, False, 0,
|
||||
&e);
|
||||
XSendEvent(tech_pvt->SkypiaxHandles.disp, tech_pvt->SkypiaxHandles.win, False, 0, &e);
|
||||
XSync(tech_pvt->SkypiaxHandles.disp, False);
|
||||
#endif
|
||||
}
|
||||
@ -1387,13 +1302,10 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown)
|
||||
switch_yield(20000);
|
||||
}
|
||||
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
|
||||
switch_thread_join(&status,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].
|
||||
skypiax_signaling_thread);
|
||||
switch_thread_join(&status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread);
|
||||
}
|
||||
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread) {
|
||||
switch_thread_join(&status,
|
||||
globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
|
||||
switch_thread_join(&status, globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1434,8 +1346,7 @@ int dtmf_received(private_t * tech_pvt, char *value)
|
||||
if (!switch_channel_test_flag(channel, CF_BRIDGED)) {
|
||||
|
||||
switch_dtmf_t dtmf = { (char) value[0], switch_core_default_dtmf_duration(0) };
|
||||
DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit,
|
||||
switch_channel_get_name(channel));
|
||||
DEBUGA_SKYPE("received DTMF %c on channel %s\n", SKYPIAX_P_LOG, dtmf.digit, switch_channel_get_name(channel));
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
//FIXME: why sometimes DTMFs from here do not seems to be get by FS?
|
||||
switch_channel_queue_dtmf(channel, &dtmf);
|
||||
@ -1443,8 +1354,7 @@ int dtmf_received(private_t * tech_pvt, char *value)
|
||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||
} else {
|
||||
DEBUGA_SKYPE
|
||||
("received a DTMF on channel %s, but we're BRIDGED, so let's NOT relay it out of band\n",
|
||||
SKYPIAX_P_LOG, switch_channel_get_name(channel));
|
||||
("received a DTMF on channel %s, but we're BRIDGED, so let's NOT relay it out of band\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
|
||||
}
|
||||
} else {
|
||||
WARNINGA("received %c DTMF, but no channel?\n", SKYPIAX_P_LOG, value[0]);
|
||||
@ -1461,15 +1371,13 @@ int start_audio_threads(private_t * tech_pvt)
|
||||
switch_threadattr_create(&thd_attr, skypiax_module_pool);
|
||||
switch_threadattr_detach_set(thd_attr, 1);
|
||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||
switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypiax_do_tcp_srv_thread,
|
||||
tech_pvt, skypiax_module_pool);
|
||||
switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypiax_do_tcp_srv_thread, tech_pvt, skypiax_module_pool);
|
||||
DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
|
||||
|
||||
switch_threadattr_create(&thd_attr, skypiax_module_pool);
|
||||
switch_threadattr_detach_set(thd_attr, 1);
|
||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||
switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread,
|
||||
tech_pvt, skypiax_module_pool);
|
||||
switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread, tech_pvt, skypiax_module_pool);
|
||||
DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
|
||||
switch_sleep(100000);
|
||||
|
||||
@ -1481,9 +1389,7 @@ int new_inbound_channel(private_t * tech_pvt)
|
||||
switch_core_session_t *session = NULL;
|
||||
switch_channel_t *channel = NULL;
|
||||
|
||||
if ((session =
|
||||
switch_core_session_request(skypiax_endpoint_interface,
|
||||
SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
|
||||
if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
|
||||
switch_core_session_add_stream(session, NULL);
|
||||
channel = switch_core_session_get_channel(session);
|
||||
skypiax_tech_init(tech_pvt, session);
|
||||
@ -1491,9 +1397,7 @@ int new_inbound_channel(private_t * tech_pvt)
|
||||
if ((tech_pvt->caller_profile =
|
||||
switch_caller_profile_new(switch_core_session_get_pool(session), "skypiax",
|
||||
tech_pvt->dialplan, tech_pvt->callid_name,
|
||||
tech_pvt->callid_number, NULL, NULL, NULL, NULL,
|
||||
"mod_skypiax", tech_pvt->context,
|
||||
tech_pvt->destination)) != 0) {
|
||||
tech_pvt->callid_number, NULL, NULL, NULL, NULL, "mod_skypiax", tech_pvt->context, tech_pvt->destination)) != 0) {
|
||||
char name[128];
|
||||
//switch_snprintf(name, sizeof(name), "skypiax/%s/%s", tech_pvt->name, tech_pvt->caller_profile->destination_number);
|
||||
switch_snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
|
||||
@ -1540,7 +1444,7 @@ int remote_party_is_ringing(private_t * tech_pvt)
|
||||
|
||||
switch_core_session_rwunlock(session);
|
||||
|
||||
done:
|
||||
done:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1572,7 +1476,7 @@ int remote_party_is_early_media(private_t * tech_pvt)
|
||||
|
||||
switch_core_session_rwunlock(session);
|
||||
|
||||
done:
|
||||
done:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1603,7 +1507,7 @@ int outbound_channel_answered(private_t * tech_pvt)
|
||||
|
||||
switch_core_session_rwunlock(session);
|
||||
|
||||
done:
|
||||
done:
|
||||
DEBUGA_SKYPE("HERE!\n", SKYPIAX_P_LOG);
|
||||
|
||||
return 0;
|
||||
@ -1623,8 +1527,7 @@ private_t *find_available_skypiax_interface(private_t * tech_pvt)
|
||||
|
||||
tech_pvt2 = &globals.SKYPIAX_INTERFACES[i];
|
||||
skype_state = tech_pvt2->interface_state;
|
||||
DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPIAX_P_LOG, i,
|
||||
globals.SKYPIAX_INTERFACES[i].name, skype_state);
|
||||
DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name, skype_state);
|
||||
if ((tech_pvt ? strcmp(tech_pvt2->skype_user, tech_pvt->skype_user) : 1) && (SKYPIAX_STATE_DOWN == skype_state || SKYPIAX_STATE_RING == skype_state || 0 == skype_state)) { //(if we got tech_pvt NOT NULL) if user is NOT the same, and iface is idle
|
||||
found = 1;
|
||||
break;
|
||||
@ -1674,7 +1577,7 @@ private_t *find_available_skypiax_interface_rr(void)
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
return tech_pvt;
|
||||
}
|
||||
}// else {
|
||||
} // else {
|
||||
//DEBUGA_SKYPE("Skype interface: %d blank!! A hole here means we cannot hunt the last interface.\n", SKYPIAX_P_LOG, interface_id);
|
||||
//}
|
||||
}
|
||||
@ -1713,21 +1616,16 @@ SWITCH_STANDARD_API(sk_function)
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[i].session_uuid_str)) {
|
||||
stream->write_function(stream,
|
||||
"%c\t%d\t[%s]\tBUSY, session_uuid_str=|||%s|||\n",
|
||||
next_flag_char,
|
||||
i, globals.SKYPIAX_INTERFACES[i].name,
|
||||
globals.SKYPIAX_INTERFACES[i].session_uuid_str);
|
||||
next_flag_char, i, globals.SKYPIAX_INTERFACES[i].name, globals.SKYPIAX_INTERFACES[i].session_uuid_str);
|
||||
} else {
|
||||
stream->write_function(stream,
|
||||
"%c\t%d\t[%s]\tIDLE\n",
|
||||
next_flag_char,
|
||||
i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
stream->write_function(stream, "%c\t%d\t[%s]\tIDLE\n", next_flag_char, i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
}
|
||||
} else if(argc > 1 && !strcasecmp(argv[1], "full")) {
|
||||
} else if (argc > 1 && !strcasecmp(argv[1], "full")) {
|
||||
stream->write_function(stream, "%c\t%d\n", next_flag_char, i);
|
||||
}
|
||||
|
||||
}
|
||||
stream->write_function(stream, "\nTotal: %d\n", globals.real_interfaces - 1 );
|
||||
stream->write_function(stream, "\nTotal: %d\n", globals.real_interfaces - 1);
|
||||
|
||||
} else if (!strcasecmp(argv[0], "console")) {
|
||||
int i;
|
||||
@ -1737,23 +1635,18 @@ SWITCH_STANDARD_API(sk_function)
|
||||
for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
|
||||
/* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[i].name)
|
||||
&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, argv[1], strlen(argv[1])) ==
|
||||
0)) {
|
||||
&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, argv[1], strlen(argv[1])) == 0)) {
|
||||
globals.sk_console = &globals.SKYPIAX_INTERFACES[i];
|
||||
stream->write_function(stream,
|
||||
"sk console is now: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n",
|
||||
i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
stream->write_function(stream, "sk console is: |||%s|||\n",
|
||||
globals.sk_console->name);
|
||||
"sk console is now: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
stream->write_function(stream, "sk console is: |||%s|||\n", globals.sk_console->name);
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (!found)
|
||||
stream->write_function(stream,
|
||||
"ERROR: A Skypiax interface with name='%s' was not found\n",
|
||||
argv[1]);
|
||||
stream->write_function(stream, "ERROR: A Skypiax interface with name='%s' was not found\n", argv[1]);
|
||||
} else {
|
||||
|
||||
stream->write_function(stream, "-ERR Usage: sk console interface_name\n");
|
||||
@ -1790,7 +1683,7 @@ SWITCH_STANDARD_API(sk_function)
|
||||
else
|
||||
stream->write_function(stream, "sk console is NOT yet assigned\n");
|
||||
}
|
||||
end:
|
||||
end:
|
||||
switch_safe_free(mycmd);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@ -1825,18 +1718,14 @@ SWITCH_STANDARD_API(skypiax_function)
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[i].name)
|
||||
&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, argv[0], strlen(argv[0])) == 0)) {
|
||||
tech_pvt = &globals.SKYPIAX_INTERFACES[i];
|
||||
stream->write_function(stream,
|
||||
"Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n",
|
||||
i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
stream->write_function(stream, "Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (!found) {
|
||||
stream->write_function(stream,
|
||||
"ERROR: A Skypiax interface with name='%s' was not found\n",
|
||||
argv[0]);
|
||||
stream->write_function(stream, "ERROR: A Skypiax interface with name='%s' was not found\n", argv[0]);
|
||||
switch_safe_free(mycmd);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@ -1846,7 +1735,7 @@ SWITCH_STANDARD_API(skypiax_function)
|
||||
} else {
|
||||
stream->write_function(stream, "ERROR, usage: %s", SKYPIAX_SYNTAX);
|
||||
}
|
||||
end:
|
||||
end:
|
||||
switch_safe_free(mycmd);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@ -1900,13 +1789,11 @@ int skypiax_answer(private_t * tech_pvt, char *id, char *value)
|
||||
gettimeofday(&tech_pvt->answer_time, NULL);
|
||||
switch_copy_string(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
|
||||
switch_copy_string(tech_pvt->callid_number, value,
|
||||
sizeof(tech_pvt->callid_number) - 1);
|
||||
switch_copy_string(tech_pvt->callid_number, value, sizeof(tech_pvt->callid_number) - 1);
|
||||
|
||||
DEBUGA_SKYPE
|
||||
("NEW! name: %s, state: %d, value=%s, tech_pvt->callid_number=%s, tech_pvt->skype_user=%s\n",
|
||||
SKYPIAX_P_LOG, tech_pvt->name, tech_pvt->interface_state, value,
|
||||
tech_pvt->callid_number, tech_pvt->skype_user);
|
||||
SKYPIAX_P_LOG, tech_pvt->name, tech_pvt->interface_state, value, tech_pvt->callid_number, tech_pvt->skype_user);
|
||||
} else if (!tech_pvt || !tech_pvt->skype_call_id) {
|
||||
ERRORA("No Call ID?\n", SKYPIAX_P_LOG);
|
||||
} else {
|
||||
@ -1953,7 +1840,7 @@ int skypiax_transfer(private_t * tech_pvt, char *id, char *value)
|
||||
|
||||
if (!tech_pvt || !tech_pvt->skype_call_id || !strlen(tech_pvt->skype_call_id)) {
|
||||
/* we are not inside an active call */
|
||||
ERRORA("We're NO MORE in a call now %s\n", SKYPIAX_P_LOG, (tech_pvt && tech_pvt->skype_call_id) ? tech_pvt->skype_call_id : "" );
|
||||
ERRORA("We're NO MORE in a call now %s\n", SKYPIAX_P_LOG, (tech_pvt && tech_pvt->skype_call_id) ? tech_pvt->skype_call_id : "");
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
|
||||
} else {
|
||||
@ -1979,8 +1866,7 @@ int skypiax_transfer(private_t * tech_pvt, char *id, char *value)
|
||||
DEBUGA_SKYPE
|
||||
("FOUND (name=%s, giovatech->interface_state=%d != SKYPIAX_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->transfer_callid_number=%s == value=%s)\n",
|
||||
SKYPIAX_P_LOG, giovatech->name, giovatech->interface_state,
|
||||
giovatech->skype_user, tech_pvt->skype_user,
|
||||
giovatech->transfer_callid_number, value)
|
||||
giovatech->skype_user, tech_pvt->skype_user, giovatech->transfer_callid_number, value)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1999,18 +1885,14 @@ int skypiax_transfer(private_t * tech_pvt, char *id, char *value)
|
||||
|
||||
//FIXME write a timestamp here
|
||||
gettimeofday(&tech_pvt->transfer_time, NULL);
|
||||
switch_copy_string(tech_pvt->skype_transfer_call_id, id,
|
||||
sizeof(tech_pvt->skype_transfer_call_id) - 1);
|
||||
switch_copy_string(tech_pvt->skype_transfer_call_id, id, sizeof(tech_pvt->skype_transfer_call_id) - 1);
|
||||
|
||||
switch_copy_string(tech_pvt->transfer_callid_number, value,
|
||||
sizeof(tech_pvt->transfer_callid_number) - 1);
|
||||
switch_copy_string(tech_pvt->transfer_callid_number, value, sizeof(tech_pvt->transfer_callid_number) - 1);
|
||||
|
||||
DEBUGA_SKYPE
|
||||
("Let's transfer the skype_call %s to %s interface (with skype_user: %s), because we are already in a skypiax call(%s)\n",
|
||||
SKYPIAX_P_LOG, tech_pvt->skype_call_id, available_skypiax_interface->name,
|
||||
available_skypiax_interface->skype_user, id);
|
||||
sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id,
|
||||
available_skypiax_interface->skype_user);
|
||||
SKYPIAX_P_LOG, tech_pvt->skype_call_id, available_skypiax_interface->name, available_skypiax_interface->skype_user, id);
|
||||
sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id, available_skypiax_interface->skype_user);
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
} else {
|
||||
/* no skypiax interfaces idle, do nothing */
|
||||
|
@ -244,7 +244,7 @@ struct private_object {
|
||||
typedef struct private_object private_t;
|
||||
|
||||
void *SWITCH_THREAD_FUNC skypiax_api_thread_func(switch_thread_t * thread, void *obj);
|
||||
void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t * session);
|
||||
void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t *session);
|
||||
int skypiax_audio_read(private_t * tech_pvt);
|
||||
int skypiax_audio_init(private_t * tech_pvt);
|
||||
int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
|
||||
|
@ -40,9 +40,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
memset(message, 0, 4096);
|
||||
memset(message_2, 0, 4096);
|
||||
|
||||
howmany =
|
||||
skypiax_pipe_read(tech_pvt->SkypiaxHandles.fdesc[0], (short *) read_from_pipe,
|
||||
sizeof(read_from_pipe));
|
||||
howmany = skypiax_pipe_read(tech_pvt->SkypiaxHandles.fdesc[0], (short *) read_from_pipe, sizeof(read_from_pipe));
|
||||
|
||||
a = 0;
|
||||
for (i = 0; i < howmany; i++) {
|
||||
@ -65,9 +63,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
return 0;
|
||||
}
|
||||
if (!strncasecmp(message, "ERROR 92 CALL", 12)) {
|
||||
ERRORA
|
||||
("Skype got ERROR: |||%s|||, the (skypeout) number we called was not recognized as valid\n",
|
||||
SKYPIAX_P_LOG, message);
|
||||
ERRORA("Skype got ERROR: |||%s|||, the (skypeout) number we called was not recognized as valid\n", SKYPIAX_P_LOG, message);
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
|
||||
DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
|
||||
tech_pvt->skype_call_id[0] = '\0';
|
||||
@ -88,8 +84,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
}
|
||||
if (!strcasecmp(message, "ERROR")) {
|
||||
if (!strncasecmp(message, "ERROR 592 ALTER CALL", 19)) {
|
||||
ERRORA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n",
|
||||
SKYPIAX_P_LOG, message);
|
||||
ERRORA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n", SKYPIAX_P_LOG, message);
|
||||
} else {
|
||||
DEBUGA_SKYPE("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, message);
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
|
||||
@ -123,8 +118,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
skypiax_strncpy(prop, where, sizeof(prop) - 1);
|
||||
if (!strcasecmp(prop, "RECEIVEDAUTHREQUEST")) {
|
||||
char msg_to_skype[256];
|
||||
DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
|
||||
SKYPIAX_P_LOG, message, obj, id, prop);
|
||||
DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n", SKYPIAX_P_LOG, message, obj, id, prop);
|
||||
//TODO: allow authorization based on config param
|
||||
sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
@ -141,16 +135,14 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
skypiax_strncpy(value, where, sizeof(value) - 1);
|
||||
if (!strcasecmp(value, "RECEIVED")) {
|
||||
char msg_to_skype[256];
|
||||
DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s value: %s!\n",
|
||||
SKYPIAX_P_LOG, message, obj, id, prop, value);
|
||||
DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s value: %s!\n", SKYPIAX_P_LOG, message, obj, id, prop, value);
|
||||
//TODO: authomatically flag messages as read based on config param
|
||||
sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
}
|
||||
} else if (!strcasecmp(prop, "BODY")) {
|
||||
char msg_to_skype[256];
|
||||
DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n",
|
||||
SKYPIAX_P_LOG, message, obj, id, prop);
|
||||
DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n", SKYPIAX_P_LOG, message, obj, id, prop);
|
||||
//TODO: authomatically flag messages as read based on config param
|
||||
sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
@ -188,8 +180,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
}
|
||||
}
|
||||
if (!strcasecmp(prop, "PARTNER_DISPNAME")) {
|
||||
snprintf(tech_pvt->callid_name, sizeof(tech_pvt->callid_name) - 1, "%s%s%s",
|
||||
value, where ? " " : "", where ? where : "");
|
||||
snprintf(tech_pvt->callid_name, sizeof(tech_pvt->callid_name) - 1, "%s%s%s", value, where ? " " : "", where ? where : "");
|
||||
//DEBUGA_SKYPE
|
||||
//("the skype_call %s caller PARTNER_DISPNAME (tech_pvt->callid_name) is: %s\n",
|
||||
//SKYPIAX_P_LOG, id, tech_pvt->callid_name);
|
||||
@ -209,17 +200,12 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
dtmf_received(tech_pvt, value);
|
||||
}
|
||||
if (!strcasecmp(prop, "FAILUREREASON")) {
|
||||
DEBUGA_SKYPE
|
||||
("Skype FAILED on skype_call %s. Let's wait for the FAILED message.\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
DEBUGA_SKYPE("Skype FAILED on skype_call %s. Let's wait for the FAILED message.\n", SKYPIAX_P_LOG, id);
|
||||
}
|
||||
if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) {
|
||||
if (strcasecmp(id, tech_pvt->skype_call_id)) {
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE
|
||||
("We called a Skype contact and he answered us on skype_call: %s.\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE("We called a Skype contact and he answered us on skype_call: %s.\n", SKYPIAX_P_LOG, id);
|
||||
}
|
||||
}
|
||||
if (!strcasecmp(prop, "STATUS")) {
|
||||
@ -237,10 +223,8 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
/* this is the call in which we are calling out */
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_RINGING;
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPIAX_P_LOG, id);
|
||||
remote_party_is_ringing(tech_pvt);
|
||||
} else {
|
||||
sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id);
|
||||
@ -252,15 +236,12 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
char msg_to_skype[1024];
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
|
||||
DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n", SKYPIAX_P_LOG, id);
|
||||
start_audio_threads(tech_pvt);
|
||||
skypiax_sleep(1000);
|
||||
sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
|
||||
tech_pvt->tcp_cli_port);
|
||||
sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, tech_pvt->tcp_cli_port);
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
|
||||
tech_pvt->tcp_srv_port);
|
||||
sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port);
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
|
||||
remote_party_is_early_media(tech_pvt);
|
||||
@ -271,8 +252,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
//usleep(150000);//150msec, let's give the TCP sockets time to timeout
|
||||
if (!strcasecmp(tech_pvt->skype_call_id, id)) {
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
|
||||
DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n", SKYPIAX_P_LOG, id);
|
||||
tech_pvt->skype_call_id[0] = '\0';
|
||||
if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
|
||||
//tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
@ -286,9 +266,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
|
||||
} else if (!strcasecmp(value, "CANCELLED")) {
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
|
||||
DEBUGA_SKYPE
|
||||
("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
DEBUGA_SKYPE("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n", SKYPIAX_P_LOG, id);
|
||||
tech_pvt->skype_call_id[0] = '\0';
|
||||
if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
@ -298,23 +276,17 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
}
|
||||
} else if (!strcasecmp(value, "FAILED")) {
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
|
||||
DEBUGA_SKYPE
|
||||
("we tried to call Skype on skype_call %s and Skype has now FAILED\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
DEBUGA_SKYPE("we tried to call Skype on skype_call %s and Skype has now FAILED\n", SKYPIAX_P_LOG, id);
|
||||
tech_pvt->skype_call_id[0] = '\0';
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
return CALLFLOW_INCOMING_HANGUP;
|
||||
} else if (!strcasecmp(value, "REFUSED")) {
|
||||
if (!strcasecmp(id, tech_pvt->skype_call_id)) {
|
||||
/* this is the id of the call we are in, probably we generated it */
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_REFUSED;
|
||||
DEBUGA_SKYPE
|
||||
("we tried to call Skype on skype_call %s and Skype has now REFUSED\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE("we tried to call Skype on skype_call %s and Skype has now REFUSED\n", SKYPIAX_P_LOG, id);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
tech_pvt->skype_call_id[0] = '\0';
|
||||
return CALLFLOW_INCOMING_HANGUP;
|
||||
@ -329,14 +301,12 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
} else if (!strcasecmp(value, "ROUTING")) {
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_ROUTING;
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE("skype_call: %s is now ROUTING\n", SKYPIAX_P_LOG, id);
|
||||
} else if (!strcasecmp(value, "UNPLACED")) {
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_UNPLACED;
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id);
|
||||
} else if (!strcasecmp(value, "INPROGRESS")) {
|
||||
char msg_to_skype[1024];
|
||||
@ -344,8 +314,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
|
||||
if (!strlen(tech_pvt->session_uuid_str) || !strlen(tech_pvt->skype_call_id)
|
||||
|| !strcasecmp(tech_pvt->skype_call_id, id)) {
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
|
||||
|
||||
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_EARLYMEDIA) {
|
||||
@ -353,12 +322,10 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_UP;
|
||||
start_audio_threads(tech_pvt);
|
||||
skypiax_sleep(1000); //FIXME
|
||||
sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
|
||||
tech_pvt->tcp_cli_port);
|
||||
sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, tech_pvt->tcp_cli_port);
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
skypiax_sleep(1000); //FIXME
|
||||
sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"",
|
||||
id, tech_pvt->tcp_srv_port);
|
||||
sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port);
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
}
|
||||
tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
|
||||
@ -370,8 +337,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
outbound_channel_answered(tech_pvt);
|
||||
}
|
||||
} else {
|
||||
DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n",
|
||||
SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
|
||||
DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
|
||||
}
|
||||
} else {
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
|
||||
@ -387,8 +353,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
DEBUGA_SKYPE
|
||||
("we tried to call Skype on skype_call %s and remote party (destination) was BUSY. Our outbound call has failed\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
tech_pvt->skype_call_id[0] = '\0';
|
||||
skypiax_sleep(1000);
|
||||
@ -398,15 +363,13 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
DEBUGA_SKYPE
|
||||
("we tried to call Skype on skype_call %s and remote party (destination) has rejected us (WAITING_REDIAL_COMMAND). Our outbound call has failed\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
tech_pvt->skype_call_id[0] = '\0';
|
||||
skypiax_sleep(1000);
|
||||
return CALLFLOW_INCOMING_HANGUP;
|
||||
} else {
|
||||
WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id,
|
||||
value);
|
||||
WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id, value);
|
||||
}
|
||||
} //STATUS
|
||||
} //CALL
|
||||
@ -481,8 +444,7 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
|
||||
while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
|
||||
&& (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD
|
||||
|| tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
|
||||
|
||||
unsigned int fdselectgio;
|
||||
int rtgio;
|
||||
@ -504,15 +466,13 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
|
||||
/****************************/
|
||||
|
||||
while ((fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
|
||||
DEBUGA_SKYPE("ACCEPTED here I send you %d\n", SKYPIAX_P_LOG,
|
||||
tech_pvt->tcp_srv_port);
|
||||
DEBUGA_SKYPE("ACCEPTED here I send you %d\n", SKYPIAX_P_LOG, tech_pvt->tcp_srv_port);
|
||||
if (!(running && tech_pvt->running))
|
||||
break;
|
||||
while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
|
||||
&& (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD
|
||||
|| tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
|
||||
|
||||
unsigned int fdselect;
|
||||
int rt;
|
||||
@ -574,9 +534,7 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
|
||||
i++;
|
||||
}
|
||||
/* send the complete frame through the pipe to our code waiting for incoming audio */
|
||||
howmany =
|
||||
skypiax_pipe_write(tech_pvt->audiopipe[1], totalbuf,
|
||||
SAMPLES_PER_FRAME * sizeof(short));
|
||||
howmany = skypiax_pipe_write(tech_pvt->audiopipe[1], totalbuf, SAMPLES_PER_FRAME * sizeof(short));
|
||||
if (howmany != SAMPLES_PER_FRAME * sizeof(short)) {
|
||||
ERRORA("howmany is %d, but was expected to be %d\n", SKYPIAX_P_LOG,
|
||||
howmany, (int) (SAMPLES_PER_FRAME * sizeof(short)));
|
||||
@ -603,14 +561,12 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
|
||||
kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
|
||||
len = skypiax_pipe_write(tech_pvt->audiopipe[1], kill_cli_buff, kill_cli_size);
|
||||
kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
|
||||
len =
|
||||
skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
|
||||
len = skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
|
||||
len = skypiax_pipe_write(tech_pvt->audiopipe[1], kill_cli_buff, kill_cli_size);
|
||||
kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
|
||||
len =
|
||||
skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
|
||||
len = skypiax_pipe_write(tech_pvt->audioskypepipe[1], kill_cli_buff, kill_cli_size);
|
||||
|
||||
DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
|
||||
skypiax_close_socket(fd);
|
||||
@ -669,8 +625,7 @@ void *skypiax_do_tcp_cli_thread_func(void *obj)
|
||||
while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
|
||||
&& (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD
|
||||
|| tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
|
||||
|
||||
unsigned int fdselectgio;
|
||||
int rtgio;
|
||||
@ -692,10 +647,10 @@ void *skypiax_do_tcp_cli_thread_func(void *obj)
|
||||
/****************************/
|
||||
|
||||
while ((fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
|
||||
DEBUGA_SKYPE("ACCEPTED here you send me %d\n", SKYPIAX_P_LOG,
|
||||
tech_pvt->tcp_cli_port);
|
||||
DEBUGA_SKYPE("ACCEPTED here you send me %d\n", SKYPIAX_P_LOG, tech_pvt->tcp_cli_port);
|
||||
#ifndef WIN32
|
||||
fcntl(tech_pvt->audioskypepipe[0], F_SETFL, O_NONBLOCK);
|
||||
fcntl(tech_pvt->audioskypepipe[1], F_SETFL, O_NONBLOCK);
|
||||
#endif //WIN32
|
||||
|
||||
if (!(running && tech_pvt->running))
|
||||
@ -703,8 +658,7 @@ void *skypiax_do_tcp_cli_thread_func(void *obj)
|
||||
while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
|
||||
&& (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD
|
||||
|| tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
|
||||
unsigned int fdselect;
|
||||
int rt;
|
||||
fd_set fs;
|
||||
@ -735,15 +689,12 @@ void *skypiax_do_tcp_cli_thread_func(void *obj)
|
||||
/* until we drained the pipe to empty */
|
||||
for (counter = 0; counter < 10; counter++) {
|
||||
/* read from the pipe the audio frame we are supposed to send out */
|
||||
got =
|
||||
skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in,
|
||||
SAMPLES_PER_FRAME * sizeof(short));
|
||||
got = skypiax_pipe_read(tech_pvt->audioskypepipe[0], cli_in, SAMPLES_PER_FRAME * sizeof(short));
|
||||
if (got == -1)
|
||||
break;
|
||||
|
||||
if (got != SAMPLES_PER_FRAME * sizeof(short)) {
|
||||
WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
|
||||
(int) (SAMPLES_PER_FRAME * sizeof(short)));
|
||||
WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got, (int) (SAMPLES_PER_FRAME * sizeof(short)));
|
||||
}
|
||||
|
||||
if (got == SAMPLES_PER_FRAME * sizeof(short)) {
|
||||
@ -783,8 +734,7 @@ void *skypiax_do_tcp_cli_thread_func(void *obj)
|
||||
|
||||
} else {
|
||||
|
||||
WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
|
||||
(int) (SAMPLES_PER_FRAME * sizeof(short)));
|
||||
WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got, (int) (SAMPLES_PER_FRAME * sizeof(short)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -821,14 +771,11 @@ int skypiax_audio_read(private_t * tech_pvt)
|
||||
{
|
||||
unsigned int samples;
|
||||
|
||||
samples =
|
||||
skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data,
|
||||
SAMPLES_PER_FRAME * sizeof(short));
|
||||
samples = skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, SAMPLES_PER_FRAME * sizeof(short));
|
||||
|
||||
if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
|
||||
if (samples)
|
||||
WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples,
|
||||
(int) (SAMPLES_PER_FRAME * sizeof(short)));
|
||||
WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples, (int) (SAMPLES_PER_FRAME * sizeof(short)));
|
||||
return 0;
|
||||
} else {
|
||||
/* A real frame */
|
||||
@ -909,12 +856,8 @@ int skypiax_close_socket(unsigned int fd)
|
||||
int skypiax_audio_init(private_t * tech_pvt)
|
||||
{
|
||||
switch_status_t rv;
|
||||
rv =
|
||||
switch_file_pipe_create(&tech_pvt->audiopipe[0], &tech_pvt->audiopipe[1],
|
||||
skypiax_module_pool);
|
||||
rv =
|
||||
switch_file_pipe_create(&tech_pvt->audioskypepipe[0], &tech_pvt->audioskypepipe[1],
|
||||
skypiax_module_pool);
|
||||
rv = switch_file_pipe_create(&tech_pvt->audiopipe[0], &tech_pvt->audiopipe[1], skypiax_module_pool);
|
||||
rv = switch_file_pipe_create(&tech_pvt->audioskypepipe[0], &tech_pvt->audioskypepipe[1], skypiax_module_pool);
|
||||
return 0;
|
||||
}
|
||||
#else /* WIN32 */
|
||||
@ -1018,11 +961,8 @@ int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
|
||||
if (oCopyData.cbData != 1) {
|
||||
if (SendMessage
|
||||
(tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle, WM_COPYDATA,
|
||||
(WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle,
|
||||
(LPARAM) & oCopyData) == FALSE) {
|
||||
ERRORA
|
||||
("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then launch Skypiax and try again.\n",
|
||||
SKYPIAX_P_LOG);
|
||||
(WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, (LPARAM) & oCopyData) == FALSE) {
|
||||
ERRORA("Sending message failed - probably Skype crashed.\n\nPlease shutdown Skypiax, then launch Skypiax and try again.\n", SKYPIAX_P_LOG);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1031,8 +971,7 @@ int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
|
||||
|
||||
}
|
||||
|
||||
LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
|
||||
LPARAM ulParam)
|
||||
LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam, LPARAM ulParam)
|
||||
{
|
||||
LRESULT lReturnCode;
|
||||
int fIssueDefProc;
|
||||
@ -1062,29 +1001,24 @@ LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
|
||||
PCOPYDATASTRUCT poCopyData = (PCOPYDATASTRUCT) ulParam;
|
||||
|
||||
memset(msg_from_skype, '\0', sizeof(msg_from_skype));
|
||||
skypiax_strncpy(msg_from_skype, (const char *) poCopyData->lpData,
|
||||
sizeof(msg_from_skype) - 2);
|
||||
skypiax_strncpy(msg_from_skype, (const char *) poCopyData->lpData, sizeof(msg_from_skype) - 2);
|
||||
|
||||
howmany = strlen(msg_from_skype) + 1;
|
||||
howmany =
|
||||
skypiax_pipe_write(tech_pvt->SkypiaxHandles.fdesc[1], (short *) msg_from_skype,
|
||||
howmany);
|
||||
howmany = skypiax_pipe_write(tech_pvt->SkypiaxHandles.fdesc[1], (short *) msg_from_skype, howmany);
|
||||
//DEBUGA_SKYPE("From Skype API: %s\n", SKYPIAX_P_LOG, msg_from_skype);
|
||||
lReturnCode = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (tech_pvt && tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach) {
|
||||
if (uiMessage ==
|
||||
tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach) {
|
||||
if (uiMessage == tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach) {
|
||||
switch (ulParam) {
|
||||
case SKYPECONTROLAPI_ATTACH_SUCCESS:
|
||||
if (!tech_pvt->SkypiaxHandles.currentuserhandle) {
|
||||
//DEBUGA_SKYPE("\n\n\tConnected to Skype API!\n", SKYPIAX_P_LOG);
|
||||
tech_pvt->SkypiaxHandles.api_connected = 1;
|
||||
tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle = (HWND) uiParam;
|
||||
tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle =
|
||||
tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle;
|
||||
tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle = tech_pvt->SkypiaxHandles.win32_hGlobal_SkypeAPIWindowHandle;
|
||||
}
|
||||
break;
|
||||
case SKYPECONTROLAPI_ATTACH_PENDING_AUTHORIZATION:
|
||||
@ -1094,9 +1028,7 @@ LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
|
||||
if (!tech_pvt->SkypiaxHandles.currentuserhandle) {
|
||||
SendMessage(HWND_BROADCAST,
|
||||
tech_pvt->SkypiaxHandles.
|
||||
win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
|
||||
(WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle,
|
||||
0);
|
||||
win32_uiGlobal_MsgID_SkypeControlAPIDiscover, (WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, 0);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@ -1113,9 +1045,7 @@ LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
|
||||
if (!tech_pvt->SkypiaxHandles.currentuserhandle) {
|
||||
SendMessage(HWND_BROADCAST,
|
||||
tech_pvt->SkypiaxHandles.
|
||||
win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
|
||||
(WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle,
|
||||
0);
|
||||
win32_uiGlobal_MsgID_SkypeControlAPIDiscover, (WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, 0);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@ -1143,16 +1073,13 @@ int win32_Initialize_CreateWindowClass(private_t * tech_pvt)
|
||||
|
||||
fReturnStatus = 0;
|
||||
lUUIDResult = UuidCreate(&oUUID);
|
||||
tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle =
|
||||
(HINSTANCE) OpenProcess(PROCESS_DUP_HANDLE, FALSE, GetCurrentProcessId());
|
||||
if (tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle != NULL
|
||||
&& (lUUIDResult == RPC_S_OK || lUUIDResult == RPC_S_UUID_LOCAL_ONLY)) {
|
||||
tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle = (HINSTANCE) OpenProcess(PROCESS_DUP_HANDLE, FALSE, GetCurrentProcessId());
|
||||
if (tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle != NULL && (lUUIDResult == RPC_S_OK || lUUIDResult == RPC_S_UUID_LOCAL_ONLY)) {
|
||||
if (UuidToString(&oUUID, &paucUUIDString) == RPC_S_OK) {
|
||||
WNDCLASS oWindowClass;
|
||||
|
||||
strcpy(tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName, "Skype-API-Skypiax-");
|
||||
strcat(tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName,
|
||||
(char *) paucUUIDString);
|
||||
strcat(tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName, (char *) paucUUIDString);
|
||||
|
||||
oWindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
|
||||
oWindowClass.lpfnWndProc = (WNDPROC) & skypiax_present;
|
||||
@ -1179,8 +1106,7 @@ int win32_Initialize_CreateWindowClass(private_t * tech_pvt)
|
||||
|
||||
void win32_DeInitialize_DestroyWindowClass(private_t * tech_pvt)
|
||||
{
|
||||
UnregisterClass(tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName,
|
||||
tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle);
|
||||
UnregisterClass(tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName, tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle);
|
||||
CloseHandle(tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle);
|
||||
tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle = NULL;
|
||||
}
|
||||
@ -1191,16 +1117,14 @@ int win32_Initialize_CreateMainWindow(private_t * tech_pvt)
|
||||
CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
|
||||
tech_pvt->SkypiaxHandles.win32_acInit_WindowClassName, "",
|
||||
WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
128, 128, NULL, 0, tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle,
|
||||
tech_pvt);
|
||||
128, 128, NULL, 0, tech_pvt->SkypiaxHandles.win32_hInit_ProcessHandle, tech_pvt);
|
||||
return (tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle != NULL ? 1 : 0);
|
||||
}
|
||||
|
||||
void win32_DeInitialize_DestroyMainWindow(private_t * tech_pvt)
|
||||
{
|
||||
if (tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle != NULL)
|
||||
DestroyWindow(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle),
|
||||
tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle = NULL;
|
||||
DestroyWindow(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle), tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle = NULL;
|
||||
}
|
||||
|
||||
void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
@ -1209,11 +1133,8 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
switch_status_t rv;
|
||||
|
||||
switch_file_pipe_create(&tech_pvt->SkypiaxHandles.fdesc[0],
|
||||
&tech_pvt->SkypiaxHandles.fdesc[1], skypiax_module_pool);
|
||||
rv =
|
||||
switch_file_pipe_create(&tech_pvt->SkypiaxHandles.fdesc[0],
|
||||
&tech_pvt->SkypiaxHandles.fdesc[1], skypiax_module_pool);
|
||||
switch_file_pipe_create(&tech_pvt->SkypiaxHandles.fdesc[0], &tech_pvt->SkypiaxHandles.fdesc[1], skypiax_module_pool);
|
||||
rv = switch_file_pipe_create(&tech_pvt->SkypiaxHandles.fdesc[0], &tech_pvt->SkypiaxHandles.fdesc[1], skypiax_module_pool);
|
||||
#else /* WIN32 */
|
||||
if (pipe(tech_pvt->SkypiaxHandles.fdesc)) {
|
||||
fcntl(tech_pvt->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK);
|
||||
@ -1221,10 +1142,8 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
}
|
||||
#endif /* WIN32 */
|
||||
|
||||
tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach =
|
||||
RegisterWindowMessage("SkypeControlAPIAttach");
|
||||
tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIDiscover =
|
||||
RegisterWindowMessage("SkypeControlAPIDiscover");
|
||||
tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIAttach = RegisterWindowMessage("SkypeControlAPIAttach");
|
||||
tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIDiscover = RegisterWindowMessage("SkypeControlAPIDiscover");
|
||||
|
||||
skypiax_sleep(200000); //0,2 sec
|
||||
|
||||
@ -1236,11 +1155,10 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
(HWND_BROADCAST,
|
||||
tech_pvt->SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
|
||||
(WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, 0) != 0) {
|
||||
tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle =
|
||||
tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle;
|
||||
tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle = tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle;
|
||||
while (running && tech_pvt->running) {
|
||||
MSG oMessage;
|
||||
if (! (running && tech_pvt->running))
|
||||
if (!(running && tech_pvt->running))
|
||||
break;
|
||||
while (GetMessage(&oMessage, 0, 0, 0)) {
|
||||
TranslateMessage(&oMessage);
|
||||
@ -1364,8 +1282,7 @@ int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
|
||||
//XLockDisplay(disp);
|
||||
status =
|
||||
XGetWindowProperty(SkypiaxHandles->disp, DefaultRootWindow(SkypiaxHandles->disp),
|
||||
skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret,
|
||||
&nitems_ret, &bytes_after_ret, &prop);
|
||||
skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret, &nitems_ret, &bytes_after_ret, &prop);
|
||||
//XUnlockDisplay(disp);
|
||||
X11_errors_untrap();
|
||||
|
||||
@ -1379,8 +1296,7 @@ int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
|
||||
}
|
||||
|
||||
SkypiaxHandles->skype_win = *(const unsigned long *) prop & 0xffffffff;
|
||||
DEBUGA_SKYPE("Skype instance found with id #%d\n", SKYPIAX_P_LOG,
|
||||
(unsigned int) SkypiaxHandles->skype_win);
|
||||
DEBUGA_SKYPE("Skype instance found with id #%d\n", SKYPIAX_P_LOG, (unsigned int) SkypiaxHandles->skype_win);
|
||||
SkypiaxHandles->api_connected = 1;
|
||||
return 1;
|
||||
}
|
||||
@ -1432,8 +1348,7 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
SkypiaxHandles = &tech_pvt->SkypiaxHandles;
|
||||
disp = XOpenDisplay(tech_pvt->X11_display);
|
||||
if (!disp) {
|
||||
ERRORA("Cannot open X Display '%s', exiting skype thread\n", SKYPIAX_P_LOG,
|
||||
tech_pvt->X11_display);
|
||||
ERRORA("Cannot open X Display '%s', exiting skype thread\n", SKYPIAX_P_LOG, tech_pvt->X11_display);
|
||||
running = 0;
|
||||
return NULL;
|
||||
} else {
|
||||
@ -1448,29 +1363,21 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
|
||||
if (skypiax_present(SkypiaxHandles)) {
|
||||
root = DefaultRootWindow(disp);
|
||||
win =
|
||||
XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0,
|
||||
BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp,
|
||||
DefaultScreen
|
||||
(disp)));
|
||||
win = XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0, BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp, DefaultScreen(disp)));
|
||||
|
||||
SkypiaxHandles->win = win;
|
||||
|
||||
snprintf(buf, 512, "NAME skypiax");
|
||||
|
||||
if (!skypiax_send_message(SkypiaxHandles, buf)) {
|
||||
ERRORA
|
||||
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n",
|
||||
SKYPIAX_P_LOG);
|
||||
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
|
||||
running = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
snprintf(buf, 512, "PROTOCOL 7");
|
||||
if (!skypiax_send_message(SkypiaxHandles, buf)) {
|
||||
ERRORA
|
||||
("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n",
|
||||
SKYPIAX_P_LOG);
|
||||
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
|
||||
running = 0;
|
||||
return NULL;
|
||||
}
|
||||
@ -1489,7 +1396,7 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
|
||||
while (1) {
|
||||
XNextEvent(disp, &an_event);
|
||||
if (! (running && tech_pvt->running))
|
||||
if (!(running && tech_pvt->running))
|
||||
break;
|
||||
switch (an_event.type) {
|
||||
case ClientMessage:
|
||||
@ -1518,8 +1425,7 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
|
||||
if (!strlen(buffer)) {
|
||||
DEBUGA_SKYPE
|
||||
("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||\n",
|
||||
SKYPIAX_P_LOG, buf);
|
||||
("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||\n", SKYPIAX_P_LOG, buf);
|
||||
continue_is_broken = 1;
|
||||
if (!strncmp(buf, "ognised identity", 15)) {
|
||||
WARNINGA
|
||||
@ -1551,9 +1457,7 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ERRORA
|
||||
("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n",
|
||||
SKYPIAX_P_LOG);
|
||||
ERRORA("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n", SKYPIAX_P_LOG);
|
||||
running = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
||||
switch_codec_t *use_codec = read_frame->codec;
|
||||
if (do_bugs) {
|
||||
if (!switch_core_codec_ready(&session->bug_codec)) {
|
||||
switch_core_codec_copy(read_frame->codec, &session->bug_codec, switch_core_session_get_pool(session));
|
||||
switch_core_codec_copy(read_frame->codec, &session->bug_codec, NULL);
|
||||
}
|
||||
use_codec = &session->bug_codec;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user