[asterisk-addons-commits] dcb: trunk r447 - /trunk/chan_mobile.c

SVN commits to the Asterisk addons project asterisk-addons-commits at lists.digium.com
Sat Sep 8 19:28:42 CDT 2007


Author: dcb
Date: Sat Sep  8 19:28:41 2007
New Revision: 447

URL: http://svn.digium.com/view/asterisk-addons?view=rev&rev=447
Log:
* Fix module unloading - close bound socket left open.
* Modify call hangup procedures to cater for embedded and low grunt processors (via's etc).

Modified:
    trunk/chan_mobile.c

Modified: trunk/chan_mobile.c
URL: http://svn.digium.com/view/asterisk-addons/trunk/chan_mobile.c?view=diff&rev=447&r1=446&r2=447
==============================================================================
--- trunk/chan_mobile.c (original)
+++ trunk/chan_mobile.c Sat Sep  8 19:28:41 2007
@@ -207,8 +207,6 @@
 "  Dest - destination\n"
 "  Message - text of the message\n";
 
-/* Manager stuff */
-
 static struct ast_channel *mbl_new(int state, struct mbl_pvt *pvt, char *cid_num);
 static struct ast_channel *mbl_request(const char *type, int format, void *data, int *cause);
 static int mbl_call(struct ast_channel *ast, char *dest, int timeout);
@@ -755,6 +753,9 @@
 		return 0;
 	}
 	if (ast->_state != AST_STATE_UP) {
+		return 0;
+	}
+	if (pvt->state == MBL_STATE_HANGUP) {
 		return 0;
 	}
 
@@ -1386,6 +1387,8 @@
 				break;
 			case MBL_STATE_HANGUP:
 				if (strstr(buf, "OK") || strstr(buf, pvt->ciev_call_0)) {
+					close(pvt->sco_socket);
+					pvt->sco_socket = -1;
 					pvt->state = MBL_STATE_IDLE;
 				}
 				break;
@@ -1902,8 +1905,15 @@
 			pthread_cancel(pvt->monitor_thread);
 			pthread_join(pvt->monitor_thread, NULL);
 		}
+		if (pvt->sco_listener_thread != AST_PTHREADT_NULL) {
+			pthread_cancel(pvt->sco_listener_thread);
+			pthread_join(pvt->sco_listener_thread, NULL);
+		}
 		if (pvt->sco_socket > -1) {
 			close(pvt->sco_socket);
+		}
+		if (pvt->adapter->sco_socket > -1) {
+			close(pvt->adapter->sco_socket);
 		}
 		if (pvt->rfcomm_socket > -1) {
 			close(pvt->rfcomm_socket);




More information about the asterisk-addons-commits mailing list