[asterisk-commits] file: branch group/multiparking r114170 - in /team/group/multiparking: ./ app...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 16 09:27:04 CDT 2008


Author: file
Date: Wed Apr 16 09:27:03 2008
New Revision: 114170

URL: http://svn.digium.com/view/asterisk?view=rev&rev=114170
Log:
Let's bring this up to date.

Modified:
    team/group/multiparking/   (props changed)
    team/group/multiparking/CHANGES
    team/group/multiparking/apps/app_chanspy.c
    team/group/multiparking/apps/app_dial.c
    team/group/multiparking/apps/app_directory.c
    team/group/multiparking/apps/app_meetme.c
    team/group/multiparking/apps/app_queue.c
    team/group/multiparking/apps/app_voicemail.c
    team/group/multiparking/cdr/cdr_pgsql.c
    team/group/multiparking/channels/chan_h323.c
    team/group/multiparking/channels/chan_iax2.c
    team/group/multiparking/channels/chan_local.c
    team/group/multiparking/channels/chan_sip.c
    team/group/multiparking/channels/chan_skinny.c
    team/group/multiparking/channels/chan_unistim.c
    team/group/multiparking/channels/chan_zap.c
    team/group/multiparking/configs/res_ldap.conf.sample
    team/group/multiparking/contrib/scripts/astcli
    team/group/multiparking/contrib/scripts/autosupport
    team/group/multiparking/include/asterisk/lock.h
    team/group/multiparking/main/channel.c
    team/group/multiparking/main/features.c
    team/group/multiparking/main/file.c
    team/group/multiparking/main/manager.c
    team/group/multiparking/main/pbx.c
    team/group/multiparking/main/rtp.c
    team/group/multiparking/main/utils.c
    team/group/multiparking/phoneprov/polycom_line.xml
    team/group/multiparking/res/res_config_ldap.c
    team/group/multiparking/res/res_phoneprov.c
    team/group/multiparking/utils/Makefile
    team/group/multiparking/utils/ael_main.c
    team/group/multiparking/utils/astman.c
    team/group/multiparking/utils/check_expr.c
    team/group/multiparking/utils/conf2ael.c
    team/group/multiparking/utils/hashtest.c
    team/group/multiparking/utils/hashtest2.c

Propchange: team/group/multiparking/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

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

Propchange: team/group/multiparking/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 16 09:27:03 2008
@@ -1,1 +1,1 @@
-/trunk:1-113988
+/trunk:1-114169

Modified: team/group/multiparking/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/CHANGES?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/CHANGES (original)
+++ team/group/multiparking/CHANGES Wed Apr 16 09:27:03 2008
@@ -257,6 +257,9 @@
      SIP call to Voicemail by putting a Local channel in the middle.  This
      feature is enabled by using the 'j' option in the Dial string to the Local
      channel in conjunction with the existing 'n' option for local channels.
+  * A 'b' option has been added which causes chan_local to return the actual channel
+     that is behind it when queried. This is useful for transfer scenarios as the
+     actual channel will be transferred, not the Local channel.
 
 Zaptel channel driver (chan_zap) Changes
 ----------------------------------------

Modified: team/group/multiparking/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_chanspy.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/apps/app_chanspy.c (original)
+++ team/group/multiparking/apps/app_chanspy.c Wed Apr 16 09:27:03 2008
@@ -77,6 +77,8 @@
 "    r[(basename)] - Record the session to the monitor spool directory. An\n"
 "                    optional base for the filename may be specified. The\n"
 "                    default is 'chanspy'.\n"
+"    s             - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
+"                    speaking the selected channel name.\n"
 "    v([value])    - Adjust the initial volume in the range from -4 to 4. A\n"
 "                    negative value refers to a quieter setting.\n"
 "    w             - Enable 'whisper' mode, so the spying channel can talk to\n"
@@ -117,6 +119,8 @@
 "    r[(basename)] - Record the session to the monitor spool directory. An\n"
 "                    optional base for the filename may be specified. The\n"
 "                    default is 'chanspy'.\n"
+"    s             - Skip the playback of the channel type (i.e. SIP, IAX, etc) when\n"
+"                    speaking the selected channel name.\n"
 "    v([value])    - Adjust the initial volume in the range from -4 to 4. A\n"
 "                    negative value refers to a quieter setting.\n"
 "    w             - Enable 'whisper' mode, so the spying channel can talk to\n"
@@ -143,6 +147,7 @@
 	OPTION_READONLY  = (1 << 7),    /* Don't mix the two channels */
 	OPTION_EXIT      = (1 << 8),    /* Exit to a valid single digit extension */
 	OPTION_ENFORCED  = (1 << 9),    /* Enforced mode */
+	OPTION_NOTECH    = (1 << 10),   /* Skip technology name playback */
 } chanspy_opt_flags;
 
 enum {
@@ -164,6 +169,7 @@
 	AST_APP_OPTION_ARG('e', OPTION_ENFORCED, OPT_ARG_ENFORCED),
 	AST_APP_OPTION('o', OPTION_READONLY),
 	AST_APP_OPTION('X', OPTION_EXIT),
+	AST_APP_OPTION('s', OPTION_NOTECH),
 });
 
 
@@ -496,30 +502,29 @@
 	const struct ast_channel *last, const char *spec,
 	const char *exten, const char *context, struct chanspy_ds *chanspy_ds)
 {
-	struct ast_channel *this;
+	struct ast_channel *next;
 
 redo:
 	if (!ast_strlen_zero(spec))
-		this = ast_walk_channel_by_name_prefix_locked(last, spec, strlen(spec));
-
+		next = ast_walk_channel_by_name_prefix_locked(last, spec, strlen(spec));
 	else if (!ast_strlen_zero(exten))
-		this = ast_walk_channel_by_exten_locked(last, exten, context);
+		next = ast_walk_channel_by_exten_locked(last, exten, context);
 	else
-		this = ast_channel_walk_locked(last);
-
-	if (!this)
+		next = ast_channel_walk_locked(last);
+
+	if (!next)
 		return NULL;
 
-	if (!strncmp(this->name, "Zap/pseudo", 10)) {
-		ast_channel_unlock(this);
+	if (!strncmp(next->name, "Zap/pseudo", 10)) {
+		ast_channel_unlock(next);
 		goto redo;
-	} else if (this == chan) {
-		last = this;
-		ast_channel_unlock(this);
+	} else if (next == chan) {
+		last = next;
+		ast_channel_unlock(next);
 		goto redo;
 	}
 
-	return setup_chanspy_ds(this, chanspy_ds);
+	return setup_chanspy_ds(next, chanspy_ds);
 }
 
 static int common_exec(struct ast_channel *chan, const struct ast_flags *flags,
@@ -709,16 +714,20 @@
 			peer = NULL;
 
 			if (!ast_test_flag(flags, OPTION_QUIET)) {
-				if (ast_fileexists(peer_name, NULL, NULL) != -1) {
-					res = ast_streamfile(chan, peer_name, chan->language);
-					if (!res)
-						res = ast_waitstream(chan, "");
-					if (res) {
-						chanspy_ds_free(peer_chanspy_ds);
-						break;
+				if (!ast_test_flag(flags, OPTION_NOTECH)) {
+					if (ast_fileexists(peer_name, NULL, NULL) != -1) {
+						res = ast_streamfile(chan, peer_name, chan->language);
+						if (!res) {
+							res = ast_waitstream(chan, "");
+						}
+						if (res) {
+							chanspy_ds_free(peer_chanspy_ds);
+							break;
+						}
+					} else {
+						res = ast_say_character_str(chan, peer_name, "", chan->language);
 					}
-				} else
-					res = ast_say_character_str(chan, peer_name, "", chan->language);
+				}
 				if ((num = atoi(ptr)))
 					ast_say_digits(chan, atoi(ptr), "", chan->language);
 			}

Modified: team/group/multiparking/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_dial.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/apps/app_dial.c (original)
+++ team/group/multiparking/apps/app_dial.c Wed Apr 16 09:27:03 2008
@@ -1600,8 +1600,14 @@
 	time(&start_time);
 	peer = wait_for_answer(chan, outgoing, &to, peerflags, &pa, &num, &result);
 
-	ast_channel_datastore_remove(chan, datastore);
-	ast_channel_datastore_free(datastore);
+	/* The ast_channel_datastore_remove() function could fail here if the
+	 * datastore was moved to another channel during a masquerade. If this is
+	 * the case, don't free the datastore here because later, when the channel
+	 * to which the datastore was moved hangs up, it will attempt to free this
+	 * datastore again, causing a crash
+	 */
+	if (!ast_channel_datastore_remove(chan, datastore))
+		ast_channel_datastore_free(datastore);
 	if (!peer) {
 		if (result) {
 			res = result;

Modified: team/group/multiparking/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_directory.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/apps/app_directory.c (original)
+++ team/group/multiparking/apps/app_directory.c Wed Apr 16 09:27:03 2008
@@ -858,14 +858,23 @@
 		if (!ast_strlen_zero(dirintro) && !res) {
 			res = ast_stream_and_wait(chan, dirintro, AST_DIGIT_ANY);
 		} else if (!res) {
-			res = ast_stream_and_wait(chan, "dir-welcome", AST_DIGIT_ANY) ||
-				ast_stream_and_wait(chan, "dir-pls-enter", AST_DIGIT_ANY) ||
-				ast_stream_and_wait(chan, digits, AST_DIGIT_ANY) ||
-				ast_stream_and_wait(chan, 
+			/* Stop playing sounds as soon as we have a digit. */
+			res = ast_stream_and_wait(chan, "dir-welcome", AST_DIGIT_ANY);
+			if (!res) {
+				res = ast_stream_and_wait(chan, "dir-pls-enter", AST_DIGIT_ANY);
+			}
+			if (!res) {
+				res = ast_stream_and_wait(chan, digits, AST_DIGIT_ANY);
+			}
+			if (!res) {
+				res = ast_stream_and_wait(chan, 
 					which == FIRST ? "dir-first" :
 					which == LAST ? "dir-last" :
-					"dir-firstlast", AST_DIGIT_ANY) ||
+					"dir-firstlast", AST_DIGIT_ANY);
+			}
+			if (!res) {
 				ast_stream_and_wait(chan, "dir-usingkeypad", AST_DIGIT_ANY);
+			}
 		}
 		ast_stopstream(chan);
 		if (!res)

Modified: team/group/multiparking/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_meetme.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/apps/app_meetme.c (original)
+++ team/group/multiparking/apps/app_meetme.c Wed Apr 16 09:27:03 2008
@@ -1694,8 +1694,17 @@
 	ast_mutex_unlock(&conf->playlock);
 
 	if (!(confflags & CONFFLAG_QUIET) && ((confflags & CONFFLAG_INTROUSER) || (confflags & CONFFLAG_INTROUSERNOREVIEW))) {
+		char destdir[PATH_MAX];
+
+		snprintf(destdir, sizeof(destdir), "%s/meetme", ast_config_AST_SPOOL_DIR);
+
+		if (ast_mkdir(destdir, 0777) != 0) {
+			ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", destdir, strerror(errno));
+			goto outrun;
+		}
+
 		snprintf(user->namerecloc, sizeof(user->namerecloc),
-			 "%s/meetme/meetme-username-%s-%d", ast_config_AST_SPOOL_DIR,
+			 "%s/meetme-username-%s-%d", destdir,
 			 conf->confno, user->user_no);
 		if (confflags & CONFFLAG_INTROUSERNOREVIEW)
 			res = ast_play_and_record(chan, "vm-rec-name", user->namerecloc, 10, "sln", &duration, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE), 0, NULL);

Modified: team/group/multiparking/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_queue.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/apps/app_queue.c (original)
+++ team/group/multiparking/apps/app_queue.c Wed Apr 16 09:27:03 2008
@@ -939,7 +939,6 @@
 	q->monfmt[0] = '\0';
 	q->reportholdtime = 0;
 	q->wrapuptime = 0;
-	q->autofill = 0;
 	q->joinempty = 0;
 	q->leavewhenempty = 0;
 	q->memberdelay = 0;
@@ -1532,7 +1531,11 @@
 				*tmp++ = '-';
 		} else
 			tmp_name = v->name;
-		queue_set_param(q, tmp_name, v->value, -1, 0);
+
+		if (!ast_strlen_zero(v->value)) {
+			/* Don't want to try to set the option if the value is empty */
+			queue_set_param(q, tmp_name, v->value, -1, 0);
+		}
 	}
 
 	/* Temporarily set realtime members dead so we can detect deleted ones. 
@@ -3252,8 +3255,13 @@
 	if (use_weight)
 		ao2_unlock(queues);
 	lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed);
-	if (datastore) {
-		ast_channel_datastore_remove(qe->chan, datastore);
+	/* The ast_channel_datastore_remove() function could fail here if the
+	 * datastore was moved to another channel during a masquerade. If this is
+	 * the case, don't free the datastore here because later, when the channel
+	 * to which the datastore was moved hangs up, it will attempt to free this
+	 * datastore again, causing a crash
+	 */
+	if (datastore && !ast_channel_datastore_remove(qe->chan, datastore)) {
 		ast_channel_datastore_free(datastore);
 	}
 	ao2_lock(qe->parent);

Modified: team/group/multiparking/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/apps/app_voicemail.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/apps/app_voicemail.c (original)
+++ team/group/multiparking/apps/app_voicemail.c Wed Apr 16 09:27:03 2008
@@ -6636,7 +6636,7 @@
 			res = say_and_wait(chan, dcnum, chan->language);
 		if (!res && lastnum) {
 			if (lastnum == 1) 
-				res = ast_play_and_wait(chan, "digits/ru/odno");
+				res = ast_play_and_wait(chan, "digits/odno");
 			else
 				res = say_and_wait(chan, lastnum, chan->language);
 		}
@@ -6655,7 +6655,7 @@
 			res = say_and_wait(chan, dcnum, chan->language);
 		if (!res && lastnum) {
 			if (lastnum == 1) 
-				res = ast_play_and_wait(chan, "digits/ru/odno");
+				res = ast_play_and_wait(chan, "digits/odno");
 			else
 				res = say_and_wait(chan, lastnum, chan->language);
 		}

Modified: team/group/multiparking/cdr/cdr_pgsql.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/cdr/cdr_pgsql.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/cdr/cdr_pgsql.c (original)
+++ team/group/multiparking/cdr/cdr_pgsql.c Wed Apr 16 09:27:03 2008
@@ -66,6 +66,8 @@
 	char *name;
 	char *type;
 	int len;
+	unsigned int notnull:1;
+	unsigned int hasdefault:1;
 	AST_RWLIST_ENTRY(columns) list;
 };
 
@@ -138,8 +140,17 @@
 		AST_RWLIST_TRAVERSE(&psql_columns, cur, list) {
 			/* For fields not set, simply skip them */
 			ast_cdr_getvar(cdr, cur->name, &value, buf, sizeof(buf), 0, 0);
-			if (!value)
+			if (!value) {
+				if (cur->notnull && !cur->hasdefault) {
+					/* Field is NOT NULL (but no default), must include it anyway */
+					LENGTHEN_BUF1(strlen(cur->name));
+					lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", cur->name);
+					LENGTHEN_BUF2(3);
+					strcat(sql2, "'',");
+					lensql2 += 3;
+				}
 				continue;
+			}
 			
 			LENGTHEN_BUF1(strlen(cur->name));
 			lensql += snprintf(sql + lensql, sizesql - lensql, "%s,", cur->name);
@@ -444,14 +455,14 @@
 
 	conn = PQsetdbLogin(pghostname, pgdbport, NULL, NULL, pgdbname, pgdbuser, pgpassword);
 	if (PQstatus(conn) != CONNECTION_BAD) {
-		char sqlcmd[256];
-		char *fname, *ftype, *flen;
+		char sqlcmd[512];
+		char *fname, *ftype, *flen, *fnotnull, *fdef;
 		int i, rows;
 		ast_debug(1, "Successfully connected to PostgreSQL database.\n");
 		connected = 1;
 
 		/* Query the columns */
-		snprintf(sqlcmd, sizeof(sqlcmd), "select a.attname, t.typname, a.attlen from pg_class c, pg_attribute a, pg_type t where c.oid = a.attrelid and a.atttypid = t.oid and (a.attnum > 0) and c.relname = '%s' order by c.relname, attnum", table);
+		snprintf(sqlcmd, sizeof(sqlcmd), "select a.attname, t.typname, a.attlen, a.attnotnull, d.adsrc from pg_class c, pg_type t, pg_attribute a left outer join pg_attrdef d on a.atthasdef and d.adrelid = a.attrelid and d.adnum = a.attnum where c.oid = a.attrelid and a.atttypid = t.oid and (a.attnum > 0) and c.relname = '%s' order by c.relname, attnum", table);
 		result = PQexec(conn, sqlcmd);
 		if (PQresultStatus(result) != PGRES_TUPLES_OK) {
 			pgerror = PQresultErrorMessage(result);
@@ -466,6 +477,8 @@
 			fname = PQgetvalue(result, i, 0);
 			ftype = PQgetvalue(result, i, 1);
 			flen = PQgetvalue(result, i, 2);
+			fnotnull = PQgetvalue(result, i, 3);
+			fdef = PQgetvalue(result, i, 4);
 			ast_verb(4, "Found column '%s' of type '%s'\n", fname, ftype);
 			cur = ast_calloc(1, sizeof(*cur) + strlen(fname) + strlen(ftype) + 2);
 			if (cur) {
@@ -474,6 +487,16 @@
 				cur->type = (char *)cur + sizeof(*cur) + strlen(fname) + 1;
 				strcpy(cur->name, fname);
 				strcpy(cur->type, ftype);
+				if (*fnotnull == 't') {
+					cur->notnull = 1;
+				} else {
+					cur->notnull = 0;
+				}
+				if (!ast_strlen_zero(fdef)) {
+					cur->hasdefault = 1;
+				} else {
+					cur->hasdefault = 0;
+				}
 				AST_RWLIST_INSERT_TAIL(&psql_columns, cur, list);
 			}
 		}

Modified: team/group/multiparking/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/channels/chan_h323.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/channels/chan_h323.c (original)
+++ team/group/multiparking/channels/chan_h323.c Wed Apr 16 09:27:03 2008
@@ -1148,7 +1148,7 @@
 	while(pvt) {
 		if (!pvt->needdestroy && ((signed int)pvt->cd.call_reference == call_reference)) {
 			/* Found the call */
-			if ((token != NULL) && (!strcmp(pvt->cd.call_token, token))) {
+			if ((token != NULL) && (pvt->cd.call_token != NULL) && (!strcmp(pvt->cd.call_token, token))) {
 				ast_mutex_lock(&pvt->lock);
 				ast_mutex_unlock(&iflock);
 				return pvt;

Modified: team/group/multiparking/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/channels/chan_iax2.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/channels/chan_iax2.c (original)
+++ team/group/multiparking/channels/chan_iax2.c Wed Apr 16 09:27:03 2008
@@ -1491,7 +1491,7 @@
  *
  * \note Calling this function while holding another pvt lock can cause a deadlock.
  */
-static int find_callno(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int new, int sockfd)
+static int __find_callno(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int new, int sockfd, int return_locked)
 {
 	int res = 0;
 	int x;
@@ -1568,10 +1568,21 @@
 			ast_mutex_unlock(&iaxsl[x]);
 			return 0;
 		}
-		ast_mutex_unlock(&iaxsl[x]);
+		if (!return_locked)
+			ast_mutex_unlock(&iaxsl[x]);
 		res = x;
 	}
 	return res;
+}
+
+static int find_callno(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int new, int sockfd) {
+
+	return __find_callno(callno, dcallno, sin, new, sockfd, 0);
+}
+
+static int find_callno_locked(unsigned short callno, unsigned short dcallno, struct sockaddr_in *sin, int new, int sockfd) {
+
+	return __find_callno(callno, dcallno, sin, new, sockfd, 1);
 }
 
 static void iax2_frame_free(struct iax_frame *fr)
@@ -3897,6 +3908,13 @@
 	ast_mutex_unlock(&iaxsl[callno]);
 	tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "IAX2/%s-%d", i->host, i->callno);
 	ast_mutex_lock(&iaxsl[callno]);
+	if (!iaxs[callno]) {
+		if (tmp) {
+			ast_channel_free(tmp);
+		}
+		ast_mutex_unlock(&iaxsl[callno]);
+		return NULL;
+	}
 	iax2_ami_channelupdate(i);
 	if (!tmp)
 		return NULL;
@@ -7602,11 +7620,9 @@
 		/* Stop if we don't have enough data */
 		if (len > packet_len)
 			break;
-		fr->callno = find_callno(callno & ~IAX_FLAG_FULL, 0, sin, NEW_PREVENT, sockfd);
+		fr->callno = find_callno_locked(callno & ~IAX_FLAG_FULL, 0, sin, NEW_PREVENT, sockfd);
 		if (!fr->callno)
 			continue;
-
-		ast_mutex_lock(&iaxsl[fr->callno]);
 
 		/* If it's a valid call, deliver the contents.  If not, we
 		   drop it, since we don't have a scallno to use for an INVAL */
@@ -7986,7 +8002,9 @@
 					if (call_to_destroy) {
 						if (iaxdebug)
 							ast_debug(1, "Really destroying %d, having been acked on final message\n", call_to_destroy);
+						ast_mutex_lock(&iaxsl[call_to_destroy]);
 						iax2_destroy(call_to_destroy);
+						ast_mutex_unlock(&iaxsl[call_to_destroy]);
 					}
 				}
 				/* Note how much we've received acknowledgement for */
@@ -9402,13 +9420,14 @@
 
 	if (!reg->callno) {
 		ast_debug(1, "Allocate call number\n");
-		reg->callno = find_callno(0, 0, &reg->addr, NEW_FORCE, defaultsockfd);
+		reg->callno = find_callno_locked(0, 0, &reg->addr, NEW_FORCE, defaultsockfd);
 		if (reg->callno < 1) {
 			ast_log(LOG_WARNING, "Unable to create call for registration\n");
 			return -1;
 		} else
 			ast_debug(1, "Registration created on call %d\n", reg->callno);
 		iaxs[reg->callno]->reg = reg;
+		ast_mutex_unlock(&iaxsl[reg->callno]);
 	}
 	/* Setup the next registration a little early */
 	reg->expire = iax2_sched_replace(reg->expire, sched, 
@@ -9452,11 +9471,10 @@
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_raw(&ied, IAX_IE_PROVISIONING, provdata.buf, provdata.pos);
 
-	callno = find_callno(0, 0, &sin, NEW_FORCE, cai.sockfd);
+	callno = find_callno_locked(0, 0, &sin, NEW_FORCE, cai.sockfd);
 	if (!callno)
 		return -1;
 
-	ast_mutex_lock(&iaxsl[callno]);
 	if (iaxs[callno]) {
 		/* Schedule autodestruct in case they don't ever give us anything back */
 		iaxs[callno]->autoid = iax2_sched_replace(iaxs[callno]->autoid, 
@@ -9688,14 +9706,12 @@
 	if (pds.port)
 		sin.sin_port = htons(atoi(pds.port));
 
-	callno = find_callno(0, 0, &sin, NEW_FORCE, cai.sockfd);
+	callno = find_callno_locked(0, 0, &sin, NEW_FORCE, cai.sockfd);
 	if (callno < 1) {
 		ast_log(LOG_WARNING, "Unable to create call\n");
 		*cause = AST_CAUSE_CONGESTION;
 		return NULL;
 	}
-
-	ast_mutex_lock(&iaxsl[callno]);
 
 	/* If this is a trunk, update it now */
 	ast_copy_flags(iaxs[callno], &cai, IAX_TRUNK | IAX_SENDANI | IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF | IAX_FORCEJITTERBUF);	
@@ -11063,13 +11079,12 @@
 	ast_debug(1, "peer: %s, username: %s, password: %s, context: %s\n",
 		pds.peer, pds.username, pds.password, pds.context);
 
-	callno = find_callno(0, 0, &sin, NEW_FORCE, cai.sockfd);
+	callno = find_callno_locked(0, 0, &sin, NEW_FORCE, cai.sockfd);
 	if (callno < 1) {
 		ast_log(LOG_WARNING, "Unable to create call\n");
 		return -1;
 	}
 
-	ast_mutex_lock(&iaxsl[callno]);
 	ast_string_field_set(iaxs[callno], dproot, data);
 	iaxs[callno]->capability = IAX_CAPABILITY_FULLBANDWIDTH;
 

Modified: team/group/multiparking/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/channels/chan_local.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/channels/chan_local.c (original)
+++ team/group/multiparking/channels/chan_local.c Wed Apr 16 09:27:03 2008
@@ -74,6 +74,7 @@
 static int local_sendhtml(struct ast_channel *ast, int subclass, const char *data, int datalen);
 static int local_sendtext(struct ast_channel *ast, const char *text);
 static int local_devicestate(void *data);
+static struct ast_channel *local_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge);
 
 /* PBX interface structure for channel registration */
 static const struct ast_channel_tech local_tech = {
@@ -95,6 +96,7 @@
 	.send_html = local_sendhtml,
 	.send_text = local_sendtext,
 	.devicestate = local_devicestate,
+	.bridged_channel = local_bridgedchannel,
 };
 
 struct local_pvt {
@@ -116,6 +118,7 @@
 #define LOCAL_ALREADY_MASQED  (1 << 2) /*!< Already masqueraded */
 #define LOCAL_LAUNCHED_PBX    (1 << 3) /*!< PBX was launched */
 #define LOCAL_NO_OPTIMIZATION (1 << 4) /*!< Do not optimize using masquerading */
+#define LOCAL_BRIDGE          (1 << 5) /*!< Report back the "true" channel as being bridged to */
 
 static AST_LIST_HEAD_STATIC(locals, local_pvt);
 
@@ -165,6 +168,31 @@
 	ast_mutex_destroy(&pvt->lock);
 	ast_free(pvt);
 	return NULL;
+}
+
+/*! \brief Return the bridged channel of a Local channel */
+static struct ast_channel *local_bridgedchannel(struct ast_channel *chan, struct ast_channel *bridge)
+{
+	struct local_pvt *p = bridge->tech_pvt;
+	struct ast_channel *bridged = bridge;
+
+	ast_mutex_lock(&p->lock);
+
+	if (ast_test_flag(p, LOCAL_BRIDGE)) {
+		/* Find the opposite channel */
+		bridged = (bridge == p->owner ? p->chan : p->owner);
+		
+		/* Now see if the opposite channel is bridged to anything */
+		if (!bridged) {
+			bridged = bridge;
+		} else if (bridged->_bridge) {
+			bridged = bridged->_bridge;
+		}
+	}
+
+	ast_mutex_unlock(&p->lock);
+
+	return bridged;
 }
 
 static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us)
@@ -601,6 +629,9 @@
 					"to use the 'j' option to enable the jitterbuffer\n");
 			}
 		}
+		if (strchr(opts, 'b')) {
+			ast_set_flag(tmp, LOCAL_BRIDGE);
+		}
 	}
 
 	/* Look for a context */

Modified: team/group/multiparking/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/channels/chan_sip.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/channels/chan_sip.c (original)
+++ team/group/multiparking/channels/chan_sip.c Wed Apr 16 09:27:03 2008
@@ -6902,7 +6902,7 @@
 	}
 	if (!newjointcapability) {
 		/* If T.38 was not negotiated either, totally bail out... */
-		if (!p->t38.jointcapability || !p->t38.peercapability) {
+		if (!p->t38.jointcapability || !udptlportno) {
 			ast_log(LOG_NOTICE, "No compatible codecs, not accepting this offer!\n");
 			/* Do NOT Change current setting */
 			return -1;
@@ -8683,7 +8683,7 @@
 	}
 
 	/* If custom URI options have been provided, append them */
-	if (p->options && p->options->uri_options)
+	if (p->options && !ast_strlen_zero(p->options->uri_options))
 		ast_str_append(&invite, 0, ";%s", p->options->uri_options);
 	
  	/* This is the request URI, which is the next hop of the call
@@ -14361,6 +14361,14 @@
 		ast_copy_string(buf, peer->cid_num, len);
 	} else  if (!strcasecmp(colname, "codecs")) {
 		ast_getformatname_multiple(buf, len -1, peer->capability);
+	} else  if (!strncasecmp(colname, "chanvar[", 8)) {
+		char *chanvar=colname + 8;
+		struct ast_variable *v;
+	
+		chanvar = strsep(&chanvar, "]");
+		for (v = peer->chanvars ; v ; v = v->next)
+			if (strcasecmp(v->name, chanvar) == 0)
+				ast_copy_string(buf, v->value, sizeof(buf));
 	} else  if (!strncasecmp(colname, "codec[", 6)) {
 		char *codecnum;
 		int index = 0, codec = 0;
@@ -14405,6 +14413,7 @@
 	"- language              Default language for peer\n"
 	"- accountcode           Account code for this peer\n"
 	"- useragent             Current user agent id for peer\n"
+	"- chanvar[name]         A channel variable configured with setvar for this peer.\n"
 	"- codec[x]              Preferred codec index number 'x' (beginning with zero).\n"
 	"\n"
 };
@@ -15504,6 +15513,11 @@
 				} else {
 					if (!p->subscribed && !p->refer)
 						p->needdestroy = 1;
+					if (ast_test_flag(&p->flags[1], SIP_PAGE2_STATECHANGEQUEUE)) {
+						/* Ready to send the next state we have on queue */
+						ast_clear_flag(&p->flags[1], SIP_PAGE2_STATECHANGEQUEUE);
+						cb_extensionstate((char *)p->context, (char *)p->exten, p->laststate, (void *) p);
+					}
 				}
 			} else if (sipmethod == SIP_BYE)
 				p->needdestroy = 1;
@@ -16804,7 +16818,7 @@
 				struct ast_channel *bridgepeer = NULL;
 				struct sip_pvt *bridgepvt = NULL;
 				if ((bridgepeer = ast_bridged_channel(p->owner))) {
-					if (IS_SIP_TECH(bridgepeer->tech)) {
+					if (IS_SIP_TECH(bridgepeer->tech) && !ast_check_hangup(bridgepeer)) {
 						bridgepvt = (struct sip_pvt*)bridgepeer->tech_pvt;
 						/* Does the bridged peer have T38 ? */
 						if (bridgepvt->t38.state == T38_ENABLED) {

Modified: team/group/multiparking/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/channels/chan_skinny.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/channels/chan_skinny.c (original)
+++ team/group/multiparking/channels/chan_skinny.c Wed Apr 16 09:27:03 2008
@@ -1826,7 +1826,7 @@
 	int res = 0;
 
 	if (!s) {
-		ast_log(LOG_WARNING, "Asked to transmit to a non-existant session!\n");
+		ast_log(LOG_WARNING, "Asked to transmit to a non-existent session!\n");
 		return -1;
 	}
 

Modified: team/group/multiparking/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/channels/chan_unistim.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/channels/chan_unistim.c (original)
+++ team/group/multiparking/channels/chan_unistim.c Wed Apr 16 09:27:03 2008
@@ -515,7 +515,7 @@
 const static unsigned char packet_recv_resume_connection_with_server[] =
 	{ 0xff, 0xff, 0xff, 0xff, 0x9e, 0x03, 0x08 };
 const static unsigned char packet_recv_mac_addr[] =
-	{ 0xff, 0xff, 0xff, 0xff, 0x9a, 0x0d, 0x07, 0x31, 0x38 /*MacAddr */  };
+	{ 0xff, 0xff, 0xff, 0xff, 0x9a, 0x0d, 0x07 /*MacAddr */  };
 
 const static unsigned char packet_send_date_time3[] =
 	{ 0x11, 0x09, 0x02, 0x02, /*Month */ 0x05, /*Day */ 0x06, /*Hour */ 0x07,
@@ -1143,7 +1143,7 @@
 		ast_mutex_destroy(&s->lock);
 		ast_free(s);
 	} else
-		ast_log(LOG_WARNING, "Trying to delete non-existant session %p?\n", s);
+		ast_log(LOG_WARNING, "Trying to delete non-existent session %p?\n", s);
 	ast_mutex_unlock(&sessionlock);
 	return;
 }
@@ -3548,7 +3548,7 @@
 		}
 		if (pte->seq_server < seq) {
 			ast_log(LOG_NOTICE,
-					"%s Error : ACK received for a non-existant packet : #0x%.4x\n",
+					"%s Error : ACK received for a non-existent packet : #0x%.4x\n",
 					tmpbuf, pte->seq_server);
 			ast_mutex_unlock(&pte->lock);
 			return;
@@ -3600,7 +3600,7 @@
 		}
 		if (pte->seq_server < seq) {
 			ast_log(LOG_NOTICE,
-					"%s Error : received a request for a non-existant packet : #0x%.4x\n",
+					"%s Error : received a request for a non-existent packet : #0x%.4x\n",
 					tmpbuf, pte->seq_server);
 			return;
 		}

Modified: team/group/multiparking/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/channels/chan_zap.c?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/channels/chan_zap.c (original)
+++ team/group/multiparking/channels/chan_zap.c Wed Apr 16 09:27:03 2008
@@ -9125,6 +9125,7 @@
 	}
 }
 
+/* XXX: This function is assumed to be called with the private channel lock and linkset lock held */
 static void ss7_start_call(struct zt_pvt *p, struct zt_ss7 *linkset)
 {
 	struct ss7 *ss7 = linkset->ss7;
@@ -9151,10 +9152,14 @@
 	ast_mutex_unlock(&linkset->lock);
 	c = zt_new(p, AST_STATE_RING, 1, SUB_REAL, law, 0);
 	ast_mutex_lock(&linkset->lock);
-	if (c)
+
+	if (!c) {
+		ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
+		return;
+	} else
 		ast_verb(3, "Accepting call to '%s' on CIC %d\n", p->exten, p->cic);
-	else
-		ast_log(LOG_WARNING, "Unable to start PBX on CIC %d\n", p->cic);
+
+	zt_enable_ec(p);
 
 	if (!ast_strlen_zero(p->charge_number)) {
 		pbx_builtin_setvar_helper(c, "SS7_CHARGE_NUMBER", p->charge_number);
@@ -9517,10 +9522,14 @@
 				}
 				p = linkset->pvts[chanpos];
 
+				ast_mutex_lock(&p->lock);
+
 				if (p->loopedback) {
 					zt_loopback(p, 0);
 					ss7_start_call(p, linkset);
 				}
+
+				ast_mutex_unlock(&p->lock);
 
 				break;
 			case ISUP_EVENT_CCR:

Modified: team/group/multiparking/configs/res_ldap.conf.sample
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/configs/res_ldap.conf.sample?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/configs/res_ldap.conf.sample (original)
+++ team/group/multiparking/configs/res_ldap.conf.sample Wed Apr 16 09:27:03 2008
@@ -28,92 +28,92 @@
 ; additionalFilter - This specifies an additional set of criteria to be used
 ; when querying the LDAP server.
 ;
-additionalFilter=(objectClass=PBXConfig)
+additionalFilter=(objectClass=AstConfig)
 ;
 ; Attributes mapping (asterisk variable name = ldap attribute name)
 ; When Asterisk requests the variable by the name of the value on the left,
 ; this module will look up the attribute listed on the right.
 ;
-filename = PBXConfigFilename
-category = PBXConfigCategory
-variable_name = PBXConfigVariableName
-variable_value = PBXConfigVariableValue
-cat_metric = PBXConfigCategoryMetric
-commented = PBXConfigCommented
+filename = AstConfigFilename
+category = AstConfigCategory
+variable_name = AstConfigVariableName
+variable_value = AstConfigVariableValue
+cat_metric = AstConfigCategoryMetric
+commented = AstConfigCommented
 
 ;
 ; Extensions Table
 ;
 [extensions]
-context  =  PBXExtensionContext
-exten  =  PBXExtensionExten
-priority = PBXExtensionPriority
-app = PBXExtensionApplication
-appdata = PBXExtensionApplicationData
-additionalFilter=(objectClass=PBXExtension)
+context  =  AstExtensionContext
+exten  =  AstExtensionExten
+priority = AstExtensionPriority
+app = AstExtensionApplication
+appdata = AstExtensionApplicationData
+additionalFilter=(objectClass=AstExtension)
 
 ;
 ; Sip Users Table
 ;
 [sip]
 name = uid
-amaflags = PBXAccountAMAFlags
-callgroup = PBXAccountCallGroup
-callerid = PBXAccountCallerID
-canreinvite = PBXAccountCanReinvite
-context = PBXAccountContext
-dtmfmode = PBXAccountDTMFMode
-fromuser = PBXAccountFromUser
-fromdomain = PBXAccountFromDomain
-fullcontact = PBXAccountFullContact
+amaflags = AstAccountAMAFlags
+callgroup = AstAccountCallGroup
+callerid = AstAccountCallerID
+canreinvite = AstAccountCanReinvite
+context = AstAccountContext
+dtmfmode = AstAccountDTMFMode
+fromuser = AstAccountFromUser
+fromdomain = AstAccountFromDomain
+fullcontact = AstAccountFullContact
 fullcontact = gecos
-host = PBXAccountHost
-insecure = PBXAccountInsecure
-mailbox = PBXAccountMailbox
+host = AstAccountHost
+insecure = AstAccountInsecure
+mailbox = AstAccountMailbox
 md5secret = realmedPassword
-nat = PBXAccountNAT
-deny = PBXAccountDeny
-permit = PBXAccountPermit
-pickupgroup = PBXAccountPickupGroup
-port = PBXAccountPort
-qualify = PBXAccountQualify
-restrictcid = PBXAccountRestrictCID
-rtptimeout = PBXAccountRTPTimeout
-rtpholdtimeout = PBXAccountRTPHoldTimeout
-type = PBXAccountType
-disallow = PBXAccountDisallowedCodec
-allow = PBXAccountAllowedCodec
-MusicOnHold = PBXAccountMusicOnHold
-regseconds = PBXAccountExpirationTimestamp
-regcontext = PBXAccountRegistrationContext
-regexten = PBXAccountRegistrationExten
-CanCallForward = PBXAccountCanCallForward
-additionalFilter=(objectClass=PBXAccountSIP)
+nat = AstAccountNAT
+deny = AstAccountDeny
+permit = AstAccountPermit
+pickupgroup = AstAccountPickupGroup
+port = AstAccountPort
+qualify = AstAccountQualify
+restrictcid = AstAccountRestrictCID
+rtptimeout = AstAccountRTPTimeout
+rtpholdtimeout = AstAccountRTPHoldTimeout
+type = AstAccountType
+disallow = AstAccountDisallowedCodec
+allow = AstAccountAllowedCodec
+MusicOnHold = AstAccountMusicOnHold
+regseconds = AstAccountExpirationTimestamp
+regcontext = AstAccountRegistrationContext
+regexten = AstAccountRegistrationExten
+CanCallForward = AstAccountCanCallForward
+additionalFilter=(objectClass=AstAccountSIP)
 
 ;
 ; IAX Users Table
 ;
 [iax]
-amaflags = PBXAccountAMAFlags
-callerid = PBXAccountCallerID
-context = PBXAccountContext
-fullcontact = PBXAccountFullContact
+amaflags = AstAccountAMAFlags
+callerid = AstAccountCallerID
+context = AstAccountContext
+fullcontact = AstAccountFullContact
 fullcontact = gecos
-host = PBXAccountHost
-mailbox = PBXAccountMailbox
+host = AstAccountHost
+mailbox = AstAccountMailbox
 md5secret = realmedPassword
-deny = PBXAccountDeny
-permit = PBXAccountPermit
-port = PBXAccountPort
-qualify = PBXAccountQualify
-type = PBXAccountType
-disallow = PBXAccountDisallowedCodec
-allow = PBXAccountAllowedCodec
-regseconds = PBXAccountExpirationTimestamp
-regcontext = PBXAccountRegistrationContext
-regexten = PBXAccountRegistrationExten
-notransfer = PBXAccountNoTransfer
-additionalFilter=(objectClass=PBXAccountIAX)
+deny = AstAccountDeny
+permit = AstAccountPermit
+port = AstAccountPort
+qualify = AstAccountQualify
+type = AstAccountType
+disallow = AstAccountDisallowedCodec
+allow = AstAccountAllowedCodec
+regseconds = AstAccountExpirationTimestamp
+regcontext = AstAccountRegistrationContext
+regexten = AstAccountRegistrationExten
+notransfer = AstAccountNoTransfer
+additionalFilter=(objectClass=AstAccountIAX)
 
 ;
 ; A Test Family
@@ -123,36 +123,36 @@
 additionalFilter=(objectClass=*)
 
 [accounts]
-amaflags = PBXAccountAMAFlags
-callgroup = PBXAccountCallGroup
-callerid = PBXAccountCallerID
-canreinvite = PBXAccountCanReinvite
-context = PBXAccountContext
-dtmfmode = PBXAccountDTMFMode
-fromuser = PBXAccountFromUser
-fromdomain = PBXAccountFromDomain
-fullcontact = PBXAccountFullContact
+amaflags = AstAccountAMAFlags
+callgroup = AstAccountCallGroup
+callerid = AstAccountCallerID
+canreinvite = AstAccountCanReinvite
+context = AstAccountContext
+dtmfmode = AstAccountDTMFMode
+fromuser = AstAccountFromUser
+fromdomain = AstAccountFromDomain
+fullcontact = AstAccountFullContact
 fullcontact = gecos
-host = PBXAccountHost
-insecure = PBXAccountInsecure
-mailbox = PBXAccountMailbox
+host = AstAccountHost
+insecure = AstAccountInsecure
+mailbox = AstAccountMailbox
 md5secret = realmedPassword
-nat = PBXAccountNAT
-deny = PBXAccountDeny
-permit = PBXAccountPermit
-pickupgroup = PBXAccountPickupGroup
-port = PBXAccountPort
-qualify = PBXAccountQualify
-restrictcid = PBXAccountRestrictCID
-rtptimeout = PBXAccountRTPTimeout
-rtpholdtimeout = PBXAccountRTPHoldTimeout
-type = PBXAccountType
-disallow = PBXAccountDisallowedCodec
-allow = PBXAccountAllowedCodec
-MusicOnHold = PBXAccountMusicOnHold
-regseconds = PBXAccountExpirationTimestamp
-regcontext = PBXAccountRegistrationContext
-regexten = PBXAccountRegistrationExten
-CanCallForward = PBXAccountCanCallForward
-additionalFilter=(objectClass=PBXAccount)
+nat = AstAccountNAT
+deny = AstAccountDeny
+permit = AstAccountPermit
+pickupgroup = AstAccountPickupGroup
+port = AstAccountPort
+qualify = AstAccountQualify
+restrictcid = AstAccountRestrictCID
+rtptimeout = AstAccountRTPTimeout
+rtpholdtimeout = AstAccountRTPHoldTimeout
+type = AstAccountType
+disallow = AstAccountDisallowedCodec
+allow = AstAccountAllowedCodec
+MusicOnHold = AstAccountMusicOnHold
+regseconds = AstAccountExpirationTimestamp
+regcontext = AstAccountRegistrationContext
+regexten = AstAccountRegistrationExten
+CanCallForward = AstAccountCanCallForward
+additionalFilter=(objectClass=AstAccount)
 

Modified: team/group/multiparking/contrib/scripts/astcli
URL: http://svn.digium.com/view/asterisk/team/group/multiparking/contrib/scripts/astcli?view=diff&rev=114170&r1=114169&r2=114170
==============================================================================
--- team/group/multiparking/contrib/scripts/astcli (original)
+++ team/group/multiparking/contrib/scripts/astcli Wed Apr 16 09:27:03 2008
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
-use Net::Telnet;
+use IO::Socket;
 use Getopt::Long;
 
 # Created by: David Van Ginneken
@@ -10,66 +10,116 @@
 #
 # And distributed under the terms of the GPL
 #

[... 1259 lines stripped ...]



More information about the asterisk-commits mailing list