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

FreeSWITCH SVN gmaruzz at freeswitch.org
Thu Jan 8 03:08:21 PST 2009


Author: gmaruzz
Date: Thu Jan  8 05:08:21 2009
New Revision: 11091

Log:
skypiax: no more global_session, sends DTMFs. mod_skypiax is now virtually finished ;-)

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	Thu Jan  8 05:08:21 2009
@@ -31,7 +31,7 @@
 switch_endpoint_interface_t *skypiax_endpoint_interface;
 switch_memory_pool_t *skypiax_module_pool = NULL;
 int running = 1;
-switch_core_session_t *global_session = NULL;
+//switch_core_session_t *global_session = NULL;
 /*************************************************/
 /*************************************************/
 /*************************************************/
@@ -286,9 +286,16 @@
 static switch_status_t channel_send_dtmf(switch_core_session_t * session,
                                          const switch_dtmf_t * dtmf)
 {
+  skypiax_interface_t *p = NULL;
   private_t *tech_pvt = switch_core_session_get_private(session);
   switch_assert(tech_pvt != NULL);
 
+  p = tech_pvt->p;
+
+  NOTICA( "DTMF: %c\n", SKYPIAX_P_LOG, dtmf->digit);
+
+skypiax_skype_senddigit(p, dtmf->digit);
+
   return SWITCH_STATUS_SUCCESS;
 }
 
@@ -658,7 +665,7 @@
         ERRORA("no tech_pvt?\n", SKYPIAX_P_LOG);
       }
       p->interface_state = SKYPIAX_STATE_DOWN;
-      global_session = NULL;    //FIXME
+      tech_pvt->session = NULL;    //FIXME
     }
   }
 

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	Thu Jan  8 05:08:21 2009
@@ -249,3 +249,4 @@
 
 int skypiax_skype_call(struct skypiax_interface *p, char *idest, int timeout,
                        switch_core_session_t * session);
+int skypiax_skype_senddigit(struct skypiax_interface *p, 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	Thu Jan  8 05:08:21 2009
@@ -10,7 +10,7 @@
 /**********************************************************/
 /**********************************************************/
 
-extern switch_core_session_t *global_session;
+//extern switch_core_session_t *global_session;
 
 #ifdef WIN32
 #else /* NOT WIN32 */
@@ -1231,6 +1231,10 @@
   fd_set fs;
   struct timeval to;
 #endif /* WIN32 */
+              private_t *tech_pvt = NULL;
+
+              tech_pvt = p->tech_pvt;
+
 
   if (option_debug > 100) {
     DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
@@ -1623,7 +1627,7 @@
 
                 //FIXME *new_session=switch_loadable_module_create_interface(skypiax_endpoint_interface, pool);
 
-                if (!global_session) {  //FIXME FIXME FIXME 
+                if (!p->tech_pvt || !tech_pvt->session) {  //FIXME FIXME FIXME 
                   switch_core_session_t *session = NULL;
                   private_t *tech_pvt = NULL;
                   switch_channel_t *channel = NULL;
@@ -1680,8 +1684,8 @@
                   switch_channel_t *channel = NULL;
 
                   tech_pvt = p->tech_pvt;
-                  //session = tech_pvt->session;
-                  session = global_session;
+                  session = tech_pvt->session;
+                  //session = global_session;
                   channel = switch_core_session_get_channel(session);
                   //DEBUGA_SKYPE("skype_call: %s, answered\n", SKYPIAX_P_LOG, id);
                   switch_channel_mark_answered(channel);
@@ -1714,11 +1718,33 @@
   return 0;
 }
 
+int skypiax_skype_senddigit(struct skypiax_interface *p, char digit)
+{
+  char msg_to_skype[1024];
+  if (option_debug > 10) {
+    DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
+  }
+
+  NOTICA("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
+
+  sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
+
+  skypiax_skype_write(p, msg_to_skype);
+
+  if (option_debug > 10) {
+    DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
+  }
+  return 0;
+}
+
 int skypiax_skype_call(struct skypiax_interface *p, char *idest, int timeout,
                        switch_core_session_t * session)
 {
   char *rdest;
   char msg_to_skype[1024];
+  private_t *tech_pvt;
+
+  tech_pvt = p->tech_pvt;
 
   if (option_debug > 10) {
     DEBUGA_PBX("ENTERING FUNC\n", SKYPIAX_P_LOG);
@@ -1745,7 +1771,7 @@
     }
     return -1;
   }
-  global_session = session;
+  tech_pvt->session = session;
 
   //FIXME ast_queue_control(p->owner, SKYPIAX_CONTROL_RINGING);
   return 0;



More information about the Freeswitch-branches mailing list