skypiax: silent_mode in config file, now it works well. DelphiWorld asked for it, and will be useful to all :)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16731 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Giovanni Maruzzelli 2010-02-23 14:32:52 +00:00
parent b2157456f5
commit 1bc16199a5
3 changed files with 30 additions and 4 deletions

View File

@ -1476,6 +1476,7 @@ static switch_status_t load_config(int reload_type)
//char *tcp_srv_port = "45001";
char *skype_user = NULL;
char *report_incoming_chatmessages = "true";
char *silent_mode = "false";
uint32_t interface_id = 0, to = 0, max = 0;
@ -1507,6 +1508,8 @@ static switch_status_t load_config(int reload_type)
skype_user = val;
} else if (!strcasecmp(var, "report_incoming_chatmessages")) {
report_incoming_chatmessages = val;
} else if (!strcasecmp(var, "silent_mode")) {
silent_mode = val;
#if 0
} else if (!strcasecmp(var, "tcp_cli_port")) {
tcp_cli_port = val;
@ -1637,6 +1640,13 @@ static switch_status_t load_config(int reload_type)
}
if (!strcmp(silent_mode, "true") || !strcmp(silent_mode, "1")) {
globals.SKYPIAX_INTERFACES[interface_id].silent_mode = 1;
} else {
globals.SKYPIAX_INTERFACES[interface_id].silent_mode = 0; //redundant, just in case
}
DEBUGA_SKYPE
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].X11_display=%s\n",
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].X11_display);
@ -1670,6 +1680,10 @@ static switch_status_t load_config(int reload_type)
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].report_incoming_chatmessages=%d\n",
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].report_incoming_chatmessages);
DEBUGA_SKYPE
("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].silent_mode=%d\n",
SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].silent_mode);
WARNINGA("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
switch_threadattr_create(&skypiax_api_thread_attr, skypiax_module_pool);
@ -1734,6 +1748,10 @@ static switch_status_t load_config(int reload_type)
switch_sleep(10000);
skypiax_signaling_write(&globals.SKYPIAX_INTERFACES[interface_id], "SET USERSTATUS ONLINE");
switch_sleep(10000);
if(globals.SKYPIAX_INTERFACES[interface_id].silent_mode){
skypiax_signaling_write(&globals.SKYPIAX_INTERFACES[interface_id], "SET SILENT_MODE ON");
switch_sleep(10000);
}
} else {
ERRORA
("The Skype client to which we are connected FAILED to gave us CURRENTUSERHANDLE=%s, interface_id=%d FAILED to start. No Skype client logged in as '%s' has been found. Please (re)launch a Skype client logged in as '%s'. Skypiax exiting now\n",
@ -1767,6 +1785,8 @@ static switch_status_t load_config(int reload_type)
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].destination=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].destination);
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].report_incoming_chatmessages=%d\n", SKYPIAX_P_LOG, i, i,
globals.SKYPIAX_INTERFACES[i].report_incoming_chatmessages);
DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].silent_mode=%d\n", SKYPIAX_P_LOG, i, i,
globals.SKYPIAX_INTERFACES[i].silent_mode);
}
}
}

View File

@ -290,7 +290,7 @@ int begin_to_read;
switch_time_t old_dtmf_timestamp;
switch_buffer_t *write_buffer;
switch_buffer_t *read_buffer;
int silent_mode;
};

View File

@ -160,7 +160,13 @@ int skypiax_signaling_read(private_t * tech_pvt)
//if (!strstr(message, "DURATION")) {
DEBUGA_SKYPE("READING: |||%s||| \n", SKYPIAX_P_LOG, message);
//}
if (!strcasecmp(message, "SILENT_MODE OFF")) {
if(tech_pvt->silent_mode){
DEBUGA_SKYPE("Resetting SILENT_MODE on skype_call: %s.\n", SKYPIAX_P_LOG, id);
skypiax_signaling_write(tech_pvt, "SET SILENT_MODE ON");
switch_sleep(1000);
}
}
if (!strcasecmp(message, "ERROR 68")) {
DEBUGA_SKYPE
("If I don't connect immediately, please give the Skype client authorization to be connected by Skypiax (and to not ask you again)\n",
@ -504,7 +510,7 @@ int skypiax_signaling_read(private_t * tech_pvt)
if (!strcasecmp(prop, "FAILUREREASON")) {
DEBUGA_SKYPE("Skype FAILED on skype_call %s. Let's wait for the FAILED message.\n", SKYPIAX_P_LOG, id);
}
if (!strcasecmp(prop, "DURATION")) { /* each second, we sync ithe timers */
if (!strcasecmp(prop, "DURATION")) { /* each 20 seconds, we sync ithe timers */
if(!((atoi(value) % 20))){
switch_core_timer_sync(&tech_pvt->timer_read);
switch_core_timer_sync(&tech_pvt->timer_write);
@ -1848,7 +1854,7 @@ int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPIAX_P_LOG, msg_to_skype);
sprintf(acInputRow, "%s", msg_to_skype);
DEBUGA_SKYPE("acInputRow: |||%s||||\n", SKYPIAX_P_LOG, acInputRow);
//DEBUGA_SKYPE("acInputRow: |||%s||||\n", SKYPIAX_P_LOG, acInputRow);
/* send command to skype */
oCopyData.dwData = 0;
oCopyData.lpData = acInputRow;