[Freeswitch-branches] [commit] r10577 - freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax

FreeSWITCH SVN gmaruzz at freeswitch.org
Wed Dec 3 10:11:48 PST 2008


Author: gmaruzz
Date: Wed Dec  3 13:11:48 2008
New Revision: 10577

Log:
skypiax: converting to use APR pipes, not finished, do not compile... gotta go now

Modified:
   freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c

Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	(original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c	Wed Dec  3 13:11:48 2008
@@ -34,8 +34,8 @@
  *
  */
 
-#define WIN32_SKYPIAX
-#define __CYGWIN__
+#undef WIN32_SKYPIAX
+#undef __CYGWIN__
 #define MOD_SKYPIAX
 #ifdef MOD_SKYPIAX
 
@@ -194,7 +194,7 @@
 	char language[80];  /*!< \brief default Asterisk dialplan language for this interface */
 	char exten[80];    /*!< \brief default Asterisk dialplan extension for this interface */
 	int skypiax_sound_rate;       /*!< \brief rate of the sound device, in Hz, eg: 8000 */
-	int skypiax_sound_capt_fd;    /*!< \brief file descriptor for sound capture dev */
+	switch_file_t *skypiax_sound_capt_fd;    /*!< \brief file descriptor for sound capture dev */
 	char callid_name[50];
 	char callid_number[50];
 	double playback_boost;
@@ -209,8 +209,8 @@
 	int skype_callflow;           /*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
 	int skype;                    /*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
 	int control_to_send;
-	int audiopipe[2];
-	int audioskypepipe[2];
+	switch_file_t *audiopipe[2];
+	switch_file_t *audioskypepipe[2];
 	switch_thread_t *tcp_srv_thread;
 	switch_thread_t *tcp_cli_thread;
 	short audiobuf[160];
@@ -640,7 +640,8 @@
   struct skypiax_interface *p = obj;
   short in[GG];
   short out[GG / 2];
-  int s, fd, len, sent;
+  //int s, fd, len, sent;
+  int s, fd, len;
   unsigned int sin_size;
   struct sockaddr_in my_addr;
   struct sockaddr_in remote_addr;
@@ -717,8 +718,11 @@
           }
           p->audiobuf_is_loaded = 1;
         } else {
-          sent = write(p->audiopipe[1], p->audiobuf, len / 2);
-          sent = write(p->audiopipe[1], out, len / 2);
+			unsigned int howmany;
+			howmany = len/2;
+          switch_file_write(p->audiopipe[1], p->audiobuf, &howmany);
+			howmany = len/2;
+          switch_file_write(p->audiopipe[1], out, &howmany);
           p->audiobuf_is_loaded = 0;
           //DEBUGA_SOUND("read=====> req=%d recv=%d to sent=%d sent=%d\n", SKYPIAX_P_LOG, sizeof(short)*GG, len, (len*sizeof(short))/2, sent);
         }
@@ -758,7 +762,7 @@
   struct sockaddr_in remote_addr;
   int a;
   int i;
-  int got;
+  unsigned int got;
   int exit=0;
 
   if (option_debug > 10) {
@@ -807,16 +811,18 @@
 
 
 
-  fdselect = p->audioskypepipe[0];
+  //fdselect = p->audioskypepipe[0];
   FD_ZERO(&fs);
   FD_SET(fdselect, &fs);
   to.tv_usec = 100;
   to.tv_sec = 0;
-  rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+  //rt = select(fdselect + 1, &fs, NULL, NULL, &to);
+  rt=1;
   if (rt > 0) {
 
 
-      got = read(p->audioskypepipe[0], in, (NN / 2) * sizeof(short));
+      got = (NN / 2) * sizeof(short);
+      switch_file_read(p->audioskypepipe[0], in, &got);
     //ERRORA("got %d\n", SKYPIAX_P_LOG, got);
 
       if (got > 0) {
@@ -858,6 +864,7 @@
 int skypiax_skypeaudio_init(struct skypiax_interface *p)
 {
   int c;
+#if 0
 /* build the pipe that will be polled on by pbx */
   c = pipe(p->audiopipe);
   if (c) {
@@ -867,6 +874,7 @@
     }
     return -1;
   }
+#endif
 
 /* the pipe is our audio fd for pbx to poll on */
   p->skypiax_sound_capt_fd = p->audiopipe[0];
@@ -883,6 +891,7 @@
   }
 */
 
+#ifdef NOTDEF_WIN32_SKYPIAX
   c = pipe(p->audioskypepipe);
   if (c) {
     ERRORA("Unable to create audioskypepipe\n", SKYPIAX_P_LOG);
@@ -891,7 +900,6 @@
     }
     return -1;
   }
-#ifndef WIN32_SKYPIAX
   fcntl(p->audioskypepipe[0], F_SETFL, O_NONBLOCK);
   fcntl(p->audioskypepipe[1], F_SETFL, O_NONBLOCK);
 #endif// WIN32_SKYPIAX



More information about the Freeswitch-branches mailing list