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

FreeSWITCH SVN gmaruzz at freeswitch.org
Thu Nov 20 04:33:10 PST 2008


Author: gmaruzz
Date: Thu Nov 20 07:33:09 2008
New Revision: 10475

Log:
skypiax: moved the launch of the audio server thread to the start of the call. The audio srv thread need to be made to die when the call ends

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	Thu Nov 20 07:33:09 2008
@@ -583,17 +583,6 @@
 
   /* let's start the serial monitoring thread too, so we can have serial signaling */
 
-if(1)
-{
-    switch_thread_t *thread;
-    switch_threadattr_t *thd_attr = NULL;
-
-    switch_threadattr_create(&thd_attr, module_pool);
-    switch_threadattr_detach_set(thd_attr, 1);
-    switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-    switch_thread_create(&thread, thd_attr, skypiax_do_tcp_srv_thread, p, module_pool);
-}
-
 /*
   if (ast_pthread_create(&p->tcp_srv_thread, NULL, skypiax_do_tcp_srv_thread, p) < 0) {
     ERRORA("Unable to start tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
@@ -1836,44 +1825,67 @@
                              id);
 
               //FIXME if (p->owner) 
-              if (1) {
-                char msg_to_skype[1024];
-                if (!p->tcp_cli_thread) {
-if(1)
-{
-    switch_thread_t *thread;
-    switch_threadattr_t *thd_attr = NULL;
 
-    switch_threadattr_create(&thd_attr, module_pool);
-    switch_threadattr_detach_set(thd_attr, 1);
-    switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-    switch_thread_create(&thread, thd_attr, skypiax_do_tcp_cli_thread, p, module_pool);
-                    DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
-}
+			  if (1) {
+				  char msg_to_skype[1024];
+
+
+
+				  if (!p->tcp_srv_thread) {
+					  if(1)
+					  {
+						  switch_thread_t *thread;
+						  switch_threadattr_t *thd_attr = NULL;
+
+						  switch_threadattr_create(&thd_attr, module_pool);
+						  switch_threadattr_detach_set(thd_attr, 1);
+						  switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+						  switch_thread_create(&thread, thd_attr, skypiax_do_tcp_srv_thread, p, module_pool);
+						  DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+					  }
+				  }
+
+
+
+
+
+
+				  if (!p->tcp_cli_thread) {
+					  if(1)
+					  {
+						  switch_thread_t *thread;
+						  switch_threadattr_t *thd_attr = NULL;
+
+						  switch_threadattr_create(&thd_attr, module_pool);
+						  switch_threadattr_detach_set(thd_attr, 1);
+						  switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+						  switch_thread_create(&thread, thd_attr, skypiax_do_tcp_cli_thread, p, module_pool);
+						  DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+					  }
 
 
 #ifdef NOTDEF
-                  if (ast_pthread_create
-                      (&p->tcp_cli_thread, NULL, skypiax_do_tcp_cli_thread, p) < 0) {
-                    ERRORA("Unable to start tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
-                    if (option_debug > 100) {
-                      DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
-                    }
-                    return -1;
-                  } else {
-                    DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
-                  }
+					  if (ast_pthread_create
+							  (&p->tcp_cli_thread, NULL, skypiax_do_tcp_cli_thread, p) < 0) {
+						  ERRORA("Unable to start tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+						  if (option_debug > 100) {
+							  DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_P_LOG);
+						  }
+						  return -1;
+					  } else {
+						  DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+					  }
 #endif //NOTDEF
-                }
+				  }
 
-                usleep(100000);
-                sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"5556\"", id);
-                skypiax_skype_write(p, msg_to_skype);
-                usleep(100000);
-                sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"5558\"", id);
-                skypiax_skype_write(p, msg_to_skype);
-                usleep(100000);
-              }
+				  usleep(100000);
+				  sprintf(msg_to_skype, "ALTER CALL %s SET_OUTPUT PORT=\"5556\"", id);
+				  skypiax_skype_write(p, msg_to_skype);
+				  usleep(100000);
+				  sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"5558\"", id);
+				  skypiax_skype_write(p, msg_to_skype);
+				  usleep(100000);
+			  }
 
               p->skype_callflow = SKYPIAX_STATE_UP;
 



More information about the Freeswitch-branches mailing list