[asterisk-commits] russell: branch group/xcon_bfcp r59392 - in /team/group/xcon_bfcp: ./ apps/ c...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Mar 29 11:44:13 MST 2007


Author: russell
Date: Thu Mar 29 13:44:12 2007
New Revision: 59392

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59392
Log:
Merged revisions 59343,59359,59362,59364,59368 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r59343 | russell | 2007-03-29 11:56:35 -0500 (Thu, 29 Mar 2007) | 16 lines

Merged revisions 59341 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r59341 | russell | 2007-03-29 11:55:39 -0500 (Thu, 29 Mar 2007) | 8 lines

When the IAX2 read callback gets called, return NULL instead of a "null frame".
This will cause Asterisk to hangup the call instead of keep trying whatever it
was doing.  Under normal conditions, this function would *never* be called.
However, the author of this patch says an error will occur that will cause it
to get called every 100 thousand calls or so.  When this does happen, it puts
the channel in a loop that eventually brings down the system.  So, hangup up
the call is certainly a better alternative.  (issue #8286, john)

........

................
r59359 | russell | 2007-03-29 12:20:43 -0500 (Thu, 29 Mar 2007) | 21 lines

Merged revisions 59358 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r59358 | russell | 2007-03-29 12:17:41 -0500 (Thu, 29 Mar 2007) | 13 lines

Merged revisions 59357 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r59357 | russell | 2007-03-29 12:14:33 -0500 (Thu, 29 Mar 2007) | 5 lines

If an error occurs when reading from an RTP socket, and the error code does not
indicate that we should try again, then return NULL instead of a "null frame".
This will prevent Asterisk from trying over and over again, and eventually
causing the system to crash.  (issue #8285, john)

........

................

................
r59362 | file | 2007-03-29 12:42:48 -0500 (Thu, 29 Mar 2007) | 18 lines

Merged revisions 59361 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r59361 | file | 2007-03-29 13:38:55 -0400 (Thu, 29 Mar 2007) | 10 lines

Merged revisions 59360 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r59360 | file | 2007-03-29 13:33:58 -0400 (Thu, 29 Mar 2007) | 2 lines

Keep a global array of variables indicating whether certain conference rooms are in use. This ensures that two people going into a new dynamic conference when the 'e' option is set don't go into the same conference room. (issue #8835 reported by eliel)

........

................

................
r59364 | russell | 2007-03-29 12:44:45 -0500 (Thu, 29 Mar 2007) | 14 lines

Merged revisions 59363 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r59363 | russell | 2007-03-29 12:43:52 -0500 (Thu, 29 Mar 2007) | 6 lines

When building a response to a subscription, the "from" must be the full Jabber
ID.  This fixes some problems where jabber users are not able to add their
Asterisk account to their user list, since they are unable to get Asterisk
to approve their subscription.  (issue #8210, reported by caspy, and verified
by bradtem)

........

................
r59368 | russell | 2007-03-29 13:31:35 -0500 (Thu, 29 Mar 2007) | 4 lines

Fix an issue with hashing iax2 pvt structures that caused random crashes on
systems under heavy load such as IAXtel.
(possibly related to issue #9403)

................

Modified:
    team/group/xcon_bfcp/   (props changed)
    team/group/xcon_bfcp/apps/app_meetme.c
    team/group/xcon_bfcp/channels/chan_iax2.c
    team/group/xcon_bfcp/main/rtp.c
    team/group/xcon_bfcp/res/res_jabber.c

Propchange: team/group/xcon_bfcp/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/group/xcon_bfcp/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/xcon_bfcp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Mar 29 13:44:12 2007
@@ -1,1 +1,1 @@
-/trunk:1-59317
+/trunk:1-59383

Modified: team/group/xcon_bfcp/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/xcon_bfcp/apps/app_meetme.c?view=diff&rev=59392&r1=59391&r2=59392
==============================================================================
--- team/group/xcon_bfcp/apps/app_meetme.c (original)
+++ team/group/xcon_bfcp/apps/app_meetme.c Thu Mar 29 13:44:12 2007
@@ -393,6 +393,8 @@
 
 static AST_LIST_HEAD_STATIC(confs, ast_conference);
 
+static unsigned int conf_map[1024] = {0, };
+
 struct volume {
 	int desired;                            /*!< Desired volume adjustment */
 	int actual;                             /*!< Actual volume adjustment (for channels that can't adjust) */
@@ -905,6 +907,7 @@
 {
 	struct ast_conference *cnf;
 	struct zt_confinfo ztc = { 0, };
+	int confno_int = 0;
 
 	AST_LIST_LOCK(&confs);
 
@@ -1073,7 +1076,11 @@
 		AST_LIST_INSERT_HEAD(&confs, cnf, list);
 	}
 
- cnfout:
+cnfout:
+	/* Reserve conference number in map */
+	if ((sscanf(cnf->confno, "%d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
+		conf_map[confno_int] = 1;
+	
 	if (cnf)
 		ast_atomic_fetchadd_int(&cnf->refcount, refcount);
 
@@ -2325,9 +2332,13 @@
 static int dispose_conf(struct ast_conference *conf)
 {
 	int res = 0;
+	int confno_int = 0;
 
 	AST_LIST_LOCK(&confs);
 	if (ast_atomic_dec_and_test(&conf->refcount)) {
+		/* Take the conference room number out of an inuse state */
+		if ((sscanf(conf->confno, "%d", &confno_int) == 1) && (confno_int >= 0 && confno_int < 1024))
+			conf_map[confno_int] = 0;
 		conf_free(conf);
 		res = 1;
 	}
@@ -3794,20 +3805,10 @@
 		if (retrycnt > 3)
 			allowretry = 0;
 		if (empty) {
-			int i, map[1024] = { 0, };
+			int i;
 			struct ast_config *cfg;
 			struct ast_variable *var;
 			int confno_int;
-
-			AST_LIST_LOCK(&confs);
-			AST_LIST_TRAVERSE(&confs, cnf, list) {
-				if (sscanf(cnf->confno, "%d", &confno_int) == 1) {
-					/* Disqualify in use conference */
-					if (confno_int >= 0 && confno_int < 1024)
-						map[confno_int]++;
-				}
-			}
-			AST_LIST_UNLOCK(&confs);
 
 			/*! TODO: different handling of new conferences when local/remote */
 			/* We only need to load the config file for static and empty_no_pin (otherwise we don't care) */
@@ -3826,13 +3827,6 @@
 							if (stringp) {
 								char *confno_tmp = strsep(&stringp, "|,");
 								int found = 0;
-								if (sscanf(confno_tmp, "%d", &confno_int) == 1) {
-									if ((confno_int >= 0) && (confno_int < 1024)) {
-										if (stringp && empty_no_pin) {
-											map[confno_int]++;
-										}
-									}
-								}
 								if (!dynamic) {
 									/* For static:  run through the list and see if this conference is empty */
 									AST_LIST_LOCK(&confs);
@@ -3867,12 +3861,15 @@
 
 			/* Select first conference number not in use */
 			if (ast_strlen_zero(confno) && dynamic) {
-				for (i = 0; i < sizeof(map) / sizeof(map[0]); i++) {
-					if (!map[i]) {
+				AST_LIST_LOCK(&confs);
+				for (i = 0; i < sizeof(conf_map) / sizeof(conf_map[0]); i++) {
+					if (!conf_map[i]) {
 						snprintf(confno, sizeof(confno), "%d", i);
+						conf_map[i] = 1;
 						break;
 					}
 				}
+				AST_LIST_UNLOCK(&confs);
 			}
 			if(dcon)	/* We use 'dynamic' only to avoid checking the conf file */
 				dynamic = 0;

Modified: team/group/xcon_bfcp/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/xcon_bfcp/channels/chan_iax2.c?view=diff&rev=59392&r1=59391&r2=59392
==============================================================================
--- team/group/xcon_bfcp/channels/chan_iax2.c (original)
+++ team/group/xcon_bfcp/channels/chan_iax2.c Thu Mar 29 13:44:12 2007
@@ -473,6 +473,8 @@
 	int dropped;
 	int ooo;
 };
+
+struct iax2_pvt_ref;
 
 struct chan_iax2_pvt {
 	/*! Socket to send/receive on for this call */
@@ -632,14 +634,19 @@
 	int frames_dropped;
 	/*! received frame count: (just for stats) */
 	int frames_received;
-
-	AST_LIST_ENTRY(chan_iax2_pvt) entry;
+	struct iax2_pvt_ref *hash_ref;
 	unsigned short hash;
 };
 
+struct iax2_pvt_ref {
+	struct chan_iax2_pvt *pvt;
+	unsigned int callno;
+	AST_LIST_ENTRY(iax2_pvt_ref) entry;
+};
+
 /* Somewhat arbitrary prime number */
-#define PVT_HASH_SIZE 563
-static AST_RWLIST_HEAD(pvt_list, chan_iax2_pvt) pvt_hash_tbl[PVT_HASH_SIZE];
+#define PVT_HASH_SIZE 3373
+static AST_RWLIST_HEAD(pvt_list, iax2_pvt_ref) pvt_hash_tbl[PVT_HASH_SIZE];
 
 static AST_LIST_HEAD_STATIC(queue, iax_frame);
 
@@ -1274,16 +1281,21 @@
 
 static inline void hash_on_peer(struct chan_iax2_pvt *pvt)
 {
-	if (pvt->hash) {
+	if (pvt->hash_ref) {
 		AST_RWLIST_WRLOCK(&pvt_hash_tbl[pvt->hash]);
-		AST_RWLIST_REMOVE(&pvt_hash_tbl[pvt->hash], pvt, entry);
+		AST_RWLIST_REMOVE(&pvt_hash_tbl[pvt->hash], pvt->hash_ref, entry);
 		AST_RWLIST_UNLOCK(&pvt_hash_tbl[pvt->hash]);	
+	} else {
+		if (!(pvt->hash_ref = ast_calloc(1, sizeof(pvt->hash_ref))))
+			return;
+		pvt->hash_ref->pvt = pvt;
 	}
 
 	pvt->hash = peer_hash_val(&pvt->addr, pvt->peercallno);
+	pvt->hash_ref->callno = pvt->callno;
 
 	AST_RWLIST_WRLOCK(&pvt_hash_tbl[pvt->hash]);
-	AST_RWLIST_INSERT_HEAD(&pvt_hash_tbl[pvt->hash], pvt, entry);
+	AST_RWLIST_INSERT_HEAD(&pvt_hash_tbl[pvt->hash], pvt->hash_ref, entry);
 	AST_RWLIST_UNLOCK(&pvt_hash_tbl[pvt->hash]);
 }
 
@@ -1295,13 +1307,13 @@
 	char host[80];
 	if (new <= NEW_ALLOW) {
 		unsigned short hash = peer_hash_val(sin, callno);
-		const struct chan_iax2_pvt *pvt;
-		AST_RWLIST_RDLOCK(&pvt_hash_tbl[hash]);
-		AST_RWLIST_TRAVERSE(&pvt_hash_tbl[hash], pvt, entry) {
-			ast_mutex_lock(&iaxsl[pvt->callno]);
-			if (match(sin, callno, dcallno, pvt))
-				res = pvt->callno;
-			ast_mutex_unlock(&iaxsl[pvt->callno]);
+		struct iax2_pvt_ref *pvt_ref;
+		AST_RWLIST_WRLOCK(&pvt_hash_tbl[hash]);
+		AST_RWLIST_TRAVERSE(&pvt_hash_tbl[hash], pvt_ref, entry) {
+			ast_mutex_lock(&iaxsl[pvt_ref->callno]);
+			if (match(sin, callno, dcallno, pvt_ref->pvt))
+				res = pvt_ref->callno;
+			ast_mutex_unlock(&iaxsl[pvt_ref->callno]);
 			if (res > 0)
 				break;
  		}
@@ -1844,10 +1856,11 @@
 			pvt->owner = NULL;
 		iax2_destroy_helper(pvt);
 
-		if (pvt->hash) {
+		if (pvt->hash_ref) {
 			AST_RWLIST_WRLOCK(&pvt_hash_tbl[pvt->hash]);
-			AST_RWLIST_REMOVE(&pvt_hash_tbl[pvt->hash], pvt, entry);
+			AST_RWLIST_REMOVE(&pvt_hash_tbl[pvt->hash], pvt->hash_ref, entry);
 			AST_RWLIST_UNLOCK(&pvt_hash_tbl[pvt->hash]);
+			free(pvt->hash_ref);
 		}
 
 		/* Already gone */
@@ -3125,8 +3138,8 @@
 
 static struct ast_frame *iax2_read(struct ast_channel *c) 
 {
-	ast_log(LOG_NOTICE, "I should never be called!\n");
-	return &ast_null_frame;
+	ast_log(LOG_NOTICE, "I should never be called! Hanging up.\n");
+	return NULL;
 }
 
 static int iax2_start_transfer(unsigned short callno0, unsigned short callno1, int mediaonly)

Modified: team/group/xcon_bfcp/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/group/xcon_bfcp/main/rtp.c?view=diff&rev=59392&r1=59391&r2=59392
==============================================================================
--- team/group/xcon_bfcp/main/rtp.c (original)
+++ team/group/xcon_bfcp/main/rtp.c Thu Mar 29 13:44:12 2007
@@ -920,10 +920,12 @@
 	rtcpheader = (unsigned int *)(rtcpdata + AST_FRIENDLY_OFFSET);
 	
 	if (res < 0) {
-		if (errno != EAGAIN)
-			ast_log(LOG_WARNING, "RTCP Read error: %s\n", strerror(errno));
 		if (errno == EBADF)
 			CRASH;
+		if (errno != EAGAIN) {
+			ast_log(LOG_WARNING, "RTCP Read error: %s.  Hanging up.\n", strerror(errno));
+			return NULL;
+		}
 		return &ast_null_frame;
 	}
 
@@ -1176,10 +1178,12 @@
 
 	rtpheader = (unsigned int *)(rtp->rawdata + AST_FRIENDLY_OFFSET);
 	if (res < 0) {
-		if (errno != EAGAIN)
-			ast_log(LOG_WARNING, "RTP Read error: %s\n", strerror(errno));
 		if (errno == EBADF)
 			CRASH;
+		if (errno != EAGAIN) {
+			ast_log(LOG_WARNING, "RTP Read error: %s.  Hanging up.\n", strerror(errno));
+			return NULL;
+		}
 		return &ast_null_frame;
 	}
 	

Modified: team/group/xcon_bfcp/res/res_jabber.c
URL: http://svn.digium.com/view/asterisk/team/group/xcon_bfcp/res/res_jabber.c?view=diff&rev=59392&r1=59391&r2=59392
==============================================================================
--- team/group/xcon_bfcp/res/res_jabber.c (original)
+++ team/group/xcon_bfcp/res/res_jabber.c Thu Mar 29 13:44:12 2007
@@ -1328,7 +1328,7 @@
 		if(presence && status) {
 			iks_insert_attrib(presence, "type", "subscribed");
 			iks_insert_attrib(presence, "to", pak->from->full);
-			iks_insert_attrib(presence, "from", iks_find_attrib(pak->x, "to"));
+			iks_insert_attrib(presence, "from", client->jid->full);
 			if(pak->id)
 				iks_insert_attrib(presence, "id", pak->id);
 			iks_insert_cdata(status, "Asterisk has approved subscription", 0);



More information about the asterisk-commits mailing list