[Freeswitch-trunk] [commit] r12416 - in freeswitch/trunk/src/mod/endpoints/mod_skypiax: . asterisk
FreeSWITCH SVN
gmaruzz at freeswitch.org
Wed Mar 4 12:18:37 PST 2009
Author: gmaruzz
Date: Wed Mar 4 14:18:37 2009
New Revision: 12416
Log:
skypiax: indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
Modified:
freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c
freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c
freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c Wed Mar 4 14:18:37 2009
@@ -144,7 +144,7 @@
AST_CLI_DEFINE(skypiax_console_skype, "Sends a Skype command"),
AST_CLI_DEFINE(skypiax_console_skypiax_dir_import, "imports entries from cellphone"),
AST_CLI_DEFINE(skypiax_console_skypiax, "all things skypiax"),
- #endif
+#endif
};
#else
struct ast_cli_entry myclis[] = {
@@ -313,15 +313,15 @@
return NULL;
}
-char interface[256];
-int i;
-memset(interface, '\0', sizeof(interface));
-
-for (i=0; i<sizeof(interface); i++){
- if(name[i] == '/')
- break;
- interface[i]=name[i];
-}
+ char interface[256];
+ int i;
+ memset(interface, '\0', sizeof(interface));
+
+ for (i = 0; i < sizeof(interface); i++) {
+ if (name[i] == '/')
+ break;
+ interface[i] = name[i];
+ }
/* lock the interfaces' list */
LOKKA(&skypiax_iflock);
/* make a pointer to the first interface in the interfaces list */
@@ -1124,8 +1124,7 @@
skypiax_store_boost(v->value, &skypiax_default.capture_boost))
M_UINT("skypiax_dir_entry_extension_prefix",
skypiax_default.skypiax_dir_entry_extension_prefix)
- M_END(;
- );
+ M_END(;);
}
}
@@ -1161,8 +1160,7 @@
M_STR("skype_user", tmp->skype_user)
M_UINT("skypiax_dir_entry_extension_prefix",
tmp->skypiax_dir_entry_extension_prefix)
- M_END(;
- );
+ M_END(;);
}
if (debug_all) {
@@ -1861,7 +1859,9 @@
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+ if ((session =
+ switch_core_session_request(skypiax_endpoint_interface,
+ SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
switch_core_session_add_stream(session, NULL);
channel = switch_core_session_get_channel(session);
skypiax_tech_init(tech_pvt, session);
@@ -1889,6 +1889,7 @@
#endif
return 0;
}
+
int remote_party_is_ringing(private_t * p)
{
if (p->owner) {
@@ -1897,6 +1898,7 @@
return 0;
}
+
int remote_party_is_early_media(private_t * p)
{
if (p->owner) {
@@ -1906,7 +1908,6 @@
return 0;
}
-
int outbound_channel_answered(private_t * p)
{
Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/mod_skypiax.c Wed Mar 4 14:18:37 2009
@@ -506,7 +506,9 @@
switch_memory_pool_t ** pool,
switch_originate_flag_t flags)
{
- if ((*new_session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
+ if ((*new_session =
+ switch_core_session_request(skypiax_endpoint_interface,
+ SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
private_t *tech_pvt;
switch_channel_t *channel;
switch_caller_profile_t *caller_profile;
@@ -940,29 +942,43 @@
skypiax_audio_init(&globals.SKYPIAX_INTERFACES[interface_id]);
- NOTICA("WAITING roughly 10/15 seconds to find a running Skype client and connect to its SKYPE API for interface_id=%d. NB: on XP will wait for much much more! (on Vista and Linux is OK)\n", SKYPIAX_P_LOG, interface_id);
+ NOTICA
+ ("WAITING roughly 10 seconds to find a running Skype client and connect to its SKYPE API for interface_id=%d\n",
+ SKYPIAX_P_LOG, interface_id);
i = 0;
- while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0 && running && i < 200) { // 10 seconds? thanks Jeff Lenk
+ while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0 && running && i < 200) { // 10 seconds! thanks Jeff Lenk
switch_sleep(50000);
i++;
}
if (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected) {
- NOTICA("Found a running Skype client, connected to its SKYPE API for interface_id=%d, waiting roughly 60/90 seconds for CURRENTUSERHANDLE==%s. NB: on XP will wait for much much more! (on Vista and Linux is OK)\n", SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
+ NOTICA
+ ("Found a running Skype client, connected to its SKYPE API for interface_id=%d, waiting 60 seconds for CURRENTUSERHANDLE==%s\n",
+ SKYPIAX_P_LOG, interface_id,
+ globals.SKYPIAX_INTERFACES[interface_id].skype_user);
} else {
- ERRORA("Failed to connect to a SKYPE API for interface_id=%d, no SKYPE client running, please (re)start Skype client. Skypiax exiting\n", SKYPIAX_P_LOG, interface_id);
+ ERRORA
+ ("Failed to connect to a SKYPE API for interface_id=%d, no SKYPE client running, please (re)start Skype client. Skypiax exiting\n",
+ SKYPIAX_P_LOG, interface_id);
running = 0;
return SWITCH_STATUS_FALSE;
}
i = 0;
- while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.currentuserhandle == 0 && running && i < 1200) { // 60 seconds? thanks Jeff Lenk
+ while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.currentuserhandle == 0 && running && i < 1200) { // 60 seconds! thanks Jeff Lenk
switch_sleep(50000);
i++;
}
if (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.currentuserhandle) {
- WARNINGA("Interface_id=%d is now STARTED, the Skype client to which we are connected gave us the correct CURRENTUSERHANDLE (%s)\n", SKYPIAX_P_LOG, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
+ WARNINGA
+ ("Interface_id=%d is now STARTED, the Skype client to which we are connected gave us the correct CURRENTUSERHANDLE (%s)\n",
+ SKYPIAX_P_LOG, interface_id,
+ globals.SKYPIAX_INTERFACES[interface_id].skype_user);
} 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", SKYPIAX_P_LOG, globals.SKYPIAX_INTERFACES[interface_id].skype_user, interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user, globals.SKYPIAX_INTERFACES[interface_id].skype_user);
+ 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",
+ SKYPIAX_P_LOG, globals.SKYPIAX_INTERFACES[interface_id].skype_user,
+ interface_id, globals.SKYPIAX_INTERFACES[interface_id].skype_user,
+ globals.SKYPIAX_INTERFACES[interface_id].skype_user);
running = 0;
return SWITCH_STATUS_FALSE;
}
@@ -1056,7 +1072,7 @@
DEBUGA_SKYPE
("got FALSE here, thread probably was already dead. GetLastError returned: %d\n",
SKYPIAX_P_LOG, GetLastError());
- globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread=NULL;
+ globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
}
#else
XEvent e;
@@ -1075,9 +1091,9 @@
XSync(tech_pvt->SkypiaxHandles.disp, False);
#endif
}
- while (x) {//FIXME 2 seconds?
+ while (x) { //FIXME 2 seconds?
x--;
- switch_yield(20000);
+ switch_yield(20000);
}
if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
switch_thread_join(&status,
@@ -1164,7 +1180,9 @@
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+ if ((session =
+ switch_core_session_request(skypiax_endpoint_interface,
+ SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
switch_core_session_add_stream(session, NULL);
channel = switch_core_session_get_channel(session);
skypiax_tech_init(tech_pvt, session);
@@ -1221,7 +1239,6 @@
return 0;
}
-
int remote_party_is_early_media(private_t * tech_pvt)
{
switch_core_session_t *session = NULL;
Modified: freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_skypiax/skypiax_protocol.c Wed Mar 4 14:18:37 2009
@@ -273,17 +273,17 @@
char msg_to_skype[1024];
tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
- NOTICA("Our remote party in skype_call %s is EARLYMEDIA\n",
- SKYPIAX_P_LOG, id);
- sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
- tech_pvt->tcp_cli_port);
- skypiax_signaling_write(tech_pvt, msg_to_skype);
- start_audio_threads(tech_pvt);
- sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
- tech_pvt->tcp_srv_port);
- skypiax_signaling_write(tech_pvt, msg_to_skype);
+ NOTICA("Our remote party in skype_call %s is EARLYMEDIA\n", SKYPIAX_P_LOG,
+ id);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_cli_port);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
+ start_audio_threads(tech_pvt);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_srv_port);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
- remote_party_is_early_media(tech_pvt);
+ remote_party_is_early_media(tech_pvt);
} else if (!strcasecmp(value, "MISSED")) {
DEBUGA_SKYPE("We missed skype_call %s\n", SKYPIAX_P_LOG, id);
} else if (!strcasecmp(value, "FINISHED")) {
@@ -355,17 +355,17 @@
|| !strcasecmp(tech_pvt->skype_call_id, id)) {
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;
- sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
- tech_pvt->tcp_cli_port);
- skypiax_signaling_write(tech_pvt, msg_to_skype);
- start_audio_threads(tech_pvt);
- sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
- tech_pvt->tcp_srv_port);
- skypiax_signaling_write(tech_pvt, msg_to_skype);
- }
+ if (tech_pvt->skype_callflow != CALLFLOW_STATUS_EARLYMEDIA) {
+ tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
+ tech_pvt->interface_state = SKYPIAX_STATE_UP;
+ sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_cli_port);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
+ start_audio_threads(tech_pvt);
+ sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id,
+ tech_pvt->tcp_srv_port);
+ skypiax_signaling_write(tech_pvt, msg_to_skype);
+ }
tech_pvt->skype_callflow = SKYPIAX_STATE_UP;
if (!strlen(tech_pvt->session_uuid_str)) {
DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
@@ -456,7 +456,7 @@
break;
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_EARLYMEDIA
|| tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
unsigned int fdselect;
@@ -607,7 +607,8 @@
if (!running)
break;
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_INPROGRESS
+ || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA
|| tech_pvt->skype_callflow == SKYPIAX_STATE_UP)) {
unsigned int fdselect;
int rt;
@@ -921,8 +922,8 @@
lReturnCode = 0;
fIssueDefProc = 0;
tech_pvt = (private_t *) GetWindowLong(hWindow, GWL_USERDATA);
- if(!running)
- return lReturnCode;
+ if (!running)
+ return lReturnCode;
switch (uiMessage) {
case WM_CREATE:
tech_pvt = (private_t *) ((LPCREATESTRUCT) ulParam)->lpCreateParams;
@@ -1141,7 +1142,7 @@
xerror = err->error_code;
ERRORA("Received error code %d from X Server\n\n", SKYPIAX_P_LOG, xerror);
- running=0;
+ running = 0;
return 0; /* ignore the error */
}
@@ -1248,7 +1249,7 @@
if (status != Success || format_ret != 32 || nitems_ret != 1) {
SkypiaxHandles->skype_win = (Window) - 1;
DEBUGA_SKYPE("Skype instance not found\n", SKYPIAX_P_LOG);
- running =0;
+ running = 0;
SkypiaxHandles->api_connected = 0;
return 0;
}
More information about the Freeswitch-trunk
mailing list