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

FreeSWITCH SVN gmaruzz at freeswitch.org
Tue Dec 9 01:43:33 PST 2008


Author: gmaruzz
Date: Tue Dec  9 04:43:33 2008
New Revision: 10670

Log:
skypiax: added skypiax.h, beginning to structure files

Added:
   freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax.h
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	Tue Dec  9 04:43:33 2008
@@ -1,114 +1,5 @@
-/*
- * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct at yahoo.com>
- *
- * Version: MPL 1.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- *
- * The Initial Developer of the Original Code is
- * Anthony Minessale II <anthmct at yahoo.com>
- * Portions created by the Initial Developer are Copyright (C)
- * the Initial Developer. All Rights Reserved.
- *
- * This module (mod_skypiax) has been contributed by:
- *
- * Giovanni Maruzzelli (gmaruzz at gmail.com)
- *
- *
- * Further Contributors:
- *
- *
- *
- * mod_skypiax.c -- Skype compatible Endpoint Module
- *
- */
-
-#undef WIN32_SKYPIAX
-#undef __CYGWIN__
-#define MOD_SKYPIAX
-#ifdef MOD_SKYPIAX
-
-#ifndef WIN32_SKYPIAX
-#include <X11/Xlib.h>
-#include <X11/Xlibint.h>
-#include <X11/Xatom.h>
-#else //WIN32_SKYPIAX
-//FIXME include?
-#endif //WIN32_SKYPIAX
-
-#include <switch.h>
-
-#define SKYPIAX_SVN_VERSION "SVN 123456"
-
-#define DEBUGA_SKYPE(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SKYPE  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
-#define DEBUGA_CALL(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_CALL  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
-#define DEBUGA_PBX(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_PBX  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
-#define ERRORA(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][ERRORA  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
-#define WARNINGA(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][WARNINGA  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
-#define NOTICA(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][NOTICA  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
-
-#define SKYPIAX_P_LOG NULL, (unsigned long)55, __LINE__, p ? p->name ? p->name : "none" : "none", -1, p ? p->interface_state : -1, p ? p->skype_callflow : -1
-
-/*********************************/
-#define SKYPIAX_CAUSE_NORMAL		1
-/*********************************/
-#define SKYPIAX_FRAME_DTMF			1
-/*********************************/
-#define SKYPIAX_CONTROL_RINGING		1
-#define SKYPIAX_CONTROL_ANSWER		2
-
-/*********************************/
-#define		SKYPIAX_STATE_DOWN		1
-#define		SKYPIAX_STATE_RING		2
-#define		SKYPIAX_STATE_DIALING	3
-#define		SKYPIAX_STATE_BUSY		4
-#define		SKYPIAX_STATE_UP		5
-#define		SKYPIAX_STATE_RINGING	6
-#define		SKYPIAX_STATE_PRERING	7
-/*********************************/
-/* call flow from the device */
-#define 	CALLFLOW_CALL_IDLE  SKYPIAX_STATE_DOWN
-#define 	CALLFLOW_INCOMING_RING  SKYPIAX_STATE_RING
-#define 	CALLFLOW_CALL_DIALING   SKYPIAX_STATE_DIALING
-#define 	CALLFLOW_CALL_LINEBUSY   SKYPIAX_STATE_BUSY
-#define 	CALLFLOW_CALL_ACTIVE   300
-#define 	CALLFLOW_INCOMING_HANGUP   100
-#define 	CALLFLOW_CALL_RELEASED   101
-#define 	CALLFLOW_CALL_NOCARRIER   102
-#define 	CALLFLOW_CALL_INFLUX   103
-#define 	CALLFLOW_CALL_INCOMING   104
-#define 	CALLFLOW_CALL_FAILED   105
-#define 	CALLFLOW_CALL_NOSERVICE   106
-#define 	CALLFLOW_CALL_OUTGOINGRESTRICTED   107
-#define 	CALLFLOW_CALL_SECURITYFAIL   108
-#define 	CALLFLOW_CALL_NOANSWER   109
-#define 	CALLFLOW_STATUS_FINISHED   110
-#define 	CALLFLOW_STATUS_CANCELLED   111
-#define 	CALLFLOW_STATUS_FAILED   112
-#define 	CALLFLOW_STATUS_REFUSED   113
-#define 	CALLFLOW_STATUS_RINGING   114
-#define 	CALLFLOW_STATUS_INPROGRESS   115
-#define 	CALLFLOW_STATUS_UNPLACED   116
-#define 	CALLFLOW_STATUS_ROUTING   117
-#define 	CALLFLOW_STATUS_EARLYMEDIA   118
-#define 	SKYPIAX_STATE_HANGUP_REQUESTED   200
-  //FIXME CALLFLOW_INCOMING_CALLID to be removed
-#define 	CALLFLOW_INCOMING_CALLID   1019
+#include "skypiax.h"
 
-/*********************************/
-
-#define SKYPIAX_MAX_INTERFACES 64
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_skypiax_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypiax_shutdown);
@@ -119,23 +10,6 @@
 static switch_memory_pool_t *module_pool = NULL;
 static int running = 1;
 
-#ifndef WIN32_SKYPIAX
-struct AsteriskHandles {
-  Window skype_win;
-  Display *disp;
-  Window win;
-  switch_file_t *fdesc[2];
-};
-#else //WIN32_SKYPIAX
-
-struct AsteriskHandles {
-  HWND win32_hInit_MainWindowHandle;
-  HWND win32_hGlobal_SkypeAPIWindowHandle;
-  switch_file_t *fdesc[2];
-};
-
-#endif //WIN32_SKYPIAX
-
 typedef enum {
   TFLAG_IO = (1 << 0),
   TFLAG_INBOUND = (1 << 1),
@@ -170,76 +44,14 @@
   switch_mutex_t *mutex;
 } globals;
 
-struct skypiax_interface {
-  char interface_id[80];
-  char name[80];
-  char dialplan[80];
-  char context[80];
-  char dial_regex[256];
-  char fail_dial_regex[256];
-  char hold_music[256];
-  char type[256];
-  char X11_display[256];
-  struct AsteriskHandles AsteriskHandlesAst;
-
-  int interface_state;          /*!< \brief 'state' of the interface (channel) */
-  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 */
-  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;
-  double capture_boost;
-  int stripmsd;
-  switch_thread_t *skype_thread;
-  char skype_call_id[512];
-  int skype_call_ongoing;
-  char skype_friends[4096];
-  char skype_fullname[512];
-  char skype_displayname[512];
-  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;
-  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];
-  int audiobuf_is_loaded;
-
-  //int phonebook_listing;
-  //int phonebook_querying;
-  //int phonebook_listing_received_calls;
-
-  //int phonebook_first_entry;
-  //int phonebook_last_entry;
-  //int phonebook_number_lenght;
-  //int phonebook_text_lenght;
-  FILE *phonebook_writing_fp;
-  int skypiax_dir_entry_extension_prefix;
-  void *tech_pvt;
-};
+static skypiax_interface_t SKYPIAX_INTERFACES[SKYPIAX_MAX_INTERFACES];
+
+int option_debug = 100;
+switch_core_session_t *global_session = NULL;
 
-typedef struct skypiax_interface skypiax_interface_t;
 
-static skypiax_interface_t SKYPIAX_INTERFACES[SKYPIAX_MAX_INTERFACES];
 
-struct private_object {
-  unsigned int flags;
-  switch_codec_t read_codec;
-  switch_codec_t write_codec;
-  switch_frame_t read_frame;
-  unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
-  switch_core_session_t *session;
-  switch_caller_profile_t *caller_profile;
-  switch_mutex_t *mutex;
-  switch_mutex_t *flag_mutex;
-  skypiax_interface_t *p;
-  //switch_thread_cond_t *cond;
-};
 
-typedef struct private_object private_t;
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan);
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string);
@@ -267,8 +79,6 @@
                                            int stream_id);
 static switch_status_t channel_kill_channel(switch_core_session_t * session, int sig);
 
-int option_debug = 100;
-switch_core_session_t *global_session = NULL;
 
 #ifdef WIN32_SKYPIAX
 #ifdef __CYGWIN__
@@ -1590,7 +1400,7 @@
 
       if (read_from_pipe[i] == '\0') {
 
-        if (option_debug > 101)
+        //if (option_debug > 101)
           DEBUGA_SKYPE("read_skype: howmany=%d, i=%d, a=%d, |||%s||| \n", SKYPIAX_P_LOG,
                        howmany, i, a, messaggio);
 
@@ -2511,4 +2321,3 @@
  * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
  */
 
-#endif /* MOD_SKYPIAX */

Added: freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax.h
==============================================================================
--- (empty file)
+++ freeswitch/branches/gmaruzz/src/mod/endpoints/mod_skypiax/skypiax.h	Tue Dec  9 04:43:33 2008
@@ -0,0 +1,197 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005/2006, Anthony Minessale II <anthmct at yahoo.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthmct at yahoo.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This module (mod_skypiax) has been contributed by:
+ *
+ * Giovanni Maruzzelli (gmaruzz at gmail.com)
+ *
+ *
+ * Further Contributors:
+ *
+ *
+ *
+ * mod_skypiax.c -- Skype compatible Endpoint Module
+ *
+ */
+
+#undef WIN32_SKYPIAX
+#undef __CYGWIN__
+
+#ifndef WIN32_SKYPIAX
+#include <X11/Xlib.h>
+#include <X11/Xlibint.h>
+#include <X11/Xatom.h>
+#else //WIN32_SKYPIAX
+//FIXME include?
+#endif //WIN32_SKYPIAX
+
+#include <switch.h>
+
+#define SKYPIAX_SVN_VERSION "SVN 123456"
+
+#define DEBUGA_SKYPE(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SKYPE  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_CALL(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_CALL  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define DEBUGA_PBX(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_PBX  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define ERRORA(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][ERRORA  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define WARNINGA(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][WARNINGA  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+#define NOTICA(...)  switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, 		"rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][NOTICA  %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
+
+#define SKYPIAX_P_LOG NULL, (unsigned long)55, __LINE__, p ? p->name ? p->name : "none" : "none", -1, p ? p->interface_state : -1, p ? p->skype_callflow : -1
+
+/*********************************/
+#define SKYPIAX_CAUSE_NORMAL		1
+/*********************************/
+#define SKYPIAX_FRAME_DTMF			1
+/*********************************/
+#define SKYPIAX_CONTROL_RINGING		1
+#define SKYPIAX_CONTROL_ANSWER		2
+
+/*********************************/
+#define		SKYPIAX_STATE_DOWN		1
+#define		SKYPIAX_STATE_RING		2
+#define		SKYPIAX_STATE_DIALING	3
+#define		SKYPIAX_STATE_BUSY		4
+#define		SKYPIAX_STATE_UP		5
+#define		SKYPIAX_STATE_RINGING	6
+#define		SKYPIAX_STATE_PRERING	7
+/*********************************/
+/* call flow from the device */
+#define 	CALLFLOW_CALL_IDLE  SKYPIAX_STATE_DOWN
+#define 	CALLFLOW_INCOMING_RING  SKYPIAX_STATE_RING
+#define 	CALLFLOW_CALL_DIALING   SKYPIAX_STATE_DIALING
+#define 	CALLFLOW_CALL_LINEBUSY   SKYPIAX_STATE_BUSY
+#define 	CALLFLOW_CALL_ACTIVE   300
+#define 	CALLFLOW_INCOMING_HANGUP   100
+#define 	CALLFLOW_CALL_RELEASED   101
+#define 	CALLFLOW_CALL_NOCARRIER   102
+#define 	CALLFLOW_CALL_INFLUX   103
+#define 	CALLFLOW_CALL_INCOMING   104
+#define 	CALLFLOW_CALL_FAILED   105
+#define 	CALLFLOW_CALL_NOSERVICE   106
+#define 	CALLFLOW_CALL_OUTGOINGRESTRICTED   107
+#define 	CALLFLOW_CALL_SECURITYFAIL   108
+#define 	CALLFLOW_CALL_NOANSWER   109
+#define 	CALLFLOW_STATUS_FINISHED   110
+#define 	CALLFLOW_STATUS_CANCELLED   111
+#define 	CALLFLOW_STATUS_FAILED   112
+#define 	CALLFLOW_STATUS_REFUSED   113
+#define 	CALLFLOW_STATUS_RINGING   114
+#define 	CALLFLOW_STATUS_INPROGRESS   115
+#define 	CALLFLOW_STATUS_UNPLACED   116
+#define 	CALLFLOW_STATUS_ROUTING   117
+#define 	CALLFLOW_STATUS_EARLYMEDIA   118
+#define 	SKYPIAX_STATE_HANGUP_REQUESTED   200
+  //FIXME CALLFLOW_INCOMING_CALLID to be removed
+#define 	CALLFLOW_INCOMING_CALLID   1019
+
+/*********************************/
+
+#define SKYPIAX_MAX_INTERFACES 64
+
+#ifndef WIN32_SKYPIAX
+struct AsteriskHandles {
+  Window skype_win;
+  Display *disp;
+  Window win;
+  switch_file_t *fdesc[2];
+};
+#else //WIN32_SKYPIAX
+
+struct AsteriskHandles {
+  HWND win32_hInit_MainWindowHandle;
+  HWND win32_hGlobal_SkypeAPIWindowHandle;
+  switch_file_t *fdesc[2];
+};
+
+#endif //WIN32_SKYPIAX
+
+struct skypiax_interface {
+  char interface_id[80];
+  char name[80];
+  char dialplan[80];
+  char context[80];
+  char dial_regex[256];
+  char fail_dial_regex[256];
+  char hold_music[256];
+  char type[256];
+  char X11_display[256];
+  struct AsteriskHandles AsteriskHandlesAst;
+
+  int interface_state;          /*!< \brief 'state' of the interface (channel) */
+  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 */
+  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;
+  double capture_boost;
+  int stripmsd;
+  switch_thread_t *skype_thread;
+  char skype_call_id[512];
+  int skype_call_ongoing;
+  char skype_friends[4096];
+  char skype_fullname[512];
+  char skype_displayname[512];
+  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;
+  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];
+  int audiobuf_is_loaded;
+
+  //int phonebook_listing;
+  //int phonebook_querying;
+  //int phonebook_listing_received_calls;
+
+  //int phonebook_first_entry;
+  //int phonebook_last_entry;
+  //int phonebook_number_lenght;
+  //int phonebook_text_lenght;
+  FILE *phonebook_writing_fp;
+  int skypiax_dir_entry_extension_prefix;
+  void *tech_pvt;
+};
+
+typedef struct skypiax_interface skypiax_interface_t;
+
+struct private_object {
+  unsigned int flags;
+  switch_codec_t read_codec;
+  switch_codec_t write_codec;
+  switch_frame_t read_frame;
+  unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+  switch_core_session_t *session;
+  switch_caller_profile_t *caller_profile;
+  switch_mutex_t *mutex;
+  switch_mutex_t *flag_mutex;
+  skypiax_interface_t *p;
+  //switch_thread_cond_t *cond;
+};
+
+typedef struct private_object private_t;
+
+



More information about the Freeswitch-svn mailing list