[Freeswitch-svn] [commit] r11712 - freeswitch/branches/gmaruzz/mod_skypiax

FreeSWITCH SVN gmaruzz at freeswitch.org
Mon Feb 9 09:35:00 PST 2009


Author: gmaruzz
Date: Mon Feb  9 11:35:00 2009
New Revision: 11712

Log:
skypiax: skypiax_protocol.c indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90 

Modified:
   freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c

Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c	Mon Feb  9 11:35:00 2009
@@ -230,13 +230,13 @@
 
       if (!running)
         break;
-      fdselect = fd;   
+      fdselect = fd;
       FD_ZERO(&fs);
       FD_SET(fdselect, &fs);
       to.tv_usec = 2000000;     //2000 msec
       to.tv_sec = 0;
 
-      rt = select(fdselect + 1, NULL, &fs, NULL, &to); 
+      rt = select(fdselect + 1, NULL, &fs, NULL, &to);
 
       if (rt > 0) {
 
@@ -246,7 +246,7 @@
                             SAMPLES_PER_FRAME * sizeof(short));
         if (got != SAMPLES_PER_FRAME * sizeof(short)) {
           WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
-                 SAMPLES_PER_FRAME * sizeof(short));
+                   SAMPLES_PER_FRAME * sizeof(short));
         }
 
         if (got == SAMPLES_PER_FRAME * sizeof(short)) {
@@ -284,7 +284,7 @@
         } else {
 
           WARNINGA("got is %d, but was expected to be %d\n", SKYPIAX_P_LOG, got,
-                 SAMPLES_PER_FRAME * sizeof(short));
+                   SAMPLES_PER_FRAME * sizeof(short));
         }
       } else {
         if (rt)
@@ -307,17 +307,19 @@
 {
   unsigned int samples;
 
-    samples =
-      skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data, SAMPLES_PER_FRAME * sizeof(short));
-
-    if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
-      if (samples)
-      WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples, SAMPLES_PER_FRAME * sizeof(short));
-      return 0;
-    } else {
-      /* A real frame */
-      tech_pvt->read_frame.datalen = samples;
-    }
+  samples =
+    skypiax_pipe_read(tech_pvt->audiopipe[0], tech_pvt->read_frame.data,
+                      SAMPLES_PER_FRAME * sizeof(short));
+
+  if (samples != SAMPLES_PER_FRAME * sizeof(short)) {
+    if (samples)
+      WARNINGA("read samples=%u expected=%u\n", SKYPIAX_P_LOG, samples,
+               SAMPLES_PER_FRAME * sizeof(short));
+    return 0;
+  } else {
+    /* A real frame */
+    tech_pvt->read_frame.datalen = samples;
+  }
   return 1;
 }
 
@@ -339,7 +341,6 @@
   struct timeval to;
 #endif /* WIN32 */
 
-
   memset(read_from_pipe, 0, 4096);
   memset(messaggio, 0, 4096);
   memset(messaggio_2, 0, 4096);
@@ -387,7 +388,7 @@
             ERRORA("Skype got ERROR: |||%s|||, the number we called was not recognized\n",
                    SKYPIAX_P_LOG, messaggio);
             tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
-              DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
+            DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
             tech_pvt->skype_call_id[0] = '\0';
 
             if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
@@ -428,7 +429,7 @@
           if (!strcasecmp(messaggio, "ERROR")) {
             ERRORA("Skype got ERROR: |||%s|||\n", SKYPIAX_P_LOG, messaggio);
             tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
-              DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
+            DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPIAX_P_LOG);
             tech_pvt->skype_call_id[0] = '\0';
 
             if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
@@ -533,9 +534,9 @@
 
             where = strsep(stringp, " ");
 
-              DEBUGA_SKYPE
-                ("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
-                 SKYPIAX_P_LOG, messaggio, obj, id, prop, value, where ? where : "NULL");
+            DEBUGA_SKYPE
+              ("Skype MSG: messaggio: %s, obj: %s, id: %s, prop: %s, value: %s,where: %s!\n",
+               SKYPIAX_P_LOG, messaggio, obj, id, prop, value, where ? where : "NULL");
 
             if (!strcasecmp(prop, "PARTNER_HANDLE")) {
               strncpy(tech_pvt->callid_number, value,
@@ -579,9 +580,9 @@
             if (!strcasecmp(prop, "DURATION") && (!strcasecmp(value, "1"))) {
               if (strcasecmp(id, tech_pvt->skype_call_id)) {
                 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);
+                DEBUGA_SKYPE
+                  ("We called a Skype contact and he answered us on skype_call: %s.\n",
+                   SKYPIAX_P_LOG, id);
               }
             }
 
@@ -609,8 +610,8 @@
                     skypiax_sleep(10000);
                     sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
                     skypiax_skype_write(tech_pvt, msg_to_skype);
-                      DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n",
-                                   SKYPIAX_P_LOG, id);
+                    DEBUGA_SKYPE("We answered a Skype RING on skype_call %s\n",
+                                 SKYPIAX_P_LOG, id);
                     strncpy(tech_pvt->skype_call_id, id,
                             sizeof(tech_pvt->skype_call_id) - 1);
                   } else {
@@ -644,7 +645,7 @@
 
               } else if (!strcasecmp(value, "FINISHED")) {
                 //tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED;
-                  DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
+                DEBUGA_SKYPE("skype_call %s now is DOWN\n", SKYPIAX_P_LOG, id);
                 tech_pvt->skype_call_id[0] = '\0';
 
                 if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
@@ -656,9 +657,9 @@
 
               } else if (!strcasecmp(value, "CANCELLED")) {
                 tech_pvt->skype_callflow = CALLFLOW_STATUS_CANCELLED;
-                  DEBUGA_SKYPE
-                    ("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n",
-                     SKYPIAX_P_LOG, id);
+                DEBUGA_SKYPE
+                  ("we tried to call Skype on skype_call %s and Skype has now CANCELLED\n",
+                   SKYPIAX_P_LOG, id);
                 tech_pvt->skype_call_id[0] = '\0';
 
                 if (tech_pvt->interface_state != SKYPIAX_STATE_HANGUP_REQUESTED) {
@@ -669,9 +670,9 @@
                 }
               } else if (!strcasecmp(value, "FAILED")) {
                 tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED;
-                  DEBUGA_SKYPE
-                    ("we tried to call Skype on skype_call %s and Skype has now FAILED\n",
-                     SKYPIAX_P_LOG, id);
+                DEBUGA_SKYPE
+                  ("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';
                 strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
                 tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
@@ -680,9 +681,9 @@
                 if (!strcasecmp(id, tech_pvt->skype_call_id)) {
                   /* this is the id of the call we are in, probably we generated it */
                   tech_pvt->skype_callflow = CALLFLOW_STATUS_REFUSED;
-                    DEBUGA_SKYPE
-                      ("we tried to call Skype on skype_call %s and Skype has now REFUSED\n",
-                       SKYPIAX_P_LOG, id);
+                  DEBUGA_SKYPE
+                    ("we tried to call Skype on skype_call %s and Skype has now REFUSED\n",
+                     SKYPIAX_P_LOG, id);
                   strncpy(tech_pvt->skype_call_id, id,
                           sizeof(tech_pvt->skype_call_id) - 1);
                   tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
@@ -708,7 +709,7 @@
                 tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
                 strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1);
                 tech_pvt->interface_state = SKYPIAX_STATE_UP;
-                  DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
+                DEBUGA_SKYPE("skype_call: %s is now active\n", SKYPIAX_P_LOG, id);
                 sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id,
                         tech_pvt->tcp_cli_port);
                 skypiax_skype_write(tech_pvt, msg_to_skype);
@@ -815,6 +816,7 @@
 
   return res;
 }
+
 int skypiax_skypeaudio_init(private_t * tech_pvt)
 {
   switch_status_t rv;
@@ -845,6 +847,7 @@
 
   return res;
 }
+
 int skypiax_skypeaudio_init(private_t * tech_pvt)
 {
   if (pipe(tech_pvt->audiopipe)) {
@@ -863,7 +866,6 @@
 }
 #endif /* WIN32 */
 
-
 #ifdef WIN32
 
 enum {
@@ -917,7 +919,7 @@
   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;
@@ -1105,7 +1107,6 @@
       tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle = NULL;
 }
 
-
 void *skypiax_do_skypeapi_thread_func(void *obj)
 {
   private_t *tech_pvt = obj;
@@ -1250,7 +1251,6 @@
 
 }
 
-
 int skypiax_skype_present(struct SkypiaxHandles *SkypiaxHandles)
 {
   Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
@@ -1316,7 +1316,6 @@
   Window root = -1;
   Window win = -1;
 
-
   if (!strlen(tech_pvt->X11_display))
     strcpy(tech_pvt->X11_display, getenv("DISPLAY"));
 
@@ -1428,5 +1427,3 @@
 
 }
 #endif // WIN32
-
-



More information about the Freeswitch-svn mailing list