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

FreeSWITCH SVN gmaruzz at freeswitch.org
Sun Jan 11 05:28:39 PST 2009


Author: gmaruzz
Date: Sun Jan 11 07:28:39 2009
New Revision: 11121

Log:
skypiax: beginning cleaning

Modified:
   freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/mod_skypiax.c
   freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax.h
   freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.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	Sun Jan 11 07:28:39 2009
@@ -2,7 +2,7 @@
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_skypiax_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown);
-SWITCH_MODULE_DEFINITION(mod_skypiax, mod_skypiax_load, mod_skypiax_shutdown, NULL);    //mod_skypiax_runtime);
+SWITCH_MODULE_DEFINITION(mod_skypiax, mod_skypiax_load, mod_skypiax_shutdown, NULL);
 
 static struct {
   int debug;
@@ -152,7 +152,7 @@
 
   if (strlen(tech_pvt->skype_call_id)) {
     //switch_thread_cond_signal(tech_pvt->cond);
-    WARNINGA("hanging up skype call: %s\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id);
+    DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPIAX_P_LOG, tech_pvt->skype_call_id);
     sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id);
     skypiax_skype_write(tech_pvt, msg_to_skype);
   }
@@ -260,7 +260,7 @@
   private_t *tech_pvt = switch_core_session_get_private(session);
   switch_assert(tech_pvt != NULL);
 
-  NOTICA("DTMF: %c\n", SKYPIAX_P_LOG, dtmf->digit);
+  DEBUGA_SKYPE("DTMF: %c\n", SKYPIAX_P_LOG, dtmf->digit);
 
   skypiax_skype_senddigit(tech_pvt, dtmf->digit);
 
@@ -411,7 +411,7 @@
     break;
   default:
     {
-      WARNINGA("MSG_ID=%d\n", SKYPIAX_P_LOG, msg->message_id);
+      DEBUGA_SKYPE("MSG_ID=%d\n", SKYPIAX_P_LOG, msg->message_id);
     }
     break;
   }
@@ -493,7 +493,6 @@
             DEBUGA_SKYPE("globals.SKYPIAX_INTERFACES[%d].name=|||%s|||?\n", SKYPIAX_P_LOG,
                          i, globals.SKYPIAX_INTERFACES[i].name);
             tech_pvt = &globals.SKYPIAX_INTERFACES[i];  //FIXME
-            //globals.SKYPIAX_INTERFACES[i].tech_pvt = tech_pvt;  //FIXME
             found = 1;
             break;
           }
@@ -527,15 +526,6 @@
       snprintf(name, sizeof(name), "skypiax/%s", outbound_profile->destination_number);
       //snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
       switch_channel_set_name(channel, name);
-      NOTICA("outbound_profile->destination_number=|||%s|||\n", SKYPIAX_P_LOG,
-             outbound_profile->destination_number);
-      NOTICA("outbound_profile->username=|||%s|||\n", SKYPIAX_P_LOG,
-             outbound_profile->username);
-      NOTICA("outbound_profile->caller_id_name=|||%s|||\n", SKYPIAX_P_LOG,
-             outbound_profile->caller_id_name);
-      NOTICA("outbound_profile->caller_id_number=|||%s|||\n", SKYPIAX_P_LOG,
-             outbound_profile->caller_id_number);
-
       caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
       switch_channel_set_caller_profile(channel, caller_profile);
       tech_pvt->caller_profile = caller_profile;
@@ -560,7 +550,7 @@
  * \brief This thread runs during a call, and monitor the interface serial port for signaling, like hangup, caller id, etc
  *
  */
-static void *SWITCH_THREAD_FUNC skypiax_do_controldev_thread(switch_thread_t * thread,
+static void *SWITCH_THREAD_FUNC skypiax_signaling_thread_func(switch_thread_t * thread,
                                                              void *obj)
 {
   private_t *tech_pvt = obj;
@@ -569,7 +559,7 @@
 
   DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
 
-  DEBUGA_SKYPE("In skypiax_do_controldev_thread: started, p=%p\n", SKYPIAX_P_LOG,
+  DEBUGA_SKYPE("In skypiax_signaling_thread_func: started, p=%p\n", SKYPIAX_P_LOG,
                (void *) tech_pvt);
 
   while (forever) {
@@ -789,8 +779,8 @@
 
       if (interface_id && interface_id < SKYPIAX_MAX_INTERFACES) {
         private_t newconf;
-        switch_threadattr_t *do_skype_thd_attr = NULL;
-        switch_threadattr_t *skypiax_do_controldev_thread_thd_attr = NULL;
+        switch_threadattr_t *skypiax_skypeapi_thread_attr = NULL;
+        switch_threadattr_t *skypiax_signaling_thread_attr = NULL;
 
         memset(&newconf, '\0', sizeof(newconf));
         globals.SKYPIAX_INTERFACES[interface_id] = newconf;
@@ -849,25 +839,25 @@
           ("interface_id=%d globals.SKYPIAX_INTERFACES[interface_id].dialplan=%s\n",
            SKYPIAX_P_LOG, interface_id,
            globals.SKYPIAX_INTERFACES[interface_id].dialplan);
-        NOTICA("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+        DEBUGA_SKYPE("STARTING interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
 
-        switch_threadattr_create(&do_skype_thd_attr, skypiax_module_pool);
-        switch_threadattr_stacksize_set(do_skype_thd_attr, SWITCH_THREAD_STACKSIZE);
+        switch_threadattr_create(&skypiax_skypeapi_thread_attr, skypiax_module_pool);
+        switch_threadattr_stacksize_set(skypiax_skypeapi_thread_attr, SWITCH_THREAD_STACKSIZE);
         switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].
-                             skypiax_do_skype_thread_thread, do_skype_thd_attr,
-                             do_skype_thread, &globals.SKYPIAX_INTERFACES[interface_id],
+                             skypiax_skypeapi_thread, skypiax_skypeapi_thread_attr,
+                             skypiax_skypeapi_thread_func, &globals.SKYPIAX_INTERFACES[interface_id],
                              skypiax_module_pool);
 
         switch_sleep(100000);
 
-        switch_threadattr_create(&skypiax_do_controldev_thread_thd_attr,
+        switch_threadattr_create(&skypiax_signaling_thread_attr,
                                  skypiax_module_pool);
-        switch_threadattr_stacksize_set(skypiax_do_controldev_thread_thd_attr,
+        switch_threadattr_stacksize_set(skypiax_signaling_thread_attr,
                                         SWITCH_THREAD_STACKSIZE);
         switch_thread_create(&globals.SKYPIAX_INTERFACES[interface_id].
-                             skypiax_do_controldev_thread_thread,
-                             skypiax_do_controldev_thread_thd_attr,
-                             skypiax_do_controldev_thread,
+                             skypiax_signaling_thread,
+                             skypiax_signaling_thread_attr,
+                             skypiax_signaling_thread_func,
                              &globals.SKYPIAX_INTERFACES[interface_id],
                              skypiax_module_pool);
 
@@ -878,7 +868,7 @@
         while (globals.SKYPIAX_INTERFACES[interface_id].SkypiaxHandles.api_connected == 0) {
           switch_sleep(1000);
         }
-        NOTICA("STARTED interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
+        DEBUGA_SKYPE("STARTED interface_id=%d\n", SKYPIAX_P_LOG, interface_id);
 
       } else {
         ERRORA("interface id %d is higher than SKYPIAX_MAX_INTERFACES (%d)\n",
@@ -944,7 +934,7 @@
   for (interface_id = 0; interface_id < SKYPIAX_MAX_INTERFACES; interface_id++) {
     tech_pvt = &globals.SKYPIAX_INTERFACES[interface_id];
 
-    if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_do_controldev_thread_thread) {
+    if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
 #ifdef WIN32
       switch_file_write(tech_pvt->SkypiaxHandles.fdesc[1], "sciutati", &howmany);   // let's the controldev_thread die
 #else /* WIN32 */
@@ -952,9 +942,9 @@
 #endif /* WIN32 */
     }
 
-    if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_do_skype_thread_thread) {
+    if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_skypeapi_thread) {
 #ifdef WIN32
-      if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) {  // let's the do_skype_thread die
+      if (SendMessage(tech_pvt->SkypiaxHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) {  // let's the skypiax_skypeapi_thread_func die
         ERRORA("WHY FALSE HERE? %d\n", SKYPIAX_P_LOG, GetLastError());
       }
 #else
@@ -978,15 +968,15 @@
       x--;
       switch_yield(20000);
     }
-    if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_do_controldev_thread_thread) {
+    if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_signaling_thread) {
       switch_thread_join(&status,
                          globals.SKYPIAX_INTERFACES[interface_id].
-                         skypiax_do_controldev_thread_thread);
+                         skypiax_signaling_thread);
     }
-    if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_do_skype_thread_thread) {
+    if (globals.SKYPIAX_INTERFACES[interface_id].skypiax_skypeapi_thread) {
       switch_thread_join(&status,
                          globals.SKYPIAX_INTERFACES[interface_id].
-                         skypiax_do_skype_thread_thread);
+                         skypiax_skypeapi_thread);
     }
   }
   return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax.h	(original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax.h	Sun Jan 11 07:28:39 2009
@@ -41,8 +41,6 @@
 #include <X11/Xlib.h>
 #include <X11/Xlibint.h>
 #include <X11/Xatom.h>
-#else //WIN32
-//FIXME include?
 #endif //WIN32
 
 #ifdef _MSC_VER
@@ -53,7 +51,6 @@
 
 #define SAMPLERATE_SKYPIAX 16000
 #define SAMPLES_PER_FRAME SAMPLERATE_SKYPIAX/50
-//#define SKYPIAX_SVN_VERSION "SVN 123456"
 #define SKYPIAX_SVN_VERSION SWITCH_VERSION_REVISION
 
 typedef enum {
@@ -164,7 +161,6 @@
   switch_caller_profile_t *caller_profile;
   switch_mutex_t *mutex;
   switch_mutex_t *flag_mutex;
-  //private_t *p;
   //switch_thread_cond_t *cond;
 
   char interface_id[80];
@@ -195,7 +191,6 @@
   double playback_boost;
   double capture_boost;
   int stripmsd;
-  switch_thread_t *skype_thread;
   char skype_call_id[512];
   int skype_call_ongoing;
   char skype_friends[4096];
@@ -213,8 +208,8 @@
 #endif                          /* WIN32 */
   switch_thread_t *tcp_srv_thread;
   switch_thread_t *tcp_cli_thread;
-  switch_thread_t *skypiax_do_controldev_thread_thread;
-  switch_thread_t *skypiax_do_skype_thread_thread;
+  switch_thread_t *skypiax_signaling_thread;
+  switch_thread_t *skypiax_skypeapi_thread;
   short audiobuf[SAMPLES_PER_FRAME];
   int audiobuf_is_loaded;
 
@@ -228,7 +223,6 @@
   //int phonebook_text_lenght;
   FILE *phonebook_writing_fp;
   int skypiax_dir_entry_extension_prefix;
-  //void *tech_pvt;
   char skype_user[256];
   char skype_password[256];
 
@@ -236,13 +230,13 @@
 
 typedef struct private_object private_t;
 
-void *SWITCH_THREAD_FUNC do_skype_thread(switch_thread_t * thread, void *obj);
+void *SWITCH_THREAD_FUNC skypiax_skypeapi_thread_func(switch_thread_t * thread, void *obj);
 void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t * session);
 switch_status_t skypiax_skypeaudio_read(private_t * tech_pvt);
-int skypiax_skypeaudio_init(private_t * p);
-int skypiax_skype_write(private_t * p, char *msg_to_skype);
-int skypiax_skype_read(private_t * p);
+int skypiax_skypeaudio_init(private_t * tech_pvt);
+int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
+int skypiax_skype_read(private_t * tech_pvt);
 
-int skypiax_skype_call(private_t * p, char *idest, int timeout,
+int skypiax_skype_call(private_t * tech_pvt, char *idest, int timeout,
                        switch_core_session_t * session);
-int skypiax_skype_senddigit(private_t * p, char digit);
+int skypiax_skype_senddigit(private_t * tech_pvt, char digit);

Modified: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c
==============================================================================
--- freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	(original)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	Sun Jan 11 07:28:39 2009
@@ -460,9 +460,6 @@
   }
 #endif /* WIN32 */
 
-  ERRORA("tech_pvt->audiopipe[0] = %d\n", SKYPIAX_P_LOG, tech_pvt->audiopipe[0]);
-  ERRORA("tech_pvt->audiopipe[1] = %d\n", SKYPIAX_P_LOG, tech_pvt->audiopipe[1]);
-
   if (option_debug > 10) {
     DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
   }
@@ -728,7 +725,7 @@
 
 DWORD win32_dwThreadId;
 
-void *SWITCH_THREAD_FUNC do_skype_thread(switch_thread_t * thread, void *obj)
+void *SWITCH_THREAD_FUNC skypiax_skypeapi_thread_func(switch_thread_t * thread, void *obj)
 {
   /*  create window class */
   /*    create dummy/hidden window for processing messages */
@@ -877,7 +874,7 @@
   switch_sleep(1000);
 }
 
-void *SWITCH_THREAD_FUNC do_skype_thread(switch_thread_t * thread, void *obj)
+void *SWITCH_THREAD_FUNC skypiax_skypeapi_thread_func(switch_thread_t * thread, void *obj)
 {
 
   private_t *tech_pvt = obj;
@@ -1288,7 +1285,7 @@
             if (!strcasecmp(prop, "PARTNER_HANDLE")) {
               strncpy(tech_pvt->callid_number, value,
                       sizeof(tech_pvt->callid_number) - 1);
-              WARNINGA
+              DEBUGA_SKYPE
                 ("the skype_call %s caller PARTNER_HANDLE (tech_pvt->callid_number) is: %s\n",
                  SKYPIAX_P_LOG, id, tech_pvt->callid_number);
               return CALLFLOW_INCOMING_RING;
@@ -1296,7 +1293,7 @@
             if (!strcasecmp(prop, "PARTNER_DISPNAME")) {
               snprintf(tech_pvt->callid_name, sizeof(tech_pvt->callid_name) - 1, "%s%s%s",
                        value, where ? " " : "", where ? where : "");
-              WARNINGA
+              DEBUGA_SKYPE
                 ("the skype_call %s caller PARTNER_DISPNAME (tech_pvt->callid_name) is: %s\n",
                  SKYPIAX_P_LOG, id, tech_pvt->callid_name);
             }
@@ -1325,7 +1322,7 @@
               if (channel) {
                 switch_dtmf_t dtmf =
                   { (char) value[0], switch_core_default_dtmf_duration(0) };
-                NOTICA("%c DTMF %s\n", SKYPIAX_P_LOG, dtmf.digit,
+                DEBUGA_SKYPE("%c DTMF %s\n", SKYPIAX_P_LOG, dtmf.digit,
                        switch_channel_get_name(channel));
                 switch_mutex_lock(tech_pvt->flag_mutex);
                 switch_channel_queue_dtmf(channel, &dtmf);
@@ -1536,7 +1533,7 @@
                   //private_t *tech_pvt = NULL;
                   switch_channel_t *channel = NULL;
 
-                  NOTICA("New Inbound Channel!\n", SKYPIAX_P_LOG);
+                  DEBUGA_SKYPE("New Inbound Channel!\n", SKYPIAX_P_LOG);
 
                   if ((session =
                        switch_core_session_request(skypiax_endpoint_interface,
@@ -1580,7 +1577,6 @@
                       switch_core_session_destroy(&session);
                     }
                   }
-                  //DEBUGA_SKYPE("skype_call: %s, answered\n", SKYPIAX_P_LOG, id);
                   switch_channel_mark_answered(channel);
                 } else {
                   switch_core_session_t *session = NULL;
@@ -1635,7 +1631,7 @@
     DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
   }
 
-  NOTICA("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
+  DEBUGA_SKYPE("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
 
   sprintf(msg_to_skype, "SET CALL %s DTMF %c", tech_pvt->skype_call_id, digit);
 
@@ -1665,9 +1661,7 @@
   rdest = strchr(idest, '/');
   *rdest++ = '\0';
 
-  if (option_debug)
-    DEBUGA_SKYPE("Calling Skype, rdest is: %s\n", SKYPIAX_P_LOG, rdest);
-  NOTICA("Calling Skype, rdest is: %s\n", SKYPIAX_P_LOG, rdest);
+  DEBUGA_SKYPE("Calling Skype, rdest is: %s\n", SKYPIAX_P_LOG, rdest);
   skypiax_skype_write(tech_pvt, "SET AGC OFF");
   switch_sleep(10000);
   skypiax_skype_write(tech_pvt, "SET AEC OFF");



More information about the Freeswitch-branches mailing list