[Freeswitch-svn] [commit] r3778 - in freeswitch/trunk/src/mod/endpoints: mod_dingaling mod_iax mod_portaudio mod_wanpipe mod_woomera

Freeswitch SVN anthm at freeswitch.org
Thu Dec 21 11:46:12 EST 2006


Author: anthm
Date: Thu Dec 21 11:46:11 2006
New Revision: 3778

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
   freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
   freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
   freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c

Log:
add case for kill sigs

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Thu Dec 21 11:46:11 2006
@@ -1131,28 +1131,41 @@
 	switch_channel_t *channel = NULL;
 	struct private_object *tech_pvt = NULL;
 
-	if ((channel = switch_core_session_get_channel(session))) {
-		if ((tech_pvt = switch_core_session_get_private(session))) {
-			switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-			switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
-			switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+    if (!(channel = switch_core_session_get_channel(session))) {
+        return SWITCH_STATUS_SUCCESS;
+    }
 
-			if (tech_pvt->dlsession) {
-				if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
-					ldl_session_terminate(tech_pvt->dlsession);
-					switch_set_flag_locked(tech_pvt, TFLAG_TERM);
-				}
-				ldl_session_destroy(&tech_pvt->dlsession);
+    if (!(tech_pvt = switch_core_session_get_private(session))) {
+        return SWITCH_STATUS_SUCCESS;
+    }
+    
 
-			}
+    switch (sig) {
+    case SWITCH_SIG_KILL:
+        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+        switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+        switch_set_flag_locked(tech_pvt, TFLAG_BYE);
 
-			if (switch_rtp_ready(tech_pvt->rtp_session)) {
-				switch_rtp_kill_socket(tech_pvt->rtp_session);
-			}
+        if (tech_pvt->dlsession) {
+            if (!switch_test_flag(tech_pvt, TFLAG_TERM)) {
+                ldl_session_terminate(tech_pvt->dlsession);
+                switch_set_flag_locked(tech_pvt, TFLAG_TERM);
+            }
+            ldl_session_destroy(&tech_pvt->dlsession);
+            
+        }
 
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
-		}
-	}
+        if (switch_rtp_ready(tech_pvt->rtp_session)) {
+            switch_rtp_kill_socket(tech_pvt->rtp_session);
+        }
+        break;
+	case SWITCH_SIG_BREAK:
+		switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK);
+		break;
+    }
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
+
 
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c	Thu Dec 21 11:46:11 2006
@@ -566,11 +566,16 @@
 	tech_pvt = switch_core_session_get_private(session);
 	assert(tech_pvt != NULL);
 
-	switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-	switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
-	switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-	//switch_thread_cond_signal(tech_pvt->cond);
-
+    switch(sig) {
+    case SWITCH_SIG_KILL:
+        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+        switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+        switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+        //switch_thread_cond_signal(tech_pvt->cond);
+        break;
+    default:
+        break;
+    }
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
 
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Thu Dec 21 11:46:11 2006
@@ -273,10 +273,15 @@
 	tech_pvt = switch_core_session_get_private(session);
 	assert(tech_pvt != NULL);
 
-	switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-	deactivate_audio_device(tech_pvt);
-	switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-
+    switch (sig) {
+    case SWITCH_SIG_KILL:
+        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+        deactivate_audio_device(tech_pvt);
+        switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+        break;
+    default:
+        break;
+    }
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
 
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c	Thu Dec 21 11:46:11 2006
@@ -755,11 +755,16 @@
 	tech_pvt = switch_core_session_get_private(session);
 	assert(tech_pvt != NULL);
 
-	switch_mutex_lock(tech_pvt->flag_mutex);
-	switch_set_flag(tech_pvt, TFLAG_BYE);
-	switch_clear_flag(tech_pvt, TFLAG_MEDIA);
-	switch_mutex_unlock(tech_pvt->flag_mutex);
-
+	switch(sig) {
+	case SWITCH_SIG_KILL:
+		switch_mutex_lock(tech_pvt->flag_mutex);
+		switch_set_flag(tech_pvt, TFLAG_BYE);
+		switch_clear_flag(tech_pvt, TFLAG_MEDIA);
+		switch_mutex_unlock(tech_pvt->flag_mutex);
+		break;
+	default:
+		break;
+	}
 	//sangoma_socket_close(&tech_pvt->wpsock->fd);
 	//wp_close(tech_pvt);
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_woomera/mod_woomera.c	Thu Dec 21 11:46:11 2006
@@ -327,11 +327,19 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	udp_socket_close(tech_pvt);
-
-	switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel));
-						  
+    switch(sig) {
+    case SWITCH_SIG_KILL:
+        udp_socket_close(tech_pvt);
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s WOOMERACHAN KILL\n", switch_channel_get_name(channel));
+        break;
+    case SWITCH_SIG_BREAK:
+        {
+            int p = 0;
+            switch_size_t len = sizeof(p);
+            switch_socket_sendto(tech_pvt->udp_socket, tech_pvt->udpwrite, 0, &p, &len);
+        }
+        break;
+    }
 
 
 	return SWITCH_STATUS_SUCCESS;



More information about the Freeswitch-svn mailing list