[Freeswitch-branches] [commit] r11922 - in freeswitch/branches/gmaruzz/mod_skypiax: . asterisk configs

FreeSWITCH SVN gmaruzz at freeswitch.org
Thu Feb 12 06:46:51 PST 2009


Author: gmaruzz
Date: Thu Feb 12 08:46:51 2009
New Revision: 11922

Log:
skypiax: cleaning

Modified:
   freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
   freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
   freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax.conf.xml
   freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
   freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
   freeswitch/branches/gmaruzz/mod_skypiax/skypiax_protocol.c

Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/chan_skypiax.c	Thu Feb 12 08:46:51 2009
@@ -385,7 +385,7 @@
     DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPIAX_P_LOG, p->skype_call_id);
     //sprintf(msg_to_skype, "SET CALL %s STATUS FINISHED", p->skype_call_id);
     sprintf(msg_to_skype, "ALTER CALL %s HANGUP", p->skype_call_id);
-    skypiax_skype_write(p, msg_to_skype);
+    skypiax_signaling_write(p, msg_to_skype);
   }
 
   while (p->interface_state != SKYPIAX_STATE_DOWN) {
@@ -490,7 +490,7 @@
 
   sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
 
-  skypiax_skype_write(p, msg_to_skype);
+  skypiax_signaling_write(p, msg_to_skype);
 
   return 0;
 }
@@ -504,7 +504,7 @@
 
   sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
 
-  skypiax_skype_write(p, msg_to_skype);
+  skypiax_signaling_write(p, msg_to_skype);
 
   return 0;
 }
@@ -1477,7 +1477,7 @@
 
       if (p->skype) {
         if (FD_ISSET(p->SkypiaxHandles.fdesc[0], &rfds)) {
-          res = skypiax_skype_read(p);
+          res = skypiax_signaling_read(p);
           if (res == CALLFLOW_INCOMING_CALLID || res == CALLFLOW_INCOMING_RING) {
             //ast_log(LOG_NOTICE, "CALLFLOW_INCOMING_RING SKYPE\n");
             DEBUGA_SKYPE("CALLFLOW_INCOMING_RING\n", SKYPIAX_P_LOG);
@@ -1569,7 +1569,7 @@
     usleep(1000);
     pthread_testcancel();
     if (p->skype) {
-      res = skypiax_skype_read(p);
+      res = skypiax_signaling_read(p);
       if (res == CALLFLOW_INCOMING_HANGUP) {
         DEBUGA_SKYPE("skype call ended\n", SKYPIAX_P_LOG);
         if (p->owner) {
@@ -1951,7 +1951,7 @@
     if (c == 1023)
       break;
   }
-  skypiax_skype_write(p, skype_msg);
+  skypiax_signaling_write(p, skype_msg);
   return RESULT_SUCCESS;
 }
 
@@ -2074,7 +2074,7 @@
 
         p->skype_friends[0] = '\0';
         sprintf(msg_to_skype, "#333 SEARCH FRIENDS");
-        if (skypiax_skype_write(p, msg_to_skype) < 0) {
+        if (skypiax_signaling_write(p, msg_to_skype) < 0) {
           return -1;
         }
 
@@ -2116,7 +2116,7 @@
 
               p->skype_displayname[0] = '\0';
               sprintf(msg_to_skype, "#765 GET USER %s DISPLAYNAME", where);
-              skypiax_skype_write(p, msg_to_skype);
+              skypiax_signaling_write(p, msg_to_skype);
               int displayname_count = 0;
               while (p->skype_displayname[0] == '\0') {
                 /* FIXME needs a timeout, can't wait forever! 
@@ -2198,7 +2198,7 @@
 
               p->skype_fullname[0] = '\0';
               sprintf(msg_to_skype, "#222 GET USER %s FULLNAME", where);
-              skypiax_skype_write(p, msg_to_skype);
+              skypiax_signaling_write(p, msg_to_skype);
               int fullname_count = 0;
               while (p->skype_fullname[0] == '\0') {
                 /* FIXME needs a timeout, can't wait forever! 

Modified: freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/asterisk/skypiax.h	Thu Feb 12 08:46:51 2009
@@ -317,8 +317,8 @@
 //int skypiax2skype(struct ast_channel *c, void *data);
 //int skype2skypiax(struct ast_channel *c, void *data);
 //void skypiax_skype_disconnect(void);
-int skypiax_skype_write(struct skypiax_pvt *p, char *msg_to_skype);
-int skypiax_skype_read(struct skypiax_pvt *p);
+int skypiax_signaling_write(struct skypiax_pvt *p, char *msg_to_skype);
+int skypiax_signaling_read(struct skypiax_pvt *p);
 int skypiax_console_skype(int fd, int argc, char *argv[]);
 #ifdef WANT_SKYPE_X11
 int X11_errors_handler(Display * dpy, XErrorEvent * err);
@@ -403,7 +403,7 @@
 int new_inbound_channel(private_t * tech_pvt);
 int outbound_channel_answered(private_t * tech_pvt);
 int skypiax_skype_senddigit(struct skypiax_pvt *p, char digit);
-int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
 #if defined(WIN32) && !defined(__CYGWIN__)
 int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
 int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);

Modified: freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax.conf.xml
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax.conf.xml	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/configs/skypiax.conf.xml	Thu Feb 12 08:46:51 2009
@@ -4,7 +4,6 @@
     <param name="codec-master" value="us"/>
     <param name="dialplan" value="XML"/>
     <param name="context" value="default"/>
-    <param name="destination" value="5000"/>
     <param name="codec-prefs" value="gsm,ulaw"/>
     <param name="codec-rates" value="8000,16000"/>
     <param name="hold-music" value="$${moh_uri}"/>
@@ -19,6 +18,7 @@
 	<param name="tcp_cli_port" value="15556"/>
 	<param name="tcp_srv_port" value="15557"/>
 	<param name="skype_user" value="skypiax1"/>
+    	<param name="destination" value="3101"/>
     </interface>
     <interface id="2" name="skypiax2">
 	<param name="hold-music" value="$${moh_uri}"/>
@@ -28,6 +28,7 @@
 	<param name="tcp_cli_port" value="15558"/>
 	<param name="tcp_srv_port" value="15559"/>
 	<param name="skype_user" value="skypiax2"/>
+    	<param name="destination" value="5000"/>
     </interface>
     <!-- following interfaces are commented out!
     <interface id="3" name="skypiax3">

Modified: freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/mod_skypiax.c	Thu Feb 12 08:46:51 2009
@@ -161,7 +161,7 @@
     //switch_thread_cond_signal(tech_pvt->cond);
     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);
+    skypiax_signaling_write(tech_pvt, msg_to_skype);
   }
 
   if (tech_pvt->read_codec.implementation) {
@@ -580,7 +580,7 @@
 }
 
 /*!
- * \brief This thread runs during a call, and monitor the interface serial port for signaling, like hangup, caller id, etc
+ * \brief This thread runs during a call, and monitor the interface for signaling, like hangup, caller id, etc most of signaling is handled inside the skypiax_signaling_read function
  *
  */
 static void *SWITCH_THREAD_FUNC skypiax_signaling_thread_func(switch_thread_t * thread,
@@ -596,7 +596,7 @@
   while (forever) {
     if (!running)
       break;
-    res = skypiax_skype_read(tech_pvt);
+    res = skypiax_signaling_read(tech_pvt);
     if (res == CALLFLOW_INCOMING_HANGUP) {
       switch_core_session_t *session = NULL;
       //private_t *tech_pvt = NULL;

Modified: freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h
==============================================================================
--- freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h	(original)
+++ freeswitch/branches/gmaruzz/mod_skypiax/skypiax.h	Thu Feb 12 08:46:51 2009
@@ -164,7 +164,6 @@
   switch_caller_profile_t *caller_profile;
   switch_mutex_t *mutex;
   switch_mutex_t *flag_mutex;
-  //switch_thread_cond_t *cond;
 
   char interface_id[80];
   char name[80];
@@ -240,8 +239,8 @@
 void skypiax_tech_init(private_t * tech_pvt, switch_core_session_t * session);
 int skypiax_skypeaudio_read(private_t * tech_pvt);
 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_signaling_write(private_t * tech_pvt, char *msg_to_skype);
+int skypiax_signaling_read(private_t * tech_pvt);
 
 int skypiax_skype_call(private_t * tech_pvt, char *idest, int timeout);
 int skypiax_skype_senddigit(private_t * tech_pvt, char digit);
@@ -258,7 +257,7 @@
 int start_audio_threads(private_t * tech_pvt);
 int new_inbound_channel(private_t * tech_pvt);
 int outbound_channel_answered(private_t * tech_pvt);
-int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype);
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
 #if defined(WIN32) && !defined(__CYGWIN__)
 int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
 int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);

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	Thu Feb 12 08:46:51 2009
@@ -23,7 +23,7 @@
 #endif /* WIN32 */
 /*************************************/
 
-int skypiax_skype_read(private_t * tech_pvt)
+int skypiax_signaling_read(private_t * tech_pvt)
 {
   char read_from_pipe[4096];
   char message[4096];
@@ -56,7 +56,7 @@
           ("If I don't connect immediately, please give the Skype client authorization to be connected by Skypiax (and to not ask you again)\n",
            SKYPIAX_P_LOG);
         skypiax_sleep(1000000);
-        skypiax_skype_write(tech_pvt, "PROTOCOL 7");
+        skypiax_signaling_write(tech_pvt, "PROTOCOL 7");
         skypiax_sleep(10000);
         return 0;
       }
@@ -118,7 +118,7 @@
                        SKYPIAX_P_LOG, message, obj, id, prop);
           //TODO: allow authorization based on config param
           sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id);
-          skypiax_skype_write(tech_pvt, msg_to_skype);
+          skypiax_signaling_write(tech_pvt, msg_to_skype);
         }
       }
       if (!strcasecmp(message, "MESSAGE")) {
@@ -136,7 +136,7 @@
                          SKYPIAX_P_LOG, message, obj, id, prop, value);
             //TODO: authomatically flag messages as read based on config param
             sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
-            skypiax_skype_write(tech_pvt, msg_to_skype);
+            skypiax_signaling_write(tech_pvt, msg_to_skype);
           }
         } else if (!strcasecmp(prop, "BODY")) {
           char msg_to_skype[256];
@@ -144,7 +144,7 @@
                        SKYPIAX_P_LOG, message, obj, id, prop);
           //TODO: authomatically flag messages as read based on config param
           sprintf(msg_to_skype, "SET MESSAGE %s SEEN", id);
-          skypiax_skype_write(tech_pvt, msg_to_skype);
+          skypiax_signaling_write(tech_pvt, msg_to_skype);
         }
       }
       if (!strcasecmp(message, "CALL")) {
@@ -213,18 +213,18 @@
                 tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING;
                 tech_pvt->interface_state = SKYPIAX_STATE_RING;
                 /* no owner, no active call, let's answer */
-                skypiax_skype_write(tech_pvt, "SET AGC OFF");
+                skypiax_signaling_write(tech_pvt, "SET AGC OFF");
                 skypiax_sleep(10000);
-                skypiax_skype_write(tech_pvt, "SET AEC OFF");
+                skypiax_signaling_write(tech_pvt, "SET AEC OFF");
                 skypiax_sleep(10000);
                 sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id);
-                skypiax_skype_write(tech_pvt, msg_to_skype);
+                skypiax_signaling_write(tech_pvt, msg_to_skype);
                 skypiax_sleep(10000);
                 sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id);
-                skypiax_skype_write(tech_pvt, msg_to_skype);
+                skypiax_signaling_write(tech_pvt, msg_to_skype);
                 skypiax_sleep(10000);
                 sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id);
-                skypiax_skype_write(tech_pvt, msg_to_skype);
+                skypiax_signaling_write(tech_pvt, msg_to_skype);
                 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);
@@ -254,7 +254,7 @@
                      SKYPIAX_P_LOG, tech_pvt->skype_call_id, id);
                   sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id);
                 }
-                skypiax_skype_write(tech_pvt, msg_to_skype);
+                skypiax_signaling_write(tech_pvt, msg_to_skype);
                 skypiax_sleep(10000);
                 DEBUGA_SKYPE
                   ("We (%s) have NOT answered a Skype RING on skype_call %s, because we are already in a skypiax call\n",
@@ -348,11 +348,11 @@
               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);
+              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_skype_write(tech_pvt, msg_to_skype);
+              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);
@@ -713,7 +713,7 @@
 
   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);
-  skypiax_skype_write(tech_pvt, msg_to_skype);
+  skypiax_signaling_write(tech_pvt, msg_to_skype);
 
   return 0;
 }
@@ -724,13 +724,13 @@
 
   skypiax_sleep(5000);
   DEBUGA_SKYPE("Calling Skype, rdest is: %s\n", SKYPIAX_P_LOG, rdest);
-  skypiax_skype_write(tech_pvt, "SET AGC OFF");
+  skypiax_signaling_write(tech_pvt, "SET AGC OFF");
   skypiax_sleep(10000);
-  skypiax_skype_write(tech_pvt, "SET AEC OFF");
+  skypiax_signaling_write(tech_pvt, "SET AEC OFF");
   skypiax_sleep(10000);
 
   sprintf(msg_to_skype, "CALL %s", rdest);
-  if (skypiax_skype_write(tech_pvt, msg_to_skype) < 0) {
+  if (skypiax_signaling_write(tech_pvt, msg_to_skype) < 0) {
     ERRORA("failed to communicate with Skype client, now exit\n", SKYPIAX_P_LOG);
     return -1;
   }
@@ -868,7 +868,7 @@
   return res;
 }
 
-int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype)
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
 {
   static char acInputRow[1024];
   COPYDATASTRUCT oCopyData;
@@ -1189,7 +1189,7 @@
 
   return 1;
 }
-int skypiax_skype_write(private_t * tech_pvt, char *msg_to_skype)
+int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype)
 {
   struct SkypiaxHandles *SkypiaxHandles;
 



More information about the Freeswitch-branches mailing list