skypopen: indented
This commit is contained in:
parent
56f415a164
commit
00a6f61a67
|
@ -112,6 +112,7 @@ char *interface_status[] = { /* should match SKYPOPEN_STATE_xxx in skypopen.h */
|
|||
"PREANSW",
|
||||
"DEAD"
|
||||
};
|
||||
|
||||
char *skype_callflow[] = { /* should match CALLFLOW_XXX in skypopen.h */
|
||||
"IDLE",
|
||||
"DOWN",
|
||||
|
@ -739,6 +740,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int
|
|||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_consume_media(switch_core_session_t *session)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
@ -765,6 +767,7 @@ static switch_status_t channel_on_soft_execute(switch_core_session_t *session)
|
|||
DEBUGA_SKYPE("%s CHANNEL SOFT_EXECUTE\n", SKYPOPEN_P_LOG, tech_pvt->name);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_reset(switch_core_session_t *session)
|
||||
{
|
||||
private_t *tech_pvt = NULL;
|
||||
|
@ -875,7 +878,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
if (!bytes_read) {
|
||||
switch_sleep(1000); //XXX don't like this
|
||||
try++;
|
||||
if (try < 5){
|
||||
if (try < 5) {
|
||||
DEBUGA_SKYPE("skypopen_audio_read going back to read\n", SKYPOPEN_P_LOG);
|
||||
goto read;
|
||||
}
|
||||
|
@ -940,19 +943,19 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
char *p = digit_str;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
if(channel){
|
||||
if (channel) {
|
||||
|
||||
while (p && *p) {
|
||||
switch_dtmf_t dtmf = {0};
|
||||
switch_dtmf_t dtmf = { 0 };
|
||||
dtmf.digit = *p;
|
||||
dtmf.duration = SWITCH_DEFAULT_DTMF_DURATION;
|
||||
switch_channel_queue_dtmf(channel, &dtmf);
|
||||
p++;
|
||||
}
|
||||
NOTICA("DTMF DETECTED: [%s] new_dtmf_timestamp: %u, delta_t: %u\n", SKYPOPEN_P_LOG, digit_str, (unsigned int) new_dtmf_timestamp,
|
||||
(unsigned int) (new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp));
|
||||
NOTICA("DTMF DETECTED: [%s] new_dtmf_timestamp: %u, delta_t: %u\n", SKYPOPEN_P_LOG, digit_str,
|
||||
(unsigned int) new_dtmf_timestamp, (unsigned int) (new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp));
|
||||
tech_pvt->old_dtmf_timestamp = new_dtmf_timestamp;
|
||||
}else{
|
||||
} else {
|
||||
WARNINGA("NO CHANNEL ?\n", SKYPOPEN_P_LOG);
|
||||
}
|
||||
}
|
||||
|
@ -1077,7 +1080,7 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session)
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t * msg)
|
||||
static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt;
|
||||
|
@ -1751,8 +1754,7 @@ static switch_status_t load_config(int reload_type)
|
|||
switch_threadattr_detach_set(skypopen_signaling_thread_attr, 0);
|
||||
switch_threadattr_stacksize_set(skypopen_signaling_thread_attr, SWITCH_THREAD_STACKSIZE);
|
||||
//switch_threadattr_priority_increase(skypopen_signaling_thread_attr);
|
||||
switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id].
|
||||
skypopen_signaling_thread, skypopen_signaling_thread_attr,
|
||||
switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread, skypopen_signaling_thread_attr,
|
||||
skypopen_signaling_thread_func, &globals.SKYPOPEN_INTERFACES[interface_id], skypopen_module_pool);
|
||||
|
||||
switch_sleep(100000);
|
||||
|
@ -1858,8 +1860,8 @@ static switch_status_t load_config(int reload_type)
|
|||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
static switch_status_t chat_send(switch_event_t *message_event)
|
||||
|
||||
static switch_status_t chat_send(switch_event_t *message_event)
|
||||
{
|
||||
char *user = NULL, *host, *f_user = NULL, *f_host = NULL, *f_resource = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
@ -1912,7 +1914,6 @@ static switch_status_t chat_send(switch_event_t *message_event)
|
|||
if ((host = strchr(user, '@'))) {
|
||||
*host++ = '\0';
|
||||
}
|
||||
|
||||
//DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n", SKYPOPEN_P_LOG, proto, from, to, subject, body, type,
|
||||
// hint ? hint : "NULL");
|
||||
DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, hint=%s)\n", SKYPOPEN_P_LOG, proto, from, to, subject, body,
|
||||
|
@ -1970,7 +1971,9 @@ static switch_status_t chat_send(switch_event_t *message_event)
|
|||
}
|
||||
tried++;
|
||||
if (tried > 20) {
|
||||
ERRORA("No chat with dialog_partner='%s' was found. (If you're using mod_sms this is a bug of mod_skypopen when using mod_sms, from next incoming message it will probably work...)\n", SKYPOPEN_P_LOG, to);
|
||||
ERRORA
|
||||
("No chat with dialog_partner='%s' was found. (If you're using mod_sms this is a bug of mod_skypopen when using mod_sms, from next incoming message it will probably work...)\n",
|
||||
SKYPOPEN_P_LOG, to);
|
||||
break;
|
||||
}
|
||||
switch_sleep(50000);
|
||||
|
@ -2194,7 +2197,7 @@ int dtmf_received(private_t *tech_pvt, char *value)
|
|||
WARNINGA("received %c DTMF, but no channel?\n", SKYPOPEN_P_LOG, value[0]);
|
||||
}
|
||||
switch_core_session_rwunlock(session);
|
||||
}else{
|
||||
} else {
|
||||
WARNINGA("received %c DTMF, but no session?\n", SKYPOPEN_P_LOG, value[0]);
|
||||
}
|
||||
|
||||
|
@ -2274,7 +2277,8 @@ int start_audio_threads(private_t *tech_pvt)
|
|||
switch_threadattr_priority_increase(tcp_srv_thread_thd_attr);
|
||||
switch_mutex_lock(tech_pvt->mutex_thread_audio_srv);
|
||||
//DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG);
|
||||
if (switch_thread_create(&tech_pvt->tcp_srv_thread, tcp_srv_thread_thd_attr, skypopen_do_tcp_srv_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_thread_create(&tech_pvt->tcp_srv_thread, tcp_srv_thread_thd_attr, skypopen_do_tcp_srv_thread, tech_pvt, skypopen_module_pool) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPOPEN_P_LOG);
|
||||
} else {
|
||||
ERRORA("failed to start tcp_srv_thread thread.\n", SKYPOPEN_P_LOG);
|
||||
|
@ -2291,7 +2295,8 @@ int start_audio_threads(private_t *tech_pvt)
|
|||
switch_threadattr_priority_increase(tcp_cli_thread_thd_attr);
|
||||
switch_mutex_lock(tech_pvt->mutex_thread_audio_cli);
|
||||
//DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG);
|
||||
if (switch_thread_create(&tech_pvt->tcp_cli_thread, tcp_cli_thread_thd_attr, skypopen_do_tcp_cli_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_thread_create(&tech_pvt->tcp_cli_thread, tcp_cli_thread_thd_attr, skypopen_do_tcp_cli_thread, tech_pvt, skypopen_module_pool) ==
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPOPEN_P_LOG);
|
||||
} else {
|
||||
ERRORA("failed to start tcp_cli_thread thread.\n", SKYPOPEN_P_LOG);
|
||||
|
@ -2523,8 +2528,9 @@ SWITCH_STANDARD_API(sk_function)
|
|||
|
||||
skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[tmp_i], "GET PROFILE PSTN_BALANCE_CURRENCY");
|
||||
switch_sleep(20000);
|
||||
if(strlen(tmp_message)>21 && strlen(globals.SKYPOPEN_INTERFACES[tmp_i].message) > 30)
|
||||
stream->write_function(stream, " %s \t%s\t%s\n", globals.SKYPOPEN_INTERFACES[tmp_i].name, tmp_message+21, globals.SKYPOPEN_INTERFACES[tmp_i].message+30);
|
||||
if (strlen(tmp_message) > 21 && strlen(globals.SKYPOPEN_INTERFACES[tmp_i].message) > 30)
|
||||
stream->write_function(stream, " %s \t%s\t%s\n", globals.SKYPOPEN_INTERFACES[tmp_i].name, tmp_message + 21,
|
||||
globals.SKYPOPEN_INTERFACES[tmp_i].message + 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3164,8 +3170,9 @@ SWITCH_STANDARD_API(skypopen_chat_function)
|
|||
goto end;
|
||||
} else {
|
||||
|
||||
NOTICA("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n", SKYPOPEN_P_LOG, SKYPE_CHAT_PROTO, tech_pvt->skype_user,
|
||||
argv[1], "SIMPLE MESSAGE", switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), tech_pvt->name);
|
||||
NOTICA("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n", SKYPOPEN_P_LOG, SKYPE_CHAT_PROTO,
|
||||
tech_pvt->skype_user, argv[1], "SIMPLE MESSAGE", switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]),
|
||||
tech_pvt->name);
|
||||
|
||||
compat_chat_send(SKYPE_CHAT_PROTO, tech_pvt->skype_user, argv[1], "SIMPLE MESSAGE",
|
||||
switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), NULL, tech_pvt->name);
|
||||
|
|
|
@ -383,7 +383,7 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
|||
sprintf(msg_to_skype, "SET CHATMESSAGE %s SEEN", id);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
if (!strcasecmp(prop, "STATUS") && !strcasecmp(value, "RECEIVED")) {
|
||||
DEBUGA_SKYPE("RECEIVED CHATMESSAGE %s, let's see which type it is\n", SKYPOPEN_P_LOG, id);
|
||||
sprintf(msg_to_skype, "GET CHATMESSAGE %s TYPE", id);
|
||||
|
@ -492,7 +492,7 @@ int skypopen_signaling_read(private_t *tech_pvt)
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -896,7 +896,7 @@ void *skypopen_do_tcp_srv_thread_func(void *obj)
|
|||
|| tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) {
|
||||
|
||||
//unsigned int fdselect;
|
||||
int rt=1;
|
||||
int rt = 1;
|
||||
//fd_set fs;
|
||||
//struct timeval to;
|
||||
int nospace;
|
||||
|
@ -1148,7 +1148,7 @@ int skypopen_senddigit(private_t *tech_pvt, char digit)
|
|||
char msg_to_skype[1024];
|
||||
|
||||
DEBUGA_SKYPE("DIGIT received: %c\n", SKYPOPEN_P_LOG, digit);
|
||||
if(digit != 'a' && digit != 'A' && digit != 'b' && digit != 'B' && digit != 'c' && digit != 'C' && digit != 'd' && digit != 'D'){
|
||||
if (digit != 'a' && digit != 'A' && digit != 'b' && digit != 'B' && digit != 'c' && digit != 'C' && digit != 'd' && digit != 'D') {
|
||||
sprintf(msg_to_skype, "SET CALL %s DTMF %c", tech_pvt->skype_call_id, digit);
|
||||
skypopen_signaling_write(tech_pvt, msg_to_skype);
|
||||
} else {
|
||||
|
@ -1761,7 +1761,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||
if (session) {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
if(channel){
|
||||
if (channel) {
|
||||
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||
|
@ -1798,7 +1798,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
|
||||
if(channel){
|
||||
if (channel) {
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||
switch_clear_flag(tech_pvt, TFLAG_VOICE);
|
||||
|
@ -1970,7 +1970,6 @@ void *skypopen_do_skypeapi_thread_func(void *obj)
|
|||
//XFlush(disp);
|
||||
there_were_continues = 0;
|
||||
}
|
||||
|
||||
//skypopen_sleep(1000); //0.1 msec
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue