mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-03 03:50:10 +00:00
skypiax: indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12833 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
3c206cfa22
commit
ba1a8ec241
@ -1046,12 +1046,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypiax_load)
|
||||
|
||||
if (running) {
|
||||
|
||||
SWITCH_ADD_API(commands_api_interface, "sk", "Skypiax console commands", sk_function, SK_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "skypiax", "Skypiax interface commands", skypiax_function, SKYPIAX_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "sk", "Skypiax console commands", sk_function,
|
||||
SK_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "skypiax", "Skypiax interface commands",
|
||||
skypiax_function, SKYPIAX_SYNTAX);
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
} else
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
@ -1129,10 +1130,12 @@ void *SWITCH_THREAD_FUNC skypiax_do_tcp_srv_thread(switch_thread_t * thread, voi
|
||||
{
|
||||
return skypiax_do_tcp_srv_thread_func(obj);
|
||||
}
|
||||
|
||||
void *SWITCH_THREAD_FUNC skypiax_do_tcp_cli_thread(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
return skypiax_do_tcp_cli_thread_func(obj);
|
||||
}
|
||||
|
||||
void *SWITCH_THREAD_FUNC skypiax_do_skypeapi_thread(switch_thread_t * thread, void *obj)
|
||||
{
|
||||
return skypiax_do_skypeapi_thread_func(obj);
|
||||
@ -1355,7 +1358,6 @@ SWITCH_STANDARD_API(sk_function)
|
||||
else
|
||||
stream->write_function(stream, "sk console is NOT yet assigned\n");
|
||||
|
||||
|
||||
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
|
||||
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
}
|
||||
@ -1370,9 +1372,14 @@ SWITCH_STANDARD_API(sk_function)
|
||||
for (i = 0; i < SKYPIAX_MAX_INTERFACES; i++) {
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[i].name)) {
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[i].session_uuid_str)) {
|
||||
stream->write_function(stream,"globals.SKYPIAX_INTERFACES[%d].name=\t|||%s||| is \tBUSY, session_uuid_str=|||%s|||\n", i, globals.SKYPIAX_INTERFACES[i].name, globals.SKYPIAX_INTERFACES[i].session_uuid_str);
|
||||
stream->write_function(stream,
|
||||
"globals.SKYPIAX_INTERFACES[%d].name=\t|||%s||| is \tBUSY, session_uuid_str=|||%s|||\n",
|
||||
i, globals.SKYPIAX_INTERFACES[i].name,
|
||||
globals.SKYPIAX_INTERFACES[i].session_uuid_str);
|
||||
} else {
|
||||
stream->write_function(stream,"globals.SKYPIAX_INTERFACES[%d].name=\t|||%s||| is \tIDLE\n", i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
stream->write_function(stream,
|
||||
"globals.SKYPIAX_INTERFACES[%d].name=\t|||%s||| is \tIDLE\n",
|
||||
i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1384,27 +1391,29 @@ SWITCH_STANDARD_API(sk_function)
|
||||
for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
|
||||
/* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[i].name)
|
||||
&&
|
||||
(strncmp
|
||||
(globals.SKYPIAX_INTERFACES[i].name, argv[1],
|
||||
strlen(argv[1])) == 0)) {
|
||||
&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, argv[1], strlen(argv[1])) ==
|
||||
0)) {
|
||||
globals.sk_console = &globals.SKYPIAX_INTERFACES[i];
|
||||
stream->write_function(stream,"sk console is now: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
stream->write_function(stream,"sk console is: |||%s|||\n", globals.sk_console->name);
|
||||
stream->write_function(stream,
|
||||
"sk console is now: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n",
|
||||
i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
stream->write_function(stream, "sk console is: |||%s|||\n",
|
||||
globals.sk_console->name);
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (!found)
|
||||
stream->write_function(stream,"ERROR: A Skypiax interface with name='%s' was not found\n", argv[1]);
|
||||
stream->write_function(stream,
|
||||
"ERROR: A Skypiax interface with name='%s' was not found\n",
|
||||
argv[1]);
|
||||
} else {
|
||||
|
||||
stream->write_function(stream, "-ERR Usage: sk console interface_name\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
} else if (!strcasecmp(argv[0], "ciapalino")) {
|
||||
|
||||
} else {
|
||||
@ -1425,7 +1434,6 @@ SWITCH_STANDARD_API(skypiax_function)
|
||||
int argc = 0;
|
||||
private_t *tech_pvt = NULL;
|
||||
|
||||
|
||||
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
|
||||
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
}
|
||||
@ -1447,19 +1455,20 @@ SWITCH_STANDARD_API(skypiax_function)
|
||||
for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
|
||||
/* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
|
||||
if (strlen(globals.SKYPIAX_INTERFACES[i].name)
|
||||
&&
|
||||
(strncmp
|
||||
(globals.SKYPIAX_INTERFACES[i].name, argv[0],
|
||||
strlen(argv[0])) == 0)) {
|
||||
&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, argv[0], strlen(argv[0])) == 0)) {
|
||||
tech_pvt = &globals.SKYPIAX_INTERFACES[i];
|
||||
stream->write_function(stream,"Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
stream->write_function(stream,
|
||||
"Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n",
|
||||
i, globals.SKYPIAX_INTERFACES[i].name);
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (!found) {
|
||||
stream->write_function(stream,"ERROR: A Skypiax interface with name='%s' was not found\n", argv[0]);
|
||||
stream->write_function(stream,
|
||||
"ERROR: A Skypiax interface with name='%s' was not found\n",
|
||||
argv[0]);
|
||||
switch_safe_free(mycmd);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@ -1475,9 +1484,6 @@ end:
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
|
@ -167,7 +167,8 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
SKYPIAX_P_LOG, message, obj, id, prop, value, where ? where : "NULL");
|
||||
|
||||
if (!strcasecmp(prop, "PARTNER_HANDLE")) {
|
||||
skypiax_strncpy(tech_pvt->callid_number, value, sizeof(tech_pvt->callid_number) - 1);
|
||||
skypiax_strncpy(tech_pvt->callid_number, value,
|
||||
sizeof(tech_pvt->callid_number) - 1);
|
||||
DEBUGA_SKYPE
|
||||
("the skype_call %s caller PARTNER_HANDLE (tech_pvt->callid_number) is: %s\n",
|
||||
SKYPIAX_P_LOG, id, tech_pvt->callid_number);
|
||||
@ -201,7 +202,8 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
}
|
||||
if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) {
|
||||
if (strcasecmp(id, tech_pvt->skype_call_id)) {
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE
|
||||
("We called a Skype contact and he answered us on skype_call: %s.\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
@ -234,7 +236,8 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
skypiax_signaling_write(tech_pvt, msg_to_skype);
|
||||
DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n", SKYPIAX_P_LOG,
|
||||
id);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
} else {
|
||||
/* we're owned, we're in a call, let's try to transfer */
|
||||
/************************** TODO
|
||||
@ -251,7 +254,8 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
DEBUGA_SKYPE
|
||||
("Let's transfer the skype_call %s to %s interface (with skype_user: %s), because we are already in a skypiax call(%s)\n",
|
||||
SKYPIAX_P_LOG, tech_pvt->skype_call_id,
|
||||
available_skypiax_interface->name, available_skypiax_interface->skype_user, id);
|
||||
available_skypiax_interface->name,
|
||||
available_skypiax_interface->skype_user, id);
|
||||
sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id,
|
||||
available_skypiax_interface->skype_user);
|
||||
} else {
|
||||
@ -271,7 +275,8 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
/* we are calling out */
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_RINGING;
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_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",
|
||||
SKYPIAX_P_LOG, id);
|
||||
remote_party_is_ringing(tech_pvt);
|
||||
@ -328,7 +333,8 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
("we tried to call Skype on skype_call %s and Skype has now FAILED\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
tech_pvt->skype_call_id[0] = '\0';
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
return CALLFLOW_INCOMING_HANGUP;
|
||||
} else if (!strcasecmp(value, "REFUSED")) {
|
||||
@ -338,7 +344,8 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
DEBUGA_SKYPE
|
||||
("we tried to call Skype on skype_call %s and Skype has now REFUSED\n",
|
||||
SKYPIAX_P_LOG, id);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
|
||||
tech_pvt->skype_call_id[0] = '\0';
|
||||
return CALLFLOW_INCOMING_HANGUP;
|
||||
@ -353,19 +360,22 @@ int skypiax_signaling_read(private_t * tech_pvt)
|
||||
} else if (!strcasecmp(value, "ROUTING")) {
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_ROUTING;
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE("skype_call: %s is now ROUTING\n", SKYPIAX_P_LOG, id);
|
||||
} else if (!strcasecmp(value, "UNPLACED")) {
|
||||
tech_pvt->skype_callflow = CALLFLOW_STATUS_UNPLACED;
|
||||
tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
|
||||
skypiax_strncpy(tech_pvt->skype_call_id, id,
|
||||
sizeof(tech_pvt->skype_call_id) - 1);
|
||||
DEBUGA_SKYPE("skype_call: %s is now UNPLACED\n", SKYPIAX_P_LOG, id);
|
||||
} else if (!strcasecmp(value, "INPROGRESS")) {
|
||||
char msg_to_skype[1024];
|
||||
|
||||
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);
|
||||
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;
|
||||
@ -790,6 +800,7 @@ int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany)
|
||||
|
||||
return howmany;
|
||||
}
|
||||
|
||||
int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany)
|
||||
{
|
||||
switch_size_t quantity;
|
||||
@ -802,6 +813,7 @@ int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany)
|
||||
|
||||
return howmany;
|
||||
}
|
||||
|
||||
int skypiax_close_socket(unsigned int fd)
|
||||
{
|
||||
int res;
|
||||
@ -828,11 +840,13 @@ int skypiax_pipe_read(int pipe, short *buf, int howmany)
|
||||
howmany = read(pipe, buf, howmany);
|
||||
return howmany;
|
||||
}
|
||||
|
||||
int skypiax_pipe_write(int pipe, short *buf, int howmany)
|
||||
{
|
||||
howmany = write(pipe, buf, howmany);
|
||||
return howmany;
|
||||
}
|
||||
|
||||
int skypiax_close_socket(unsigned int fd)
|
||||
{
|
||||
int res;
|
||||
@ -995,8 +1009,8 @@ LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
|
||||
skypiax_sleep(5000);
|
||||
if (!tech_pvt->SkypiaxHandles.currentuserhandle) {
|
||||
SendMessage(HWND_BROADCAST,
|
||||
tech_pvt->SkypiaxHandles.
|
||||
win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
|
||||
tech_pvt->
|
||||
SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
|
||||
(WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle,
|
||||
0);
|
||||
}
|
||||
@ -1012,8 +1026,8 @@ LRESULT APIENTRY skypiax_present(HWND hWindow, UINT uiMessage, WPARAM uiParam,
|
||||
skypiax_sleep(5000);
|
||||
if (!tech_pvt->SkypiaxHandles.currentuserhandle) {
|
||||
SendMessage(HWND_BROADCAST,
|
||||
tech_pvt->SkypiaxHandles.
|
||||
win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
|
||||
tech_pvt->
|
||||
SkypiaxHandles.win32_uiGlobal_MsgID_SkypeControlAPIDiscover,
|
||||
(WPARAM) tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle,
|
||||
0);
|
||||
}
|
||||
@ -1336,7 +1350,6 @@ void *skypiax_do_skypeapi_thread_func(void *obj)
|
||||
}
|
||||
SkypiaxHandles = &tech_pvt->SkypiaxHandles;
|
||||
|
||||
|
||||
SkypiaxHandles->api_connected = 1;
|
||||
|
||||
char *b;
|
||||
|
Loading…
x
Reference in New Issue
Block a user