skypiax: now it manages the REMOTEHOLD status, when the remote party puts the call on-hold

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13667 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Giovanni Maruzzelli 2009-06-06 23:59:27 +00:00
parent e8a262b729
commit 0b0d4077c1
2 changed files with 123 additions and 96 deletions

View File

@ -126,6 +126,7 @@ typedef enum {
#define SKYPIAX_STATE_HANGUP_REQUESTED 200
//FIXME CALLFLOW_INCOMING_CALLID to be removed
#define CALLFLOW_INCOMING_CALLID 1019
#define CALLFLOW_STATUS_REMOTEHOLD 201
/*********************************/

View File

@ -372,11 +372,13 @@ int skypiax_signaling_read(private_t * tech_pvt)
} else if (!strcasecmp(value, "INPROGRESS")) {
char msg_to_skype[1024];
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
if (!strlen(tech_pvt->session_uuid_str) || !strlen(tech_pvt->skype_call_id)
|| !strcasecmp(tech_pvt->skype_call_id, id)) {
skypiax_strncpy(tech_pvt->skype_call_id, id,
sizeof(tech_pvt->skype_call_id) - 1);
DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_EARLYMEDIA) {
tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
tech_pvt->interface_state = SKYPIAX_STATE_UP;
@ -402,6 +404,14 @@ int skypiax_signaling_read(private_t * tech_pvt)
DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n",
SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
}
} else {
tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
WARNINGA("Back from REMOTEHOLD!\n", SKYPIAX_P_LOG);
}
} else if (!strcasecmp(value, "REMOTEHOLD")) {
tech_pvt->skype_callflow = CALLFLOW_STATUS_REMOTEHOLD;
WARNINGA("skype_call: %s is now REMOTEHOLD\n", SKYPIAX_P_LOG, id);
} else {
WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPIAX_P_LOG, id,
value);
@ -485,6 +495,7 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
&& (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD
|| tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
unsigned int fdselect;
@ -508,7 +519,11 @@ void *skypiax_do_tcp_srv_thread_func(void *obj)
#ifdef FARMING
switch_sleep(500); //seems that reconnecting through a proxy leads to half the packet size, bizarrely, 158-162, never 160 :-)
#endif // FARMING
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
len = recv(fd, (char *) srv_in, 320, 0); //seems that Skype only sends 320 bytes at time
} else {
len = 0;
}
if (len == 320) {
unsigned int howmany;
@ -642,6 +657,7 @@ void *skypiax_do_tcp_cli_thread_func(void *obj)
while (tech_pvt->interface_state != SKYPIAX_STATE_DOWN
&& (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD
|| tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
unsigned int fdselect;
int rt;
@ -699,6 +715,7 @@ void *skypiax_do_tcp_cli_thread_func(void *obj)
}
/* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
len = send(fd, (char *) cli_out, got, 0);
skypiax_sleep(5000); //5 msec
@ -709,6 +726,7 @@ void *skypiax_do_tcp_cli_thread_func(void *obj)
skypiax_sleep(1000);
break;
}
}
} else {
@ -719,9 +737,17 @@ void *skypiax_do_tcp_cli_thread_func(void *obj)
if (rt)
ERRORA("CLI rt=%d\n", SKYPIAX_P_LOG, rt);
memset(cli_out, 0, sizeof(cli_out));
if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
len = send(fd, (char *) cli_out, sizeof(cli_out), 0);
len = send(fd, (char *) cli_out, sizeof(cli_out) / 2, 0);
//DEBUGA_SKYPE("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2);
//WARNINGA("sent %d of zeros to keep the Skype client socket busy\n", SKYPIAX_P_LOG, sizeof(cli_out) + sizeof(cli_out)/2);
} else {
/*
XXX do nothing
*/
//WARNINGA("we don't send it\n", SKYPIAX_P_LOG);
}
skypiax_sleep(1000);
}
}