FS-4916 fixed
This commit is contained in:
parent
d1ecaa53d9
commit
b9a8ce5670
|
@ -621,6 +621,11 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session)
|
|||
|
||||
if (strlen(tech_pvt->skype_call_id)) {
|
||||
DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id);
|
||||
if(strlen(tech_pvt->skype_voicemail_id)){
|
||||
sprintf(msg_to_skype, "ALTER VOICEMAIL %s STOPRECORDING", tech_pvt->skype_voicemail_id);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
switch_sleep(MS_SKYPOPEN * 1000 * 3);//XXX FIXME ??
|
||||
}
|
||||
sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id);
|
||||
|
@ -882,7 +887,10 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
//DEBUGA_SKYPE("skypopen_audio_read going back to read\n", SKYPOPEN_P_LOG);
|
||||
goto read;
|
||||
}
|
||||
DEBUGA_SKYPE("READ BUFFER EMPTY, skypopen_audio_read Silence\n", SKYPOPEN_P_LOG);
|
||||
|
||||
if (!strlen(tech_pvt->skype_voicemail_id)) {
|
||||
DEBUGA_SKYPE("READ BUFFER EMPTY, skypopen_audio_read Silence\n", SKYPOPEN_P_LOG);
|
||||
}
|
||||
memset(tech_pvt->read_frame.data, 255, BYTES_PER_FRAME);
|
||||
tech_pvt->read_frame.datalen = BYTES_PER_FRAME;
|
||||
|
||||
|
@ -1030,7 +1038,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
|||
}
|
||||
switch_buffer_write(tech_pvt->write_buffer, frame->data, frame->datalen);
|
||||
switch_mutex_unlock(tech_pvt->mutex_audio_cli);
|
||||
if (no_space) {
|
||||
if (no_space && !strlen(tech_pvt->skype_voicemail_id)) {
|
||||
//switch_sleep(MS_SKYPOPEN * 1000);
|
||||
DEBUGA_SKYPE("NO SPACE in WRITE BUFFER: there was no space for %d\n", SKYPOPEN_P_LOG, frame->datalen);
|
||||
}
|
||||
|
@ -1797,7 +1805,7 @@ static switch_status_t load_config(int reload_type)
|
|||
("Interface_id=%d is now STARTED, the Skype client to which we are connected gave us the correct CURRENTUSERHANDLE (%s)\n",
|
||||
SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].skype_user);
|
||||
|
||||
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "PROTOCOL 7");
|
||||
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "PROTOCOL 999");
|
||||
switch_sleep(20000);
|
||||
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET AUTOAWAY OFF");
|
||||
switch_sleep(20000);
|
||||
|
|
|
@ -357,6 +357,7 @@ struct private_object {
|
|||
char ring_value[256];
|
||||
|
||||
char message[4096];
|
||||
char skype_voicemail_id[512];
|
||||
};
|
||||
|
||||
typedef struct private_object private_t;
|
||||
|
|
|
@ -219,7 +219,7 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
|||
("If I don't connect immediately, please give the Skype client authorization to be connected by Skypopen (and to not ask you again)\n",
|
||||
SKYPOPEN_P_LOG);
|
||||
skypopen_sleep(1000000);
|
||||
skypopen_signaling_write(tech_pvt, "PROTOCOL 7");
|
||||
skypopen_signaling_write(tech_pvt, "PROTOCOL 999");
|
||||
skypopen_sleep(20000);
|
||||
return 0;
|
||||
}
|
||||
|
@ -539,6 +539,37 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
|||
}
|
||||
|
||||
|
||||
if (!strcasecmp(message, "VOICEMAIL")) {
|
||||
char msg_to_skype[1024];
|
||||
|
||||
skypopen_strncpy(obj, where, sizeof(obj) - 1);
|
||||
where = strsep(stringp, " ");
|
||||
skypopen_strncpy(id, where, sizeof(id) - 1);
|
||||
where = strsep(stringp, " ");
|
||||
skypopen_strncpy(prop, where, sizeof(prop) - 1);
|
||||
where = strsep(stringp, " ");
|
||||
skypopen_strncpy(value, where, sizeof(value) - 1);
|
||||
where = strsep(stringp, " ");
|
||||
|
||||
//DEBUGA_SKYPE
|
||||
//("Skype MSG: message: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
|
||||
//SKYPOPEN_P_LOG, message, obj, id, prop, value, where ? where : "NULL");
|
||||
|
||||
if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "RECORDING") ) {
|
||||
DEBUGA_SKYPE("VOICEMAIL %s INPUT\n", SKYPOPEN_P_LOG, id);
|
||||
sprintf(msg_to_skype, "ALTER VOICEMAIL %s SET_INPUT PORT=\"%d\"", id, tech_pvt->tcp_cli_port);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
} else if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "PLAYING") ) {
|
||||
DEBUGA_SKYPE("VOICEMAIL %s OUTPUT\n", SKYPOPEN_P_LOG, id);
|
||||
sprintf(msg_to_skype, "ALTER VOICEMAIL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
|
||||
} else if (!strcasecmp(prop, "TYPE") && !strcasecmp(value, "OUTGOING") ) {
|
||||
DEBUGA_SKYPE("VOICEMAIL OUTGOING id is %s\n", SKYPOPEN_P_LOG, id);
|
||||
sprintf(tech_pvt->skype_voicemail_id, "%s", id);
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcasecmp(message, "CALL")) {
|
||||
skypopen_strncpy(obj, where, sizeof(obj) - 1);
|
||||
where = strsep(stringp, " ");
|
||||
|
@ -665,12 +696,6 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
|||
return CALLFLOW_INCOMING_HANGUP;
|
||||
}
|
||||
}
|
||||
//skypopen_sleep(1000);
|
||||
sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, tech_pvt->tcp_cli_port);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
//skypopen_sleep(1000);
|
||||
sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
}
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
|
||||
if (skypopen_answered(tech_pvt) != SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -986,15 +1011,15 @@ void *skypopen_do_tcp_srv_thread_func(void *obj)
|
|||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|
||||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) {
|
||||
|
||||
//unsigned int fdselect;
|
||||
unsigned int fdselect;
|
||||
int rt = 1;
|
||||
//fd_set fs;
|
||||
//struct timeval to;
|
||||
fd_set fs;
|
||||
struct timeval to;
|
||||
int nospace;
|
||||
|
||||
if (!(running && tech_pvt->running))
|
||||
break;
|
||||
#if 0
|
||||
#if 1
|
||||
fdselect = fd;
|
||||
FD_ZERO(&fs);
|
||||
FD_SET(fdselect, &fs);
|
||||
|
@ -1008,7 +1033,7 @@ void *skypopen_do_tcp_srv_thread_func(void *obj)
|
|||
skypopen_sleep(20000);
|
||||
|
||||
}
|
||||
//rt = select(fdselect + 1, &fs, NULL, NULL, &to);
|
||||
rt = select(fdselect + 1, &fs, NULL, NULL, &to);
|
||||
if (rt > 0) {
|
||||
|
||||
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
|
||||
|
@ -1945,7 +1970,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
snprintf(buf, 512, "PROTOCOL 7");
|
||||
snprintf(buf, 512, "PROTOCOL 999");
|
||||
if (!skypopen_send_message(tech_pvt, buf)) {
|
||||
ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypopen again\n", SKYPOPEN_P_LOG);
|
||||
|
||||
|
|
Loading…
Reference in New Issue