mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 16:58:35 +00:00
skypopen: indented
This commit is contained in:
parent
994cdbd183
commit
7d7f23cebb
@ -172,7 +172,7 @@ int running = 0;
|
|||||||
// CLOUDTREE (THomas Hazel)
|
// CLOUDTREE (THomas Hazel)
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
struct SkypopenList global_handles_list;
|
struct SkypopenList global_handles_list;
|
||||||
extern int xio_error_handler(Display *dpy);
|
extern int xio_error_handler(Display * dpy);
|
||||||
extern int X11_errors_handler(Display * dpy, XErrorEvent * err);
|
extern int X11_errors_handler(Display * dpy, XErrorEvent * err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -204,9 +204,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||||||
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);
|
||||||
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);
|
||||||
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);
|
||||||
static switch_status_t skypopen_tech_init(private_t * tech_pvt, switch_core_session_t *session);
|
static switch_status_t skypopen_tech_init(private_t *tech_pvt, switch_core_session_t *session);
|
||||||
|
|
||||||
static switch_status_t skypopen_codec(private_t * tech_pvt, int sample_rate, int codec_ms)
|
static switch_status_t skypopen_codec(private_t *tech_pvt, int sample_rate, int codec_ms)
|
||||||
{
|
{
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ static switch_status_t skypopen_codec(private_t * tech_pvt, int sample_rate, int
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_status_t skypopen_tech_init(private_t * tech_pvt, switch_core_session_t *session)
|
switch_status_t skypopen_tech_init(private_t *tech_pvt, switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch_assert(tech_pvt != NULL);
|
switch_assert(tech_pvt != NULL);
|
||||||
@ -349,7 +349,7 @@ static switch_status_t interface_exists(char *the_interface)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/* CLOUDTREE (Thomas Hazel) */ (force == FALSE) && strlen(globals.SKYPOPEN_INTERFACES[interface_id].session_uuid_str)) {
|
if ( /* CLOUDTREE (Thomas Hazel) */ (force == FALSE) && strlen(globals.SKYPOPEN_INTERFACES[interface_id].session_uuid_str)) {
|
||||||
DEBUGA_SKYPE("interface '%s' is busy\n", SKYPOPEN_P_LOG, the_interface);
|
DEBUGA_SKYPE("interface '%s' is busy\n", SKYPOPEN_P_LOG, the_interface);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ static switch_status_t interface_exists(char *the_interface)
|
|||||||
if (tech_pvt->running && tech_pvt->SkypopenHandles.disp) {
|
if (tech_pvt->running && tech_pvt->SkypopenHandles.disp) {
|
||||||
XEvent e;
|
XEvent e;
|
||||||
Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
|
Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
|
||||||
switch_sleep(1000);//giovanni
|
switch_sleep(1000); //giovanni
|
||||||
XFlush(tech_pvt->SkypopenHandles.disp); //giovanni
|
XFlush(tech_pvt->SkypopenHandles.disp); //giovanni
|
||||||
memset(&e, 0, sizeof(e));
|
memset(&e, 0, sizeof(e));
|
||||||
e.xclient.type = ClientMessage;
|
e.xclient.type = ClientMessage;
|
||||||
@ -470,18 +470,18 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
|||||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){
|
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
|
||||||
switch_core_timer_destroy(&tech_pvt->timer_read);
|
switch_core_timer_destroy(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){
|
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) {
|
||||||
switch_core_timer_destroy(&tech_pvt->timer_write);
|
switch_core_timer_destroy(&tech_pvt->timer_write);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tech_pvt->read_buffer){
|
if (tech_pvt->read_buffer) {
|
||||||
switch_buffer_destroy(&tech_pvt->read_buffer);
|
switch_buffer_destroy(&tech_pvt->read_buffer);
|
||||||
}
|
}
|
||||||
if(tech_pvt->write_buffer){
|
if (tech_pvt->write_buffer) {
|
||||||
switch_buffer_destroy(&tech_pvt->write_buffer);
|
switch_buffer_destroy(&tech_pvt->write_buffer);
|
||||||
}
|
}
|
||||||
DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG);
|
DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG);
|
||||||
@ -538,7 +538,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
|||||||
|
|
||||||
DEBUGA_SKYPE("debugging_hangup 1\n", SKYPOPEN_P_LOG);
|
DEBUGA_SKYPE("debugging_hangup 1\n", SKYPOPEN_P_LOG);
|
||||||
|
|
||||||
if(tech_pvt){
|
if (tech_pvt) {
|
||||||
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
|
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||||
tech_pvt->ob_failed_calls++;
|
tech_pvt->ob_failed_calls++;
|
||||||
@ -560,7 +560,6 @@ 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);
|
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id);
|
||||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
switch_sleep(1500000); //XXX 1.5 seconds, let's the audio tcp threads die XXX
|
switch_sleep(1500000); //XXX 1.5 seconds, let's the audio tcp threads die XXX
|
||||||
//FIXME must not allow using the tech_pvt while this sleeps, so must implement a check on interface_state
|
//FIXME must not allow using the tech_pvt while this sleeps, so must implement a check on interface_state
|
||||||
@ -587,7 +586,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
|||||||
switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv);
|
||||||
DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG);
|
DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG);
|
||||||
DEBUGA_SKYPE("debugging_hangup 8\n", SKYPOPEN_P_LOG);
|
DEBUGA_SKYPE("debugging_hangup 8\n", SKYPOPEN_P_LOG);
|
||||||
#endif//0
|
#endif //0
|
||||||
DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPOPEN_P_LOG, tech_pvt->name);
|
DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPOPEN_P_LOG, tech_pvt->name);
|
||||||
switch_mutex_lock(globals.mutex);
|
switch_mutex_lock(globals.mutex);
|
||||||
globals.calls--;
|
globals.calls--;
|
||||||
@ -602,7 +601,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
|||||||
}
|
}
|
||||||
DEBUGA_SKYPE("debugging_hangup 10\n", SKYPOPEN_P_LOG);
|
DEBUGA_SKYPE("debugging_hangup 10\n", SKYPOPEN_P_LOG);
|
||||||
switch_mutex_unlock(globals.mutex);
|
switch_mutex_unlock(globals.mutex);
|
||||||
}else{
|
} else {
|
||||||
WARNINGA("FYI %s CHANNEL has no tech_pvt in his private\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
WARNINGA("FYI %s CHANNEL has no tech_pvt in his private\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
||||||
DEBUGA_SKYPE("debugging_hangup 11\n", SKYPOPEN_P_LOG);
|
DEBUGA_SKYPE("debugging_hangup 11\n", SKYPOPEN_P_LOG);
|
||||||
}
|
}
|
||||||
@ -656,7 +655,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
|
|||||||
tech_pvt = switch_core_session_get_private(session);
|
tech_pvt = switch_core_session_get_private(session);
|
||||||
|
|
||||||
//DEBUGA_SKYPE("%s CHANNEL KILL_CHANNEL\n", SKYPOPEN_P_LOG, tech_pvt->name);
|
//DEBUGA_SKYPE("%s CHANNEL KILL_CHANNEL\n", SKYPOPEN_P_LOG, tech_pvt->name);
|
||||||
if(tech_pvt){
|
if (tech_pvt) {
|
||||||
switch (sig) {
|
switch (sig) {
|
||||||
case SWITCH_SIG_KILL:
|
case SWITCH_SIG_KILL:
|
||||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||||
@ -668,12 +667,13 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
|
|||||||
WARNINGA("FYI %s CHANNEL in CS_NEW state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
WARNINGA("FYI %s CHANNEL in CS_NEW state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
||||||
}
|
}
|
||||||
if (switch_channel_get_state(channel) != CS_NEW && switch_channel_get_state(channel) < CS_EXECUTE) {
|
if (switch_channel_get_state(channel) != CS_NEW && switch_channel_get_state(channel) < CS_EXECUTE) {
|
||||||
WARNINGA("FYI %s CHANNEL in %d state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel), switch_channel_get_state(channel));
|
WARNINGA("FYI %s CHANNEL in %d state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel),
|
||||||
|
switch_channel_get_state(channel));
|
||||||
}
|
}
|
||||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||||
switch_clear_flag(tech_pvt, TFLAG_VOICE);
|
switch_clear_flag(tech_pvt, TFLAG_VOICE);
|
||||||
switch_set_flag(tech_pvt, TFLAG_HANGUP);
|
switch_set_flag(tech_pvt, TFLAG_HANGUP);
|
||||||
if(switch_test_flag(tech_pvt, TFLAG_PROGRESS)){
|
if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) {
|
||||||
switch_clear_flag(tech_pvt, TFLAG_PROGRESS);
|
switch_clear_flag(tech_pvt, TFLAG_PROGRESS);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->flag_mutex);
|
switch_mutex_unlock(tech_pvt->flag_mutex);
|
||||||
@ -695,7 +695,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
WARNINGA("FYI %s CHANNEL has no tech_pvt in his private\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
WARNINGA("FYI %s CHANNEL has no tech_pvt in his private\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,7 +775,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int a;
|
unsigned int a;
|
||||||
size_t bytes_read = 0;
|
size_t bytes_read = 0;
|
||||||
int try=0;
|
int try = 0;
|
||||||
|
|
||||||
|
|
||||||
*frame = NULL;
|
*frame = NULL;
|
||||||
@ -815,11 +815,11 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){
|
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
|
||||||
switch_core_timer_next(&tech_pvt->timer_read);
|
switch_core_timer_next(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
read:
|
read:
|
||||||
|
|
||||||
|
|
||||||
if (tech_pvt && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN
|
if (tech_pvt && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN
|
||||||
@ -833,11 +833,11 @@ read:
|
|||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
||||||
|
|
||||||
try=0;
|
try = 0;
|
||||||
if (!bytes_read) {
|
if (!bytes_read) {
|
||||||
switch_sleep(1000);
|
switch_sleep(1000);
|
||||||
try++;
|
try++;
|
||||||
if(try < 5)
|
if (try < 5)
|
||||||
goto read;
|
goto read;
|
||||||
DEBUGA_SKYPE("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG);
|
DEBUGA_SKYPE("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG);
|
||||||
memset(tech_pvt->read_frame.data, 255, SAMPLES_PER_FRAME * sizeof(short));
|
memset(tech_pvt->read_frame.data, 255, SAMPLES_PER_FRAME * sizeof(short));
|
||||||
@ -935,7 +935,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
|||||||
{
|
{
|
||||||
switch_channel_t *channel = NULL;
|
switch_channel_t *channel = NULL;
|
||||||
private_t *tech_pvt = NULL;
|
private_t *tech_pvt = NULL;
|
||||||
int no_space=0;
|
int no_space = 0;
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
switch_assert(channel != NULL);
|
switch_assert(channel != NULL);
|
||||||
@ -973,13 +973,13 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
|||||||
DEBUGA_SKYPE("NO SPACE WRITE: %d\n", SKYPOPEN_P_LOG, frame->datalen);
|
DEBUGA_SKYPE("NO SPACE WRITE: %d\n", SKYPOPEN_P_LOG, frame->datalen);
|
||||||
//switch_buffer_toss(tech_pvt->write_buffer, frame->datalen);
|
//switch_buffer_toss(tech_pvt->write_buffer, frame->datalen);
|
||||||
switch_buffer_zero(tech_pvt->write_buffer);
|
switch_buffer_zero(tech_pvt->write_buffer);
|
||||||
no_space=1;
|
no_space = 1;
|
||||||
}
|
}
|
||||||
switch_buffer_write(tech_pvt->write_buffer, frame->data, frame->datalen);
|
switch_buffer_write(tech_pvt->write_buffer, frame->data, frame->datalen);
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
||||||
if(no_space){
|
if (no_space) {
|
||||||
switch_sleep(20000);
|
switch_sleep(20000);
|
||||||
}else{
|
} else {
|
||||||
tech_pvt->begin_to_write = 1;
|
tech_pvt->begin_to_write = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1001,13 +1001,13 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
|||||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||||
skypopen_answer(tech_pvt);
|
skypopen_answer(tech_pvt);
|
||||||
|
|
||||||
while(!switch_test_flag(tech_pvt, TFLAG_IO)){ //FIXME that would be better with a timeout
|
while (!switch_test_flag(tech_pvt, TFLAG_IO)) { //FIXME that would be better with a timeout
|
||||||
if(switch_channel_get_state(channel) == CS_RESET){
|
if (switch_channel_get_state(channel) == CS_RESET) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
switch_sleep(5000);
|
switch_sleep(5000);
|
||||||
conta++;
|
conta++;
|
||||||
if(conta == 100){ //0.5 seconds
|
if (conta == 100) { //0.5 seconds
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1025,7 +1025,7 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
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;
|
switch_channel_t *channel;
|
||||||
private_t *tech_pvt;
|
private_t *tech_pvt;
|
||||||
@ -1048,7 +1048,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
|||||||
case SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS:
|
case SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS:
|
||||||
{
|
{
|
||||||
DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
||||||
if(switch_set_flag(tech_pvt, TFLAG_PROGRESS)){
|
if (switch_set_flag(tech_pvt, TFLAG_PROGRESS)) {
|
||||||
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id);
|
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id);
|
||||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||||
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id);
|
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id);
|
||||||
@ -1070,19 +1070,19 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
|||||||
channel_answer_channel(session);
|
channel_answer_channel(session);
|
||||||
switch_clear_flag(tech_pvt, TFLAG_PROGRESS);
|
switch_clear_flag(tech_pvt, TFLAG_PROGRESS);
|
||||||
|
|
||||||
if(tech_pvt->read_buffer){
|
if (tech_pvt->read_buffer) {
|
||||||
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
||||||
switch_buffer_zero(tech_pvt->read_buffer);
|
switch_buffer_zero(tech_pvt->read_buffer);
|
||||||
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){
|
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
|
||||||
switch_core_timer_sync(&tech_pvt->timer_read);
|
switch_core_timer_sync(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tech_pvt->write_buffer){
|
if (tech_pvt->write_buffer) {
|
||||||
switch_mutex_lock(tech_pvt->mutex_audio_cli);
|
switch_mutex_lock(tech_pvt->mutex_audio_cli);
|
||||||
switch_buffer_zero(tech_pvt->write_buffer);
|
switch_buffer_zero(tech_pvt->write_buffer);
|
||||||
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){
|
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) {
|
||||||
switch_core_timer_sync(&tech_pvt->timer_write);
|
switch_core_timer_sync(&tech_pvt->timer_write);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
||||||
@ -1095,19 +1095,19 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
|||||||
|
|
||||||
DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
||||||
|
|
||||||
if(tech_pvt->read_buffer){
|
if (tech_pvt->read_buffer) {
|
||||||
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
||||||
switch_buffer_zero(tech_pvt->read_buffer);
|
switch_buffer_zero(tech_pvt->read_buffer);
|
||||||
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){
|
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
|
||||||
switch_core_timer_sync(&tech_pvt->timer_read);
|
switch_core_timer_sync(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tech_pvt->write_buffer){
|
if (tech_pvt->write_buffer) {
|
||||||
switch_mutex_lock(tech_pvt->mutex_audio_cli);
|
switch_mutex_lock(tech_pvt->mutex_audio_cli);
|
||||||
switch_buffer_zero(tech_pvt->write_buffer);
|
switch_buffer_zero(tech_pvt->write_buffer);
|
||||||
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){
|
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) {
|
||||||
switch_core_timer_sync(&tech_pvt->timer_write);
|
switch_core_timer_sync(&tech_pvt->timer_write);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
||||||
@ -1117,19 +1117,19 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
|||||||
case SWITCH_MESSAGE_INDICATE_BRIDGE:
|
case SWITCH_MESSAGE_INDICATE_BRIDGE:
|
||||||
DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_BRIDGE\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_BRIDGE\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel));
|
||||||
|
|
||||||
if(tech_pvt->read_buffer){
|
if (tech_pvt->read_buffer) {
|
||||||
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
||||||
switch_buffer_zero(tech_pvt->read_buffer);
|
switch_buffer_zero(tech_pvt->read_buffer);
|
||||||
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){
|
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
|
||||||
switch_core_timer_sync(&tech_pvt->timer_read);
|
switch_core_timer_sync(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tech_pvt->write_buffer){
|
if (tech_pvt->write_buffer) {
|
||||||
switch_mutex_lock(tech_pvt->mutex_audio_cli);
|
switch_mutex_lock(tech_pvt->mutex_audio_cli);
|
||||||
switch_buffer_zero(tech_pvt->write_buffer);
|
switch_buffer_zero(tech_pvt->write_buffer);
|
||||||
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){
|
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) {
|
||||||
switch_core_timer_sync(&tech_pvt->timer_write);
|
switch_core_timer_sync(&tech_pvt->timer_write);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
||||||
@ -1322,7 +1322,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||||||
* \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 skypopen_signaling_read function
|
* \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 skypopen_signaling_read function
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * thread, void *obj)
|
static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t *thread, void *obj)
|
||||||
{
|
{
|
||||||
private_t *tech_pvt = obj;
|
private_t *tech_pvt = obj;
|
||||||
int res;
|
int res;
|
||||||
@ -1393,7 +1393,7 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tech_pvt->skypopen_signaling_thread=NULL;
|
tech_pvt->skypopen_signaling_thread = NULL;
|
||||||
DEBUGA_SKYPE("EXITING\n", SKYPOPEN_P_LOG);
|
DEBUGA_SKYPE("EXITING\n", SKYPOPEN_P_LOG);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1472,22 +1472,22 @@ static switch_status_t load_config(int reload_type)
|
|||||||
char *setsockopt = "false";
|
char *setsockopt = "false";
|
||||||
uint32_t interface_id = 0;
|
uint32_t interface_id = 0;
|
||||||
|
|
||||||
if(globals.context)
|
if (globals.context)
|
||||||
context=globals.context;
|
context = globals.context;
|
||||||
if(globals.dialplan)
|
if (globals.dialplan)
|
||||||
dialplan=globals.dialplan;
|
dialplan = globals.dialplan;
|
||||||
if(globals.destination)
|
if (globals.destination)
|
||||||
destination=globals.destination;
|
destination = globals.destination;
|
||||||
if(globals.skype_user)
|
if (globals.skype_user)
|
||||||
skype_user=globals.skype_user;
|
skype_user = globals.skype_user;
|
||||||
if(globals.report_incoming_chatmessages)
|
if (globals.report_incoming_chatmessages)
|
||||||
report_incoming_chatmessages=globals.report_incoming_chatmessages;
|
report_incoming_chatmessages = globals.report_incoming_chatmessages;
|
||||||
if(globals.silent_mode)
|
if (globals.silent_mode)
|
||||||
silent_mode=globals.silent_mode;
|
silent_mode = globals.silent_mode;
|
||||||
if(globals.write_silence_when_idle)
|
if (globals.write_silence_when_idle)
|
||||||
write_silence_when_idle=globals.write_silence_when_idle;
|
write_silence_when_idle = globals.write_silence_when_idle;
|
||||||
if(globals.setsockopt)
|
if (globals.setsockopt)
|
||||||
setsockopt=globals.setsockopt;
|
setsockopt = globals.setsockopt;
|
||||||
|
|
||||||
tech_pvt = NULL;
|
tech_pvt = NULL;
|
||||||
|
|
||||||
@ -1653,7 +1653,8 @@ static switch_status_t load_config(int reload_type)
|
|||||||
switch_threadattr_detach_set(skypopen_api_thread_attr, 0);
|
switch_threadattr_detach_set(skypopen_api_thread_attr, 0);
|
||||||
switch_threadattr_stacksize_set(skypopen_api_thread_attr, SWITCH_THREAD_STACKSIZE);
|
switch_threadattr_stacksize_set(skypopen_api_thread_attr, SWITCH_THREAD_STACKSIZE);
|
||||||
switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id].skypopen_api_thread,
|
switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id].skypopen_api_thread,
|
||||||
skypopen_api_thread_attr, skypopen_do_skypeapi_thread, &globals.SKYPOPEN_INTERFACES[interface_id], skypopen_module_pool);
|
skypopen_api_thread_attr, skypopen_do_skypeapi_thread, &globals.SKYPOPEN_INTERFACES[interface_id],
|
||||||
|
skypopen_module_pool);
|
||||||
|
|
||||||
switch_sleep(100000);
|
switch_sleep(100000);
|
||||||
|
|
||||||
@ -1758,7 +1759,8 @@ static switch_status_t load_config(int reload_type)
|
|||||||
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].report_incoming_chatmessages=%d\n", SKYPOPEN_P_LOG, i, i,
|
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].report_incoming_chatmessages=%d\n", SKYPOPEN_P_LOG, i, i,
|
||||||
globals.SKYPOPEN_INTERFACES[i].report_incoming_chatmessages);
|
globals.SKYPOPEN_INTERFACES[i].report_incoming_chatmessages);
|
||||||
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].silent_mode=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].silent_mode);
|
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].silent_mode=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].silent_mode);
|
||||||
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].write_silence_when_idle=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].write_silence_when_idle);
|
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].write_silence_when_idle=%d\n", SKYPOPEN_P_LOG, i, i,
|
||||||
|
globals.SKYPOPEN_INTERFACES[i].write_silence_when_idle);
|
||||||
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].setsockopt=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].setsockopt);
|
DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].setsockopt=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].setsockopt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1814,7 +1816,8 @@ static switch_status_t chat_send(const char *proto, const char *from, const char
|
|||||||
if (strlen(globals.SKYPOPEN_INTERFACES[i].name)
|
if (strlen(globals.SKYPOPEN_INTERFACES[i].name)
|
||||||
&& (strncmp(globals.SKYPOPEN_INTERFACES[i].name, hint, strlen(hint)) == 0)) {
|
&& (strncmp(globals.SKYPOPEN_INTERFACES[i].name, hint, strlen(hint)) == 0)) {
|
||||||
tech_pvt = &globals.SKYPOPEN_INTERFACES[i];
|
tech_pvt = &globals.SKYPOPEN_INTERFACES[i];
|
||||||
DEBUGA_SKYPE("Using interface: globals.SKYPOPEN_INTERFACES[%d].name=|||%s|||\n", SKYPOPEN_P_LOG, i, globals.SKYPOPEN_INTERFACES[i].name);
|
DEBUGA_SKYPE("Using interface: globals.SKYPOPEN_INTERFACES[%d].name=|||%s|||\n", SKYPOPEN_P_LOG, i,
|
||||||
|
globals.SKYPOPEN_INTERFACES[i].name);
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1825,7 +1828,8 @@ static switch_status_t chat_send(const char *proto, const char *from, const char
|
|||||||
if (strlen(globals.SKYPOPEN_INTERFACES[i].name)
|
if (strlen(globals.SKYPOPEN_INTERFACES[i].name)
|
||||||
&& (strncmp(globals.SKYPOPEN_INTERFACES[i].skype_user, from, strlen(from)) == 0)) {
|
&& (strncmp(globals.SKYPOPEN_INTERFACES[i].skype_user, from, strlen(from)) == 0)) {
|
||||||
tech_pvt = &globals.SKYPOPEN_INTERFACES[i];
|
tech_pvt = &globals.SKYPOPEN_INTERFACES[i];
|
||||||
DEBUGA_SKYPE("Using interface: globals.SKYPOPEN_INTERFACES[%d].name=|||%s|||\n", SKYPOPEN_P_LOG, i, globals.SKYPOPEN_INTERFACES[i].name);
|
DEBUGA_SKYPE("Using interface: globals.SKYPOPEN_INTERFACES[%d].name=|||%s|||\n", SKYPOPEN_P_LOG, i,
|
||||||
|
globals.SKYPOPEN_INTERFACES[i].name);
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1880,17 +1884,18 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load)
|
|||||||
memset(&globals, '\0', sizeof(globals));
|
memset(&globals, '\0', sizeof(globals));
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel)
|
// CLOUDTREE (Thomas Hazel)
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
// XXX: these assumes no one will override
|
// XXX: these assumes no one will override
|
||||||
XSetErrorHandler(X11_errors_handler);
|
XSetErrorHandler(X11_errors_handler);
|
||||||
XSetIOErrorHandler(xio_error_handler);
|
XSetIOErrorHandler(xio_error_handler);
|
||||||
|
|
||||||
memset(&global_handles_list, 0, sizeof(global_handles_list));
|
memset(&global_handles_list, 0, sizeof(global_handles_list));
|
||||||
switch_mutex_init(&globals.list_mutex, SWITCH_MUTEX_NESTED, skypopen_module_pool);
|
switch_mutex_init(&globals.list_mutex, SWITCH_MUTEX_NESTED, skypopen_module_pool);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel) - load_configs no longer locks things up, no need to fail load
|
// CLOUDTREE (Thomas Hazel) - load_configs no longer locks things up, no need to fail load
|
||||||
/*if (*/ load_config(FULL_RELOAD); /* != SWITCH_STATUS_SUCCESS) {
|
/*if ( */ load_config(FULL_RELOAD);
|
||||||
|
/* != SWITCH_STATUS_SUCCESS) {
|
||||||
running = 0;
|
running = 0;
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
@ -1919,7 +1924,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load)
|
|||||||
|
|
||||||
SWITCH_ADD_API(commands_api_interface, "sk", "Skypopen console commands", sk_function, SK_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "sk", "Skypopen console commands", sk_function, SK_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "skypopen", "Skypopen interface commands", skypopen_function, SKYPOPEN_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "skypopen", "Skypopen interface commands", skypopen_function, SKYPOPEN_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "skypopen_chat", "Skypopen_chat interface remote_skypename TEXT", skypopen_chat_function, SKYPOPEN_CHAT_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "skypopen_chat", "Skypopen_chat interface remote_skypename TEXT", skypopen_chat_function,
|
||||||
|
SKYPOPEN_CHAT_SYNTAX);
|
||||||
SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send);
|
SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send);
|
||||||
|
|
||||||
/* indicate that the module should continue to be loaded */
|
/* indicate that the module should continue to be loaded */
|
||||||
@ -1960,14 +1966,14 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown)
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (SendMessage(tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypopen_api_thread_func die
|
if (SendMessage(tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypopen_api_thread_func die
|
||||||
DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPOPEN_P_LOG, GetLastError());
|
DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPOPEN_P_LOG, GetLastError());
|
||||||
tech_pvt->skypopen_api_thread=NULL;
|
tech_pvt->skypopen_api_thread = NULL;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (tech_pvt->SkypopenHandles.disp) {
|
if (tech_pvt->SkypopenHandles.disp) {
|
||||||
XEvent e;
|
XEvent e;
|
||||||
Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN",
|
Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN",
|
||||||
False);
|
False);
|
||||||
switch_sleep(1000);//giovanni
|
switch_sleep(1000); //giovanni
|
||||||
XFlush(tech_pvt->SkypopenHandles.disp); //giovanni
|
XFlush(tech_pvt->SkypopenHandles.disp); //giovanni
|
||||||
memset(&e, 0, sizeof(e));
|
memset(&e, 0, sizeof(e));
|
||||||
e.xclient.type = ClientMessage;
|
e.xclient.type = ClientMessage;
|
||||||
@ -2030,22 +2036,22 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown)
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *SWITCH_THREAD_FUNC skypopen_do_tcp_srv_thread(switch_thread_t * thread, void *obj)
|
void *SWITCH_THREAD_FUNC skypopen_do_tcp_srv_thread(switch_thread_t *thread, void *obj)
|
||||||
{
|
{
|
||||||
return skypopen_do_tcp_srv_thread_func(obj);
|
return skypopen_do_tcp_srv_thread_func(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *SWITCH_THREAD_FUNC skypopen_do_tcp_cli_thread(switch_thread_t * thread, void *obj)
|
void *SWITCH_THREAD_FUNC skypopen_do_tcp_cli_thread(switch_thread_t *thread, void *obj)
|
||||||
{
|
{
|
||||||
return skypopen_do_tcp_cli_thread_func(obj);
|
return skypopen_do_tcp_cli_thread_func(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *SWITCH_THREAD_FUNC skypopen_do_skypeapi_thread(switch_thread_t * thread, void *obj)
|
void *SWITCH_THREAD_FUNC skypopen_do_skypeapi_thread(switch_thread_t *thread, void *obj)
|
||||||
{
|
{
|
||||||
return skypopen_do_skypeapi_thread_func(obj);
|
return skypopen_do_skypeapi_thread_func(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dtmf_received(private_t * tech_pvt, char *value)
|
int dtmf_received(private_t *tech_pvt, char *value)
|
||||||
{
|
{
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
switch_channel_t *channel = NULL;
|
switch_channel_t *channel = NULL;
|
||||||
@ -2082,7 +2088,7 @@ int dtmf_received(private_t * tech_pvt, char *value)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int start_audio_threads(private_t * tech_pvt)
|
int start_audio_threads(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
switch_threadattr_t *thd_attr = NULL;
|
switch_threadattr_t *thd_attr = NULL;
|
||||||
|
|
||||||
@ -2144,7 +2150,7 @@ int start_audio_threads(private_t * tech_pvt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int new_inbound_channel(private_t * tech_pvt)
|
int new_inbound_channel(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
switch_channel_t *channel = NULL;
|
switch_channel_t *channel = NULL;
|
||||||
@ -2191,7 +2197,7 @@ int new_inbound_channel(private_t * tech_pvt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int remote_party_is_ringing(private_t * tech_pvt)
|
int remote_party_is_ringing(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
switch_channel_t *channel = NULL;
|
switch_channel_t *channel = NULL;
|
||||||
@ -2222,7 +2228,7 @@ int remote_party_is_ringing(private_t * tech_pvt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int remote_party_is_early_media(private_t * tech_pvt)
|
int remote_party_is_early_media(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
switch_channel_t *channel = NULL;
|
switch_channel_t *channel = NULL;
|
||||||
@ -2253,7 +2259,7 @@ int remote_party_is_early_media(private_t * tech_pvt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int outbound_channel_answered(private_t * tech_pvt)
|
int outbound_channel_answered(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
switch_channel_t *channel = NULL;
|
switch_channel_t *channel = NULL;
|
||||||
@ -2284,7 +2290,7 @@ int outbound_channel_answered(private_t * tech_pvt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private_t *find_available_skypopen_interface_rr(private_t * tech_pvt_calling)
|
private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling)
|
||||||
{
|
{
|
||||||
private_t *tech_pvt = NULL;
|
private_t *tech_pvt = NULL;
|
||||||
int i;
|
int i;
|
||||||
@ -2495,7 +2501,7 @@ SWITCH_STANDARD_API(skypopen_function)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int skypopen_partner_handle_ring(private_t * tech_pvt)
|
int skypopen_partner_handle_ring(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
char msg_to_skype[1024];
|
char msg_to_skype[1024];
|
||||||
int i;
|
int i;
|
||||||
@ -2518,7 +2524,10 @@ int skypopen_partner_handle_ring(private_t * tech_pvt)
|
|||||||
giovatech = &globals.SKYPOPEN_INTERFACES[i];
|
giovatech = &globals.SKYPOPEN_INTERFACES[i];
|
||||||
if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
|
if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
|
||||||
found = 1;
|
found = 1;
|
||||||
DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value);
|
DEBUGA_SKYPE
|
||||||
|
("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n",
|
||||||
|
SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number,
|
||||||
|
value);
|
||||||
if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) {
|
if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) {
|
||||||
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
||||||
} else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) {
|
} else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) {
|
||||||
@ -2593,7 +2602,7 @@ int skypopen_partner_handle_ring(private_t * tech_pvt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_answer(private_t * tech_pvt)
|
int skypopen_answer(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
char msg_to_skype[1024];
|
char msg_to_skype[1024];
|
||||||
int i;
|
int i;
|
||||||
@ -2616,7 +2625,10 @@ int skypopen_answer(private_t * tech_pvt)
|
|||||||
giovatech = &globals.SKYPOPEN_INTERFACES[i];
|
giovatech = &globals.SKYPOPEN_INTERFACES[i];
|
||||||
if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
|
if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
|
||||||
found = 1;
|
found = 1;
|
||||||
DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value);
|
DEBUGA_SKYPE
|
||||||
|
("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n",
|
||||||
|
SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number,
|
||||||
|
value);
|
||||||
if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) {
|
if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) {
|
||||||
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
||||||
} else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) {
|
} else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) {
|
||||||
@ -2691,8 +2703,9 @@ int skypopen_answer(private_t * tech_pvt)
|
|||||||
switch_mutex_unlock(globals.mutex);
|
switch_mutex_unlock(globals.mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//int skypopen_transfer(private_t * tech_pvt, char *id, char *value)
|
//int skypopen_transfer(private_t * tech_pvt, char *id, char *value)
|
||||||
int skypopen_transfer(private_t * tech_pvt)
|
int skypopen_transfer(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
char msg_to_skype[1024];
|
char msg_to_skype[1024];
|
||||||
int i;
|
int i;
|
||||||
@ -2712,12 +2725,13 @@ int skypopen_transfer(private_t * tech_pvt)
|
|||||||
/* let's look for a RINGING one */
|
/* let's look for a RINGING one */
|
||||||
if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
|
if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
|
||||||
found = 1;
|
found = 1;
|
||||||
DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value);
|
DEBUGA_SKYPE
|
||||||
|
("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n",
|
||||||
|
SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number,
|
||||||
|
value);
|
||||||
if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) {
|
if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) {
|
||||||
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
|
||||||
@ -2762,12 +2776,13 @@ int skypopen_transfer(private_t * tech_pvt)
|
|||||||
/* let's look for a DOWN one */
|
/* let's look for a DOWN one */
|
||||||
if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
|
if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds
|
||||||
found = 1;
|
found = 1;
|
||||||
DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value);
|
DEBUGA_SKYPE
|
||||||
|
("FOUND (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n",
|
||||||
|
SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number,
|
||||||
|
value);
|
||||||
if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) {
|
if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) {
|
||||||
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
tech_pvt->interface_state = SKYPOPEN_STATE_DOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
|
|
||||||
@ -2872,7 +2887,7 @@ int skypopen_transfer(private_t * tech_pvt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int incoming_chatmessage(private_t * tech_pvt, int which)
|
int incoming_chatmessage(private_t *tech_pvt, int which)
|
||||||
{
|
{
|
||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
@ -3012,7 +3027,7 @@ int next_port(void)
|
|||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
||||||
struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct SkypopenHandles* handle)
|
struct SkypopenHandles *skypopen_list_add(struct SkypopenList *list, struct SkypopenHandles *handle)
|
||||||
{
|
{
|
||||||
switch_mutex_lock(globals.list_mutex);
|
switch_mutex_lock(globals.list_mutex);
|
||||||
|
|
||||||
@ -3027,8 +3042,8 @@ struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct Skyp
|
|||||||
handle->prev = 0;
|
handle->prev = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
((struct SkypopenHandles*) list->tail)->next = handle;
|
((struct SkypopenHandles *) list->tail)->next = handle;
|
||||||
((struct SkypopenHandles*) handle)->prev = list->tail;
|
((struct SkypopenHandles *) handle)->prev = list->tail;
|
||||||
}
|
}
|
||||||
|
|
||||||
list->tail = handle;
|
list->tail = handle;
|
||||||
@ -3044,36 +3059,36 @@ struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct Skyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
||||||
struct SkypopenHandles* skypopen_list_remove_by_value(struct SkypopenList* list, Display* display)
|
struct SkypopenHandles *skypopen_list_remove_by_value(struct SkypopenList *list, Display * display)
|
||||||
{
|
{
|
||||||
struct SkypopenHandles* iter;
|
struct SkypopenHandles *iter;
|
||||||
struct SkypopenHandles* handle = 0;
|
struct SkypopenHandles *handle = 0;
|
||||||
|
|
||||||
switch_mutex_lock(globals.list_mutex);
|
switch_mutex_lock(globals.list_mutex);
|
||||||
|
|
||||||
iter = (struct SkypopenHandles*) list->head;
|
iter = (struct SkypopenHandles *) list->head;
|
||||||
while (iter != 0) {
|
while (iter != 0) {
|
||||||
if (iter->disp == display) {
|
if (iter->disp == display) {
|
||||||
handle = iter;
|
handle = iter;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
iter = (struct SkypopenHandles*) iter->next;
|
iter = (struct SkypopenHandles *) iter->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((handle != 0) && (handle->managed == SWITCH_TRUE)) {
|
if ((handle != 0) && (handle->managed == SWITCH_TRUE)) {
|
||||||
if (handle->prev == 0) {
|
if (handle->prev == 0) {
|
||||||
list->head = ((struct SkypopenHandles*) handle)->next;
|
list->head = ((struct SkypopenHandles *) handle)->next;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
((struct SkypopenHandles*) handle->prev)->next = ((struct SkypopenHandles*) handle)->next;
|
((struct SkypopenHandles *) handle->prev)->next = ((struct SkypopenHandles *) handle)->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->next == 0) {
|
if (handle->next == 0) {
|
||||||
list->tail = ((struct SkypopenHandles*) handle)->prev;
|
list->tail = ((struct SkypopenHandles *) handle)->prev;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
((struct SkypopenHandles*) handle->next)->prev = ((struct SkypopenHandles*) handle)->prev;
|
((struct SkypopenHandles *) handle->next)->prev = ((struct SkypopenHandles *) handle)->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->managed = SWITCH_FALSE;
|
handle->managed = SWITCH_FALSE;
|
||||||
@ -3089,7 +3104,7 @@ struct SkypopenHandles* skypopen_list_remove_by_value(struct SkypopenList* list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
||||||
struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* list, struct SkypopenHandles* handle)
|
struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *list, struct SkypopenHandles *handle)
|
||||||
{
|
{
|
||||||
switch_mutex_lock(globals.list_mutex);
|
switch_mutex_lock(globals.list_mutex);
|
||||||
|
|
||||||
@ -3100,17 +3115,17 @@ struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* l
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (handle->prev == 0) {
|
if (handle->prev == 0) {
|
||||||
list->head = ((struct SkypopenHandles*) handle)->next;
|
list->head = ((struct SkypopenHandles *) handle)->next;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
((struct SkypopenHandles*) handle->prev)->next = ((struct SkypopenHandles*) handle)->next;
|
((struct SkypopenHandles *) handle->prev)->next = ((struct SkypopenHandles *) handle)->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle->next == 0) {
|
if (handle->next == 0) {
|
||||||
list->tail = ((struct SkypopenHandles*) handle)->prev;
|
list->tail = ((struct SkypopenHandles *) handle)->prev;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
((struct SkypopenHandles*) handle->next)->prev = ((struct SkypopenHandles*) handle)->prev;
|
((struct SkypopenHandles *) handle->next)->prev = ((struct SkypopenHandles *) handle)->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->managed = SWITCH_FALSE;
|
handle->managed = SWITCH_FALSE;
|
||||||
@ -3126,21 +3141,21 @@ struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* l
|
|||||||
|
|
||||||
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
||||||
#ifdef XIO_ERROR_BY_UCONTEXT
|
#ifdef XIO_ERROR_BY_UCONTEXT
|
||||||
struct SkypopenHandles* skypopen_list_find(struct SkypopenList* list, struct SkypopenHandles* find)
|
struct SkypopenHandles *skypopen_list_find(struct SkypopenList *list, struct SkypopenHandles *find)
|
||||||
{
|
{
|
||||||
struct SkypopenHandles* iter;
|
struct SkypopenHandles *iter;
|
||||||
struct SkypopenHandles* handle = NULL;
|
struct SkypopenHandles *handle = NULL;
|
||||||
|
|
||||||
switch_mutex_lock(globals.list_mutex);
|
switch_mutex_lock(globals.list_mutex);
|
||||||
|
|
||||||
iter = (struct SkypopenHandles*) list->head;
|
iter = (struct SkypopenHandles *) list->head;
|
||||||
while (iter != NULL) {
|
while (iter != NULL) {
|
||||||
if (iter == find) {
|
if (iter == find) {
|
||||||
handle = iter;
|
handle = iter;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
iter = (struct SkypopenHandles*) iter->next;
|
iter = (struct SkypopenHandles *) iter->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_mutex_unlock(globals.list_mutex);
|
switch_mutex_unlock(globals.list_mutex);
|
||||||
@ -3150,7 +3165,7 @@ struct SkypopenHandles* skypopen_list_find(struct SkypopenList* list, struct Sky
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list?
|
||||||
int skypopen_list_size(struct SkypopenList* list)
|
int skypopen_list_size(struct SkypopenList *list)
|
||||||
{
|
{
|
||||||
return list->entries;
|
return list->entries;
|
||||||
}
|
}
|
||||||
|
@ -48,11 +48,11 @@
|
|||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel)
|
// CLOUDTREE (Thomas Hazel)
|
||||||
#ifdef XIO_ERROR_BY_SETJMP
|
#ifdef XIO_ERROR_BY_SETJMP
|
||||||
#include "setjmp.h"
|
#include "setjmp.h"
|
||||||
#endif
|
#endif
|
||||||
// CLOUDTREE (Thomas Hazel)
|
// CLOUDTREE (Thomas Hazel)
|
||||||
#ifdef XIO_ERROR_BY_UCONTEXT
|
#ifdef XIO_ERROR_BY_UCONTEXT
|
||||||
#include "ucontext.h"
|
#include "ucontext.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif //WIN32
|
#endif //WIN32
|
||||||
@ -176,32 +176,32 @@ struct SkypopenHandles {
|
|||||||
int fdesc[2];
|
int fdesc[2];
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel)
|
// CLOUDTREE (Thomas Hazel)
|
||||||
#ifdef XIO_ERROR_BY_SETJMP
|
#ifdef XIO_ERROR_BY_SETJMP
|
||||||
jmp_buf ioerror_context;
|
jmp_buf ioerror_context;
|
||||||
#endif
|
#endif
|
||||||
#ifdef XIO_ERROR_BY_UCONTEXT
|
#ifdef XIO_ERROR_BY_UCONTEXT
|
||||||
ucontext_t ioerror_context;
|
ucontext_t ioerror_context;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list?
|
// CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list?
|
||||||
switch_bool_t managed;
|
switch_bool_t managed;
|
||||||
void* prev;
|
void *prev;
|
||||||
void* next;
|
void *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list?
|
// CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list?
|
||||||
struct SkypopenList {
|
struct SkypopenList {
|
||||||
int entries;
|
int entries;
|
||||||
void* head;
|
void *head;
|
||||||
void* tail;
|
void *tail;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list?
|
// CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list?
|
||||||
struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct SkypopenHandles* x);
|
struct SkypopenHandles *skypopen_list_add(struct SkypopenList *list, struct SkypopenHandles *x);
|
||||||
struct SkypopenHandles* skypopen_list_find(struct SkypopenList* list, struct SkypopenHandles* x);
|
struct SkypopenHandles *skypopen_list_find(struct SkypopenList *list, struct SkypopenHandles *x);
|
||||||
struct SkypopenHandles* skypopen_list_remove_by_value(struct SkypopenList* list, Display* display);
|
struct SkypopenHandles *skypopen_list_remove_by_value(struct SkypopenList *list, Display * display);
|
||||||
struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* list, struct SkypopenHandles* x);
|
struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *list, struct SkypopenHandles *x);
|
||||||
int skypopen_list_size(struct SkypopenList* list);
|
int skypopen_list_size(struct SkypopenList *list);
|
||||||
|
|
||||||
#else //WIN32
|
#else //WIN32
|
||||||
|
|
||||||
@ -352,31 +352,31 @@ struct private_object {
|
|||||||
|
|
||||||
typedef struct private_object private_t;
|
typedef struct private_object private_t;
|
||||||
|
|
||||||
void *SWITCH_THREAD_FUNC skypopen_api_thread_func(switch_thread_t * thread, void *obj);
|
void *SWITCH_THREAD_FUNC skypopen_api_thread_func(switch_thread_t *thread, void *obj);
|
||||||
int skypopen_audio_read(private_t * tech_pvt);
|
int skypopen_audio_read(private_t *tech_pvt);
|
||||||
int skypopen_audio_init(private_t * tech_pvt);
|
int skypopen_audio_init(private_t *tech_pvt);
|
||||||
int skypopen_signaling_write(private_t * tech_pvt, char *msg_to_skype);
|
int skypopen_signaling_write(private_t *tech_pvt, char *msg_to_skype);
|
||||||
int skypopen_signaling_read(private_t * tech_pvt);
|
int skypopen_signaling_read(private_t *tech_pvt);
|
||||||
|
|
||||||
int skypopen_call(private_t * tech_pvt, char *idest, int timeout);
|
int skypopen_call(private_t *tech_pvt, char *idest, int timeout);
|
||||||
int skypopen_senddigit(private_t * tech_pvt, char digit);
|
int skypopen_senddigit(private_t *tech_pvt, char digit);
|
||||||
|
|
||||||
void *skypopen_do_tcp_srv_thread_func(void *obj);
|
void *skypopen_do_tcp_srv_thread_func(void *obj);
|
||||||
void *SWITCH_THREAD_FUNC skypopen_do_tcp_srv_thread(switch_thread_t * thread, void *obj);
|
void *SWITCH_THREAD_FUNC skypopen_do_tcp_srv_thread(switch_thread_t *thread, void *obj);
|
||||||
|
|
||||||
void *skypopen_do_tcp_cli_thread_func(void *obj);
|
void *skypopen_do_tcp_cli_thread_func(void *obj);
|
||||||
void *SWITCH_THREAD_FUNC skypopen_do_tcp_cli_thread(switch_thread_t * thread, void *obj);
|
void *SWITCH_THREAD_FUNC skypopen_do_tcp_cli_thread(switch_thread_t *thread, void *obj);
|
||||||
|
|
||||||
void *skypopen_do_skypeapi_thread_func(void *obj);
|
void *skypopen_do_skypeapi_thread_func(void *obj);
|
||||||
void *SWITCH_THREAD_FUNC skypopen_do_skypeapi_thread(switch_thread_t * thread, void *obj);
|
void *SWITCH_THREAD_FUNC skypopen_do_skypeapi_thread(switch_thread_t *thread, void *obj);
|
||||||
int dtmf_received(private_t * tech_pvt, char *value);
|
int dtmf_received(private_t *tech_pvt, char *value);
|
||||||
int start_audio_threads(private_t * tech_pvt);
|
int start_audio_threads(private_t *tech_pvt);
|
||||||
int new_inbound_channel(private_t * tech_pvt);
|
int new_inbound_channel(private_t *tech_pvt);
|
||||||
int outbound_channel_answered(private_t * tech_pvt);
|
int outbound_channel_answered(private_t *tech_pvt);
|
||||||
int skypopen_signaling_write(private_t * tech_pvt, char *msg_to_skype);
|
int skypopen_signaling_write(private_t *tech_pvt, char *msg_to_skype);
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
int skypopen_pipe_read(switch_file_t * pipe, short *buf, int howmany);
|
int skypopen_pipe_read(switch_file_t *pipe, short *buf, int howmany);
|
||||||
int skypopen_pipe_write(switch_file_t * pipe, short *buf, int howmany);
|
int skypopen_pipe_write(switch_file_t *pipe, short *buf, int howmany);
|
||||||
/* Visual C do not have strsep ? */
|
/* Visual C do not have strsep ? */
|
||||||
char *strsep(char **stringp, const char *delim);
|
char *strsep(char **stringp, const char *delim);
|
||||||
#else
|
#else
|
||||||
@ -384,20 +384,20 @@ int skypopen_pipe_read(int pipe, short *buf, int howmany);
|
|||||||
int skypopen_pipe_write(int pipe, short *buf, int howmany);
|
int skypopen_pipe_write(int pipe, short *buf, int howmany);
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
int skypopen_close_socket(unsigned int fd);
|
int skypopen_close_socket(unsigned int fd);
|
||||||
private_t *find_available_skypopen_interface_rr(private_t * tech_pvt_calling);
|
private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling);
|
||||||
int remote_party_is_ringing(private_t * tech_pvt);
|
int remote_party_is_ringing(private_t *tech_pvt);
|
||||||
int remote_party_is_early_media(private_t * tech_pvt);
|
int remote_party_is_early_media(private_t *tech_pvt);
|
||||||
//int skypopen_answer(private_t * tech_pvt, char *id, char *value);
|
//int skypopen_answer(private_t * tech_pvt, char *id, char *value);
|
||||||
int skypopen_answer(private_t * tech_pvt);
|
int skypopen_answer(private_t *tech_pvt);
|
||||||
//int skypopen_transfer(private_t * tech_pvt, char *id, char *value);
|
//int skypopen_transfer(private_t * tech_pvt, char *id, char *value);
|
||||||
int skypopen_transfer(private_t * tech_pvt);
|
int skypopen_transfer(private_t *tech_pvt);
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
int skypopen_socket_create_and_bind(private_t * tech_pvt, int *which_port);
|
int skypopen_socket_create_and_bind(private_t *tech_pvt, int *which_port);
|
||||||
#else
|
#else
|
||||||
int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_port);
|
int skypopen_socket_create_and_bind(private_t *tech_pvt, unsigned short *which_port);
|
||||||
#endif //WIN32
|
#endif //WIN32
|
||||||
int incoming_chatmessage(private_t * tech_pvt, int which);
|
int incoming_chatmessage(private_t *tech_pvt, int which);
|
||||||
int next_port(void);
|
int next_port(void);
|
||||||
int skypopen_partner_handle_ring(private_t * tech_pvt);
|
int skypopen_partner_handle_ring(private_t *tech_pvt);
|
||||||
int skypopen_answered(private_t * tech_pvt);
|
int skypopen_answered(private_t *tech_pvt);
|
||||||
int inbound_channel_answered(private_t * tech_pvt);
|
int inbound_channel_answered(private_t *tech_pvt);
|
||||||
|
@ -30,9 +30,9 @@ extern switch_status_t remove_interface(char *the_interface, switch_bool_t force
|
|||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
/*************************************/
|
/*************************************/
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
int skypopen_socket_create_and_bind(private_t * tech_pvt, int *which_port)
|
int skypopen_socket_create_and_bind(private_t *tech_pvt, int *which_port)
|
||||||
#else
|
#else
|
||||||
int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_port)
|
int skypopen_socket_create_and_bind(private_t *tech_pvt, unsigned short *which_port)
|
||||||
#endif //WIN32
|
#endif //WIN32
|
||||||
{
|
{
|
||||||
int s = -1;
|
int s = -1;
|
||||||
@ -107,7 +107,7 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_
|
|||||||
sockbufsize = SAMPLES_PER_FRAME * 8;
|
sockbufsize = SAMPLES_PER_FRAME * 8;
|
||||||
#endif //WIN32
|
#endif //WIN32
|
||||||
size = sizeof(int);
|
size = sizeof(int);
|
||||||
if(tech_pvt->setsockopt){
|
if (tech_pvt->setsockopt) {
|
||||||
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, size);
|
setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_
|
|||||||
sockbufsize = SAMPLES_PER_FRAME * 8;
|
sockbufsize = SAMPLES_PER_FRAME * 8;
|
||||||
#endif //WIN32
|
#endif //WIN32
|
||||||
size = sizeof(int);
|
size = sizeof(int);
|
||||||
if(tech_pvt->setsockopt){
|
if (tech_pvt->setsockopt) {
|
||||||
setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, size);
|
setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_
|
|||||||
getsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, &size);
|
getsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, &size);
|
||||||
DEBUGA_SKYPE("TCP_NODELAY is %d\n", SKYPOPEN_P_LOG, flag);
|
DEBUGA_SKYPE("TCP_NODELAY is %d\n", SKYPOPEN_P_LOG, flag);
|
||||||
flag = 1;
|
flag = 1;
|
||||||
if(tech_pvt->setsockopt){
|
if (tech_pvt->setsockopt) {
|
||||||
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, size);
|
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, size);
|
||||||
}
|
}
|
||||||
flag = 0;
|
flag = 0;
|
||||||
@ -152,7 +152,7 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_signaling_read(private_t * tech_pvt)
|
int skypopen_signaling_read(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
char read_from_pipe[4096];
|
char read_from_pipe[4096];
|
||||||
char message[4096];
|
char message[4096];
|
||||||
@ -178,7 +178,7 @@ int skypopen_signaling_read(private_t * tech_pvt)
|
|||||||
|
|
||||||
//if (!strstr(message, "DURATION")) {
|
//if (!strstr(message, "DURATION")) {
|
||||||
DEBUGA_SKYPE("READING: |||%s||| \n", SKYPOPEN_P_LOG, message);
|
DEBUGA_SKYPE("READING: |||%s||| \n", SKYPOPEN_P_LOG, message);
|
||||||
strncpy( tech_pvt->message, message, sizeof(tech_pvt->message) );
|
strncpy(tech_pvt->message, message, sizeof(tech_pvt->message));
|
||||||
|
|
||||||
//}
|
//}
|
||||||
if (!strcasecmp(message, "SILENT_MODE OFF")) {
|
if (!strcasecmp(message, "SILENT_MODE OFF")) {
|
||||||
@ -523,19 +523,19 @@ int skypopen_signaling_read(private_t * tech_pvt)
|
|||||||
}
|
}
|
||||||
if (!strcasecmp(prop, "DURATION")) { /* each 20 seconds, we zero the buffers and sync the timers */
|
if (!strcasecmp(prop, "DURATION")) { /* each 20 seconds, we zero the buffers and sync the timers */
|
||||||
if (!((atoi(value) % 20))) {
|
if (!((atoi(value) % 20))) {
|
||||||
if(tech_pvt->read_buffer){
|
if (tech_pvt->read_buffer) {
|
||||||
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
||||||
switch_buffer_zero(tech_pvt->read_buffer);
|
switch_buffer_zero(tech_pvt->read_buffer);
|
||||||
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){
|
if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) {
|
||||||
switch_core_timer_sync(&tech_pvt->timer_read);
|
switch_core_timer_sync(&tech_pvt->timer_read);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
switch_mutex_unlock(tech_pvt->mutex_audio_srv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tech_pvt->write_buffer){
|
if (tech_pvt->write_buffer) {
|
||||||
switch_mutex_lock(tech_pvt->mutex_audio_cli);
|
switch_mutex_lock(tech_pvt->mutex_audio_cli);
|
||||||
switch_buffer_zero(tech_pvt->write_buffer);
|
switch_buffer_zero(tech_pvt->write_buffer);
|
||||||
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){
|
if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) {
|
||||||
switch_core_timer_sync(&tech_pvt->timer_write);
|
switch_core_timer_sync(&tech_pvt->timer_write);
|
||||||
}
|
}
|
||||||
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
||||||
@ -571,7 +571,8 @@ int skypopen_signaling_read(private_t * tech_pvt)
|
|||||||
skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||||
|
|
||||||
/* we are NOT inside an active call */
|
/* we are NOT inside an active call */
|
||||||
DEBUGA_SKYPE("NO ACTIVE calls in this moment, skype_call %s is RINGING, to ask PARTNER_DISPNAME and PARTNER_HANDLE\n", SKYPOPEN_P_LOG, id);
|
DEBUGA_SKYPE("NO ACTIVE calls in this moment, skype_call %s is RINGING, to ask PARTNER_DISPNAME and PARTNER_HANDLE\n",
|
||||||
|
SKYPOPEN_P_LOG, id);
|
||||||
sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id);
|
sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id);
|
||||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||||
skypopen_sleep(100);
|
skypopen_sleep(100);
|
||||||
@ -589,9 +590,10 @@ int skypopen_signaling_read(private_t * tech_pvt)
|
|||||||
tech_pvt->interface_state = SKYPOPEN_STATE_RINGING;
|
tech_pvt->interface_state = SKYPOPEN_STATE_RINGING;
|
||||||
skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
skypopen_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", SKYPOPEN_P_LOG, id);
|
DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPOPEN_P_LOG, id);
|
||||||
if( !remote_party_is_ringing(tech_pvt)){
|
if (!remote_party_is_ringing(tech_pvt)) {
|
||||||
|
|
||||||
WARNINGA("We are getting the RINGING from a call we canceled, trying to get out hanging up call id: %s.\n", SKYPOPEN_P_LOG, id);
|
WARNINGA("We are getting the RINGING from a call we canceled, trying to get out hanging up call id: %s.\n",
|
||||||
|
SKYPOPEN_P_LOG, id);
|
||||||
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
|
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
|
||||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||||
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id);
|
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id);
|
||||||
@ -889,7 +891,7 @@ void *skypopen_do_tcp_srv_thread_func(void *obj)
|
|||||||
nospace = 0;
|
nospace = 0;
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
switch_mutex_lock(tech_pvt->mutex_audio_srv);
|
||||||
if(tech_pvt->read_buffer){
|
if (tech_pvt->read_buffer) {
|
||||||
if (switch_buffer_freespace(tech_pvt->read_buffer) < len) {
|
if (switch_buffer_freespace(tech_pvt->read_buffer) < len) {
|
||||||
switch_buffer_zero(tech_pvt->read_buffer);
|
switch_buffer_zero(tech_pvt->read_buffer);
|
||||||
nospace = 1;
|
nospace = 1;
|
||||||
@ -1045,11 +1047,11 @@ void *skypopen_do_tcp_cli_thread_func(void *obj)
|
|||||||
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
||||||
|
|
||||||
if (!bytes_to_write) {
|
if (!bytes_to_write) {
|
||||||
if(tech_pvt->write_silence_when_idle){
|
if (tech_pvt->write_silence_when_idle) {
|
||||||
memset(cli_out, 255, sizeof(cli_out));
|
memset(cli_out, 255, sizeof(cli_out));
|
||||||
bytes_to_write = 640;
|
bytes_to_write = 640;
|
||||||
//DEBUGA_SKYPE("WRITE Silence!\n", SKYPOPEN_P_LOG);
|
//DEBUGA_SKYPE("WRITE Silence!\n", SKYPOPEN_P_LOG);
|
||||||
}else{
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1088,7 +1090,7 @@ void *skypopen_do_tcp_cli_thread_func(void *obj)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_senddigit(private_t * tech_pvt, char digit)
|
int skypopen_senddigit(private_t *tech_pvt, char digit)
|
||||||
{
|
{
|
||||||
char msg_to_skype[1024];
|
char msg_to_skype[1024];
|
||||||
|
|
||||||
@ -1099,7 +1101,7 @@ int skypopen_senddigit(private_t * tech_pvt, char digit)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_call(private_t * tech_pvt, char *rdest, int timeout)
|
int skypopen_call(private_t *tech_pvt, char *rdest, int timeout)
|
||||||
{
|
{
|
||||||
char msg_to_skype[1024];
|
char msg_to_skype[1024];
|
||||||
|
|
||||||
@ -1117,7 +1119,7 @@ int skypopen_call(private_t * tech_pvt, char *rdest, int timeout)
|
|||||||
/* PLATFORM SPECIFIC */
|
/* PLATFORM SPECIFIC */
|
||||||
/***************************/
|
/***************************/
|
||||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||||
int skypopen_pipe_read(switch_file_t * pipe, short *buf, int howmany)
|
int skypopen_pipe_read(switch_file_t *pipe, short *buf, int howmany)
|
||||||
{
|
{
|
||||||
switch_size_t quantity;
|
switch_size_t quantity;
|
||||||
|
|
||||||
@ -1130,7 +1132,7 @@ int skypopen_pipe_read(switch_file_t * pipe, short *buf, int howmany)
|
|||||||
return howmany;
|
return howmany;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_pipe_write(switch_file_t * pipe, short *buf, int howmany)
|
int skypopen_pipe_write(switch_file_t *pipe, short *buf, int howmany)
|
||||||
{
|
{
|
||||||
switch_size_t quantity;
|
switch_size_t quantity;
|
||||||
|
|
||||||
@ -1152,7 +1154,7 @@ int skypopen_close_socket(unsigned int fd)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_audio_init(private_t * tech_pvt)
|
int skypopen_audio_init(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
switch_status_t rv;
|
switch_status_t rv;
|
||||||
rv = switch_file_pipe_create(&tech_pvt->audiopipe_srv[0], &tech_pvt->audiopipe_srv[1], skypopen_module_pool);
|
rv = switch_file_pipe_create(&tech_pvt->audiopipe_srv[0], &tech_pvt->audiopipe_srv[1], skypopen_module_pool);
|
||||||
@ -1185,7 +1187,7 @@ int skypopen_close_socket(unsigned int fd)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_audio_init(private_t * tech_pvt)
|
int skypopen_audio_init(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
if (pipe(tech_pvt->audiopipe_srv)) {
|
if (pipe(tech_pvt->audiopipe_srv)) {
|
||||||
fcntl(tech_pvt->audiopipe_srv[0], F_SETFL, O_NONBLOCK);
|
fcntl(tech_pvt->audiopipe_srv[0], F_SETFL, O_NONBLOCK);
|
||||||
@ -1248,7 +1250,7 @@ char
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_signaling_write(private_t * tech_pvt, char *msg_to_skype)
|
int skypopen_signaling_write(private_t *tech_pvt, char *msg_to_skype)
|
||||||
{
|
{
|
||||||
static char acInputRow[1024];
|
static char acInputRow[1024];
|
||||||
COPYDATASTRUCT oCopyData;
|
COPYDATASTRUCT oCopyData;
|
||||||
@ -1355,7 +1357,7 @@ LRESULT APIENTRY skypopen_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
|
|||||||
return (lReturnCode);
|
return (lReturnCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
int win32_Initialize_CreateWindowClass(private_t * tech_pvt)
|
int win32_Initialize_CreateWindowClass(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
unsigned char *paucUUIDString;
|
unsigned char *paucUUIDString;
|
||||||
RPC_STATUS lUUIDResult;
|
RPC_STATUS lUUIDResult;
|
||||||
@ -1395,14 +1397,14 @@ int win32_Initialize_CreateWindowClass(private_t * tech_pvt)
|
|||||||
return (fReturnStatus);
|
return (fReturnStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win32_DeInitialize_DestroyWindowClass(private_t * tech_pvt)
|
void win32_DeInitialize_DestroyWindowClass(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
UnregisterClass(tech_pvt->SkypopenHandles.win32_acInit_WindowClassName, tech_pvt->SkypopenHandles.win32_hInit_ProcessHandle);
|
UnregisterClass(tech_pvt->SkypopenHandles.win32_acInit_WindowClassName, tech_pvt->SkypopenHandles.win32_hInit_ProcessHandle);
|
||||||
CloseHandle(tech_pvt->SkypopenHandles.win32_hInit_ProcessHandle);
|
CloseHandle(tech_pvt->SkypopenHandles.win32_hInit_ProcessHandle);
|
||||||
tech_pvt->SkypopenHandles.win32_hInit_ProcessHandle = NULL;
|
tech_pvt->SkypopenHandles.win32_hInit_ProcessHandle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int win32_Initialize_CreateMainWindow(private_t * tech_pvt)
|
int win32_Initialize_CreateMainWindow(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle =
|
tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle =
|
||||||
CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
|
CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE,
|
||||||
@ -1412,7 +1414,7 @@ int win32_Initialize_CreateMainWindow(private_t * tech_pvt)
|
|||||||
return (tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle != NULL ? 1 : 0);
|
return (tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle != NULL ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win32_DeInitialize_DestroyMainWindow(private_t * tech_pvt)
|
void win32_DeInitialize_DestroyMainWindow(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
if (tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle != NULL)
|
if (tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle != NULL)
|
||||||
DestroyWindow(tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle), tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle = NULL;
|
DestroyWindow(tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle), tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle = NULL;
|
||||||
@ -1462,7 +1464,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||||||
win32_DeInitialize_DestroyWindowClass(tech_pvt);
|
win32_DeInitialize_DestroyWindowClass(tech_pvt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tech_pvt->skypopen_api_thread=NULL;
|
tech_pvt->skypopen_api_thread = NULL;
|
||||||
DEBUGA_SKYPE("EXITING\n", SKYPOPEN_P_LOG);
|
DEBUGA_SKYPE("EXITING\n", SKYPOPEN_P_LOG);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1470,24 +1472,24 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||||||
#else /* NOT WIN32 */
|
#else /* NOT WIN32 */
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel)
|
// CLOUDTREE (Thomas Hazel)
|
||||||
int xio_error_handler(Display *dpy)
|
int xio_error_handler(Display * dpy)
|
||||||
{
|
{
|
||||||
private_t *tech_pvt = NULL;
|
private_t *tech_pvt = NULL;
|
||||||
struct SkypopenHandles* handle;
|
struct SkypopenHandles *handle;
|
||||||
|
|
||||||
ERRORA("Fatal display error for %d, %s\n", SKYPOPEN_P_LOG, skypopen_list_size(&global_handles_list), dpy->display_name);
|
ERRORA("Fatal display error for %d, %s\n", SKYPOPEN_P_LOG, skypopen_list_size(&global_handles_list), dpy->display_name);
|
||||||
|
|
||||||
handle = skypopen_list_remove_by_value(&global_handles_list, dpy);
|
handle = skypopen_list_remove_by_value(&global_handles_list, dpy);
|
||||||
if (handle != NULL) {
|
if (handle != NULL) {
|
||||||
#ifdef XIO_ERROR_BY_SETJMP
|
#ifdef XIO_ERROR_BY_SETJMP
|
||||||
siglongjmp(handle->ioerror_context, 1);
|
siglongjmp(handle->ioerror_context, 1);
|
||||||
#endif
|
#endif
|
||||||
#ifdef XIO_ERROR_BY_UCONTEXT
|
#ifdef XIO_ERROR_BY_UCONTEXT
|
||||||
setcontext(&handle->ioerror_context);
|
setcontext(&handle->ioerror_context);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ERRORA("Fatal display error for %p, %s - failed to siglongjmp\n", SKYPOPEN_P_LOG, (void*) handle, dpy->display_name);
|
ERRORA("Fatal display error for %p, %s - failed to siglongjmp\n", SKYPOPEN_P_LOG, (void *) handle, dpy->display_name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1502,7 +1504,7 @@ int X11_errors_handler(Display * dpy, XErrorEvent * err)
|
|||||||
return 0; /* ignore the error */
|
return 0; /* ignore the error */
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_send_message(private_t * tech_pvt, const char *message_P)
|
int skypopen_send_message(private_t *tech_pvt, const char *message_P)
|
||||||
{
|
{
|
||||||
struct SkypopenHandles *SkypopenHandles = &tech_pvt->SkypopenHandles;
|
struct SkypopenHandles *SkypopenHandles = &tech_pvt->SkypopenHandles;
|
||||||
Window w_P = SkypopenHandles->skype_win;
|
Window w_P = SkypopenHandles->skype_win;
|
||||||
@ -1516,8 +1518,8 @@ int skypopen_send_message(private_t * tech_pvt, const char *message_P)
|
|||||||
unsigned int len = strlen(message_P);
|
unsigned int len = strlen(message_P);
|
||||||
XEvent e;
|
XEvent e;
|
||||||
|
|
||||||
skypopen_sleep(1000);//giovanni
|
skypopen_sleep(1000); //giovanni
|
||||||
XFlush(disp);//giovanni
|
XFlush(disp); //giovanni
|
||||||
|
|
||||||
memset(&e, 0, sizeof(e));
|
memset(&e, 0, sizeof(e));
|
||||||
e.xclient.type = ClientMessage;
|
e.xclient.type = ClientMessage;
|
||||||
@ -1552,7 +1554,7 @@ skypopen_sleep(1000);//giovanni
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skypopen_signaling_write(private_t * tech_pvt, char *msg_to_skype)
|
int skypopen_signaling_write(private_t *tech_pvt, char *msg_to_skype)
|
||||||
{
|
{
|
||||||
|
|
||||||
DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPOPEN_P_LOG, msg_to_skype);
|
DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPOPEN_P_LOG, msg_to_skype);
|
||||||
@ -1661,11 +1663,11 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel)
|
// CLOUDTREE (Thomas Hazel)
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
{
|
{
|
||||||
skypopen_list_add(&global_handles_list, SkypopenHandles);
|
skypopen_list_add(&global_handles_list, SkypopenHandles);
|
||||||
|
|
||||||
#ifdef XIO_ERROR_BY_SETJMP
|
#ifdef XIO_ERROR_BY_SETJMP
|
||||||
if (sigsetjmp(SkypopenHandles->ioerror_context, 1) != 0) {
|
if (sigsetjmp(SkypopenHandles->ioerror_context, 1) != 0) {
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display);
|
ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display);
|
||||||
@ -1684,8 +1686,8 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef XIO_ERROR_BY_UCONTEXT
|
#ifdef XIO_ERROR_BY_UCONTEXT
|
||||||
getcontext(&SkypopenHandles->ioerror_context);
|
getcontext(&SkypopenHandles->ioerror_context);
|
||||||
|
|
||||||
if (skypopen_list_find(&global_handles_list, SkypopenHandles) == NULL) {
|
if (skypopen_list_find(&global_handles_list, SkypopenHandles) == NULL) {
|
||||||
@ -1706,9 +1708,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* NOT WIN32 */
|
#endif /* NOT WIN32 */
|
||||||
|
|
||||||
xfd = XConnectionNumber(disp);
|
xfd = XConnectionNumber(disp);
|
||||||
fcntl(xfd, F_SETFD, FD_CLOEXEC);
|
fcntl(xfd, F_SETFD, FD_CLOEXEC);
|
||||||
@ -1727,9 +1729,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||||||
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypopen again\n", SKYPOPEN_P_LOG);
|
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypopen again\n", SKYPOPEN_P_LOG);
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel)
|
// CLOUDTREE (Thomas Hazel)
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles);
|
skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
running = 0;
|
running = 0;
|
||||||
@ -1741,9 +1743,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||||||
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypopen again\n", SKYPOPEN_P_LOG);
|
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypopen again\n", SKYPOPEN_P_LOG);
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel)
|
// CLOUDTREE (Thomas Hazel)
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles);
|
skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
running = 0;
|
running = 0;
|
||||||
@ -1779,9 +1781,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (select(xfd+1, &xfds, 0, 0, &tv)){
|
if (select(xfd + 1, &xfds, 0, 0, &tv)) {
|
||||||
|
|
||||||
while(XPending(disp)){
|
while (XPending(disp)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1860,8 +1862,8 @@ while(XPending(disp)){
|
|||||||
} //switch event.type
|
} //switch event.type
|
||||||
} //while XPending
|
} //while XPending
|
||||||
|
|
||||||
} // if select
|
} // if select
|
||||||
} //while running
|
} //while running
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1876,18 +1878,18 @@ while(XPending(disp)){
|
|||||||
NOTICA("EXITING\n", SKYPOPEN_P_LOG);
|
NOTICA("EXITING\n", SKYPOPEN_P_LOG);
|
||||||
|
|
||||||
// CLOUDTREE (Thomas Hazel)
|
// CLOUDTREE (Thomas Hazel)
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles);
|
skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tech_pvt->skypopen_api_thread=NULL;
|
tech_pvt->skypopen_api_thread = NULL;
|
||||||
XCloseDisplay(disp);
|
XCloseDisplay(disp);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
|
|
||||||
int inbound_channel_answered(private_t * tech_pvt)
|
int inbound_channel_answered(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
@ -1911,7 +1913,7 @@ int inbound_channel_answered(private_t * tech_pvt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int skypopen_answered(private_t * tech_pvt)
|
int skypopen_answered(private_t *tech_pvt)
|
||||||
{
|
{
|
||||||
|
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user