[asterisk-commits] oej: branch oej/bufo-manager-contexts-trunk r379995 - in /team/oej/bufo-manag...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 23 02:01:34 CST 2013


Author: oej
Date: Wed Jan 23 02:01:27 2013
New Revision: 379995

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379995
Log:
Reset automerge

Modified:
    team/oej/bufo-manager-contexts-trunk/   (props changed)
    team/oej/bufo-manager-contexts-trunk/apps/app_confbridge.c
    team/oej/bufo-manager-contexts-trunk/apps/app_minivm.c
    team/oej/bufo-manager-contexts-trunk/apps/app_voicemail.c
    team/oej/bufo-manager-contexts-trunk/bridges/bridge_builtin_features.c
    team/oej/bufo-manager-contexts-trunk/channels/chan_bridge.c
    team/oej/bufo-manager-contexts-trunk/channels/chan_skinny.c
    team/oej/bufo-manager-contexts-trunk/configure
    team/oej/bufo-manager-contexts-trunk/configure.ac

Propchange: team/oej/bufo-manager-contexts-trunk/
------------------------------------------------------------------------------
    automerge = Is-there-life-off-net?

Propchange: team/oej/bufo-manager-contexts-trunk/
            ('svnmerge-integrated' removed)

Modified: team/oej/bufo-manager-contexts-trunk/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/bufo-manager-contexts-trunk/apps/app_confbridge.c?view=diff&rev=379995&r1=379994&r2=379995
==============================================================================
--- team/oej/bufo-manager-contexts-trunk/apps/app_confbridge.c (original)
+++ team/oej/bufo-manager-contexts-trunk/apps/app_confbridge.c Wed Jan 23 02:01:27 2013
@@ -675,6 +675,23 @@
 }
 
 /*!
+ * \internal
+ * \brief Complain if the given sound file does not exist.
+ *
+ * \param filename Sound file to check if exists.
+ *
+ * \retval non-zero if the file exists.
+ */
+static int sound_file_exists(const char *filename)
+{
+	if (ast_fileexists(filename, NULL, NULL)) {
+		return -1;
+	}
+	ast_log(LOG_WARNING, "File %s does not exist in any format\n", filename);
+	return 0;
+}
+
+/*!
  * \brief Announce number of users in the conference bridge to the caller
  *
  * \param conference_bridge Conference bridge to peek at
@@ -719,7 +736,7 @@
 				"")) {
 				return -1;
 			}
-		} else if (ast_fileexists(there_are, NULL, NULL) && ast_fileexists(other_in_party, NULL, NULL)) {
+		} else if (sound_file_exists(there_are) && sound_file_exists(other_in_party)) {
 			play_sound_file(conference_bridge, there_are);
 			play_sound_number(conference_bridge, conference_bridge->activeusers - 1);
 			play_sound_file(conference_bridge, other_in_party);
@@ -1209,7 +1226,16 @@
 
 	if (ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_ANNOUNCEUSERCOUNTALL) &&
 		(conference_bridge->activeusers > conference_bridge_user->u_profile.announce_user_count_all_after)) {
-		if (announce_user_count(conference_bridge, NULL)) {
+		int user_count_res;
+
+		/*
+		 * We have to autoservice the new user because he has not quite
+		 * joined the conference yet.
+		 */
+		ast_autoservice_start(conference_bridge_user->chan);
+		user_count_res = announce_user_count(conference_bridge, NULL);
+		ast_autoservice_stop(conference_bridge_user->chan);
+		if (user_count_res) {
 			leave_conference(conference_bridge_user);
 			return NULL;
 		}
@@ -1288,8 +1314,7 @@
 	struct ast_channel *underlying_channel;
 
 	/* Do not waste resources trying to play files that do not exist */
-	if (!ast_strlen_zero(filename) && !ast_fileexists(filename, NULL, NULL)) {
-		ast_log(LOG_WARNING, "File %s does not exist in any format\n", !ast_strlen_zero(filename) ? filename : "<unknown>");
+	if (!ast_strlen_zero(filename) && !sound_file_exists(filename)) {
 		return 0;
 	}
 
@@ -1303,7 +1328,10 @@
 	} else {
 		/* Channel was already available so we just need to add it back into the bridge */
 		underlying_channel = ast_channel_tech(conference_bridge->playback_chan)->bridged_channel(conference_bridge->playback_chan, NULL);
-		ast_bridge_impart(conference_bridge->bridge, underlying_channel, NULL, NULL, 0);
+		if (ast_bridge_impart(conference_bridge->bridge, underlying_channel, NULL, NULL, 0)) {
+			ast_mutex_unlock(&conference_bridge->playback_lock);
+			return -1;
+		}
 	}
 
 	/* The channel is all under our control, in goes the prompt */
@@ -2092,6 +2120,16 @@
 	return CLI_SUCCESS;
 }
 
+static void handle_cli_confbridge_list_item(struct ast_cli_args *a, struct conference_bridge_user *participant)
+{
+	ast_cli(a->fd, "%-29s ", ast_channel_name(participant->chan));
+	ast_cli(a->fd, "%-17s", participant->u_profile.name);
+	ast_cli(a->fd, "%-17s", participant->b_profile.name);
+	ast_cli(a->fd, "%-17s", participant->menu_name);
+	ast_cli(a->fd, "%-17s", S_COR(ast_channel_caller(participant->chan)->id.number.valid, ast_channel_caller(participant->chan)->id.number.str, "<unknown>"));
+	ast_cli(a->fd, "\n");
+}
+
 static char *handle_cli_confbridge_list(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ao2_iterator i;
@@ -2118,7 +2156,7 @@
 		ast_cli(a->fd, "================================ ====== ====== ========\n");
 		i = ao2_iterator_init(conference_bridges, 0);
 		while ((bridge = ao2_iterator_next(&i))) {
-			ast_cli(a->fd, "%-32s %6i %6i %s\n", bridge->name, bridge->activeusers, bridge->markedusers, (bridge->locked ? "locked" : "unlocked"));
+			ast_cli(a->fd, "%-32s %6i %6i %s\n", bridge->name, bridge->activeusers + bridge->waitingusers, bridge->markedusers, (bridge->locked ? "locked" : "unlocked"));
 			ao2_ref(bridge, -1);
 		}
 		ao2_iterator_destroy(&i);
@@ -2136,12 +2174,10 @@
 		ast_cli(a->fd, "============================= ================ ================ ================ ================\n");
 		ao2_lock(bridge);
 		AST_LIST_TRAVERSE(&bridge->active_list, participant, list) {
-			ast_cli(a->fd, "%-29s ", ast_channel_name(participant->chan));
-			ast_cli(a->fd, "%-17s", participant->u_profile.name);
-			ast_cli(a->fd, "%-17s", participant->b_profile.name);
-			ast_cli(a->fd, "%-17s", participant->menu_name);
-			ast_cli(a->fd, "%-17s", S_COR(ast_channel_caller(participant->chan)->id.number.valid, ast_channel_caller(participant->chan)->id.number.str, "<unknown>"));
-			ast_cli(a->fd, "\n");
+			handle_cli_confbridge_list_item(a, participant);
+		}
+		AST_LIST_TRAVERSE(&bridge->waiting_list, participant, list) {
+			handle_cli_confbridge_list_item(a, participant);
 		}
 		ao2_unlock(bridge);
 		ao2_ref(bridge, -1);
@@ -2440,6 +2476,27 @@
 	.read = func_confbridge_info,
 };
 
+static void action_confbridgelist_item(struct mansession *s, const char *id_text, struct conference_bridge *bridge, struct conference_bridge_user *participant)
+{
+	astman_append(s,
+		"Event: ConfbridgeList\r\n"
+		"%s"
+		"Conference: %s\r\n"
+		"CallerIDNum: %s\r\n"
+		"CallerIDName: %s\r\n"
+		"Channel: %s\r\n"
+		"Admin: %s\r\n"
+		"MarkedUser: %s\r\n"
+		"\r\n",
+		id_text,
+		bridge->name,
+		S_COR(ast_channel_caller(participant->chan)->id.number.valid, ast_channel_caller(participant->chan)->id.number.str, "<unknown>"),
+		S_COR(ast_channel_caller(participant->chan)->id.name.valid, ast_channel_caller(participant->chan)->id.name.str, "<no name>"),
+		ast_channel_name(participant->chan),
+		ast_test_flag(&participant->u_profile, USER_OPT_ADMIN) ? "Yes" : "No",
+		ast_test_flag(&participant->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No");
+}
+
 static int action_confbridgelist(struct mansession *s, const struct message *m)
 {
 	const char *actionid = astman_get_header(m, "ActionID");
@@ -2473,23 +2530,11 @@
 	ao2_lock(bridge);
 	AST_LIST_TRAVERSE(&bridge->active_list, participant, list) {
 		total++;
-		astman_append(s,
-			"Event: ConfbridgeList\r\n"
-			"%s"
-			"Conference: %s\r\n"
-			"CallerIDNum: %s\r\n"
-			"CallerIDName: %s\r\n"
-			"Channel: %s\r\n"
-			"Admin: %s\r\n"
-			"MarkedUser: %s\r\n"
-			"\r\n",
-			id_text,
-			bridge->name,
-			S_COR(ast_channel_caller(participant->chan)->id.number.valid, ast_channel_caller(participant->chan)->id.number.str, "<unknown>"),
-			S_COR(ast_channel_caller(participant->chan)->id.name.valid, ast_channel_caller(participant->chan)->id.name.str, "<no name>"),
-			ast_channel_name(participant->chan),
-			ast_test_flag(&participant->u_profile, USER_OPT_ADMIN) ? "Yes" : "No",
-			ast_test_flag(&participant->u_profile, USER_OPT_MARKEDUSER) ? "Yes" : "No");
+		action_confbridgelist_item(s, id_text, bridge, participant);
+	}
+	AST_LIST_TRAVERSE(&bridge->waiting_list, participant, list) {
+		total++;
+		action_confbridgelist_item(s, id_text, bridge, participant);
 	}
 	ao2_unlock(bridge);
 	ao2_ref(bridge, -1);
@@ -2539,7 +2584,7 @@
 		"\r\n",
 		id_text,
 		bridge->name,
-		bridge->activeusers,
+		bridge->activeusers + bridge->waitingusers,
 		bridge->markedusers,
 		bridge->locked ? "Yes" : "No"); 
 		ao2_unlock(bridge);

Modified: team/oej/bufo-manager-contexts-trunk/apps/app_minivm.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/bufo-manager-contexts-trunk/apps/app_minivm.c?view=diff&rev=379995&r1=379994&r2=379995
==============================================================================
--- team/oej/bufo-manager-contexts-trunk/apps/app_minivm.c (original)
+++ team/oej/bufo-manager-contexts-trunk/apps/app_minivm.c Wed Jan 23 02:01:27 2013
@@ -1158,7 +1158,6 @@
 {
 	struct ast_str *tmp = ast_str_alloca(80);
 	int first_section = 1;
-	*end = '\0';
 
 	ast_str_reset(*end);
 	ast_str_set(&tmp, -1, "=?%s?Q?", charset);

Modified: team/oej/bufo-manager-contexts-trunk/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/bufo-manager-contexts-trunk/apps/app_voicemail.c?view=diff&rev=379995&r1=379994&r2=379995
==============================================================================
--- team/oej/bufo-manager-contexts-trunk/apps/app_voicemail.c (original)
+++ team/oej/bufo-manager-contexts-trunk/apps/app_voicemail.c Wed Jan 23 02:01:27 2013
@@ -3566,6 +3566,16 @@
 	}
 }
 
+#define MSG_ID_LEN 256
+
+/* Used to attach a unique identifier to an msg_id */
+static int msg_id_incrementor;
+
+/*!
+ * \brief Sets the destination string to a uniquely identifying msg_id string
+ * \param dst pointer to a character buffer that should contain MSG_ID_LEN characters.
+ */
+static void generate_msg_id(char *dst);
 
 #ifdef ODBC_STORAGE
 struct generic_prepare_struct {
@@ -3595,6 +3605,33 @@
 		SQLBindParameter(stmt, i + 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(gps->argv[i]), 0, gps->argv[i], 0, NULL);
 
 	return stmt;
+}
+
+static void odbc_update_msg_id(char *dir, int msg_num, char *msg_id)
+{
+	SQLHSTMT stmt;
+	char sql[PATH_MAX];
+	struct odbc_obj *obj;
+	char msg_num_str[20];
+	char *argv[] = { msg_id, dir, msg_num_str };
+	struct generic_prepare_struct gps = { .sql = sql, .argc = 3, .argv = argv };
+
+	obj = ast_odbc_request_obj(odbc_database, 0);
+	if (!obj) {
+		ast_log(LOG_WARNING, "Unable to update message ID for message %d in %s\n", msg_num, dir);
+		return;
+	}
+
+	snprintf(msg_num_str, sizeof(msg_num_str), "%d", msg_num);
+	snprintf(sql, sizeof(sql), "UPDATE %s SET msg_id=? WHERE dir=? AND msgnum=?", odbc_table);
+	stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
+	if (!stmt) {
+		ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
+	} else {
+		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+	}
+	ast_odbc_release_obj(obj);
+	return;
 }
 
 /*!
@@ -3745,7 +3782,12 @@
 				}
 			} else {
 				res = SQLGetData(stmt, x + 1, SQL_CHAR, rowdata, sizeof(rowdata), NULL);
-				if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
+				if ((res == SQL_NULL_DATA) && (!strcasecmp(coltitle, "msg_id"))) {
+					char msg_id[MSG_ID_LEN];
+					generate_msg_id(msg_id);
+					snprintf(rowdata, sizeof(rowdata), "%s", msg_id);
+					odbc_update_msg_id(dir, msgnum, msg_id);
+				} else if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
 					ast_log(AST_LOG_WARNING, "SQL Get Data error! coltitle=%s\n[%s]\n\n", coltitle, sql);
 					SQLFreeHandle (SQL_HANDLE_STMT, stmt);
 					ast_odbc_release_obj(obj);
@@ -3992,16 +4034,18 @@
 	char sql[512];
 	char msgnums[20];
 	char msgnumd[20];
+	char msg_id[MSG_ID_LEN];
 	struct odbc_obj *obj;
-	char *argv[] = { ddir, msgnumd, dmailboxuser, dmailboxcontext, sdir, msgnums };
-	struct generic_prepare_struct gps = { .sql = sql, .argc = 6, .argv = argv };
-
+	char *argv[] = { ddir, msgnumd, msg_id, dmailboxuser, dmailboxcontext, sdir, msgnums };
+	struct generic_prepare_struct gps = { .sql = sql, .argc = 7, .argv = argv };
+
+	generate_msg_id(msg_id);
 	delete_file(ddir, dmsg);
 	obj = ast_odbc_request_obj(odbc_database, 0);
 	if (obj) {
 		snprintf(msgnums, sizeof(msgnums), "%d", smsg);
 		snprintf(msgnumd, sizeof(msgnumd), "%d", dmsg);
-		snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording, flag, mailboxuser, mailboxcontext) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording,flag,?,? FROM %s WHERE dir=? AND msgnum=?", odbc_table, odbc_table);
+		snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, msg_id, context, macrocontext, callerid, origtime, duration, recording, flag, mailboxuser, mailboxcontext) SELECT ?,?,?,context,macrocontext,callerid,origtime,duration,recording,flag,?,? FROM %s WHERE dir=? AND msgnum=?", odbc_table, odbc_table);
 		stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
 		if (!stmt)
 			ast_log(AST_LOG_WARNING, "SQL Execute error!\n[%s] (You probably don't have MySQL 4.1 or later installed)\n\n", sql);
@@ -4192,33 +4236,6 @@
 	if (fd > -1)
 		close(fd);
 	return res;
-}
-
-static void odbc_update_msg_id(char *dir, int msg_num, char *msg_id)
-{
-	SQLHSTMT stmt;
-	char sql[PATH_MAX];
-	struct odbc_obj *obj;
-	char msg_num_str[20];
-	char *argv[] = { msg_id, dir, msg_num_str };
-	struct generic_prepare_struct gps = { .sql = sql, .argc = 3, .argv = argv };
-
-	obj = ast_odbc_request_obj(odbc_database, 0);
-	if (!obj) {
-		ast_log(LOG_WARNING, "Unable to update message ID for message %d in %s\n", msg_num, dir);
-		return;
-	}
-
-	snprintf(msg_num_str, sizeof(msg_num_str), "%d", msg_num);
-	snprintf(sql, sizeof(sql), "UPDATE %s SET msg_id=? WHERE dir=? AND msgnum=?", odbc_table);
-	stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
-	if (!stmt) {
-		ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
-	} else {
-		SQLFreeHandle(SQL_HANDLE_STMT, stmt);
-	}
-	ast_odbc_release_obj(obj);
-	return;
 }
 
 /*!
@@ -5939,6 +5956,16 @@
 	char *exitcontext;
 };
 
+static void generate_msg_id(char *dst)
+{
+	/* msg id is time of msg_id generation plus an incrementing value
+	 * called each time a new msg_id is generated. This should achieve uniqueness,
+	 * but only in single system solutions.
+	 */
+	int unique_counter = ast_atomic_fetchadd_int(&msg_id_incrementor, +1);
+	snprintf(dst, MSG_ID_LEN, "%ld-%08x", (long) time(NULL), unique_counter);
+}
+
 /*!
  * \internal
  * \brief Creates a voicemail based on a specified file to a mailbox.
@@ -5988,7 +6015,7 @@
 	/* We aren't currently doing anything with category, since it comes from a channel variable and
 	 * this function doesn't use channels, but this function could add that as an argument later. */
 	const char *category = NULL; /* pointless for now */
-	char msg_id[256];
+	char msg_id[MSG_ID_LEN];
 
 	/* Start by checking to see if the file actually exists... */
 	if (!(ast_fileexists(recdata->recording_file, recdata->recording_ext, NULL))) {
@@ -6041,15 +6068,7 @@
 	/* Store information */
 	txt = fdopen(txtdes, "w+");
 	if (txt) {
-		char msg_id_hash[256];
-
-		/* Every voicemail msg gets its own unique msg id.  The msg id is the originate time
-		 * plus a hash of the extension, context, and callerid of the channel leaving the msg */
-
-		snprintf(msg_id_hash, sizeof(msg_id_hash), "%s%s%s", recdata->call_extension, 
-			recdata->call_context, recdata->call_callerid);
-		snprintf(msg_id, sizeof(msg_id), "%ld-%d", (long) time(NULL), ast_str_hash(msg_id_hash));
-
+		generate_msg_id(msg_id);
 		get_date(date, sizeof(date));
 		fprintf(txt,
 			";\n"
@@ -6517,7 +6536,7 @@
 	/* The meat of recording the message...  All the announcements and beeps have been played*/
 	ast_copy_string(fmt, vmfmts, sizeof(fmt));
 	if (!ast_strlen_zero(fmt)) {
-		char msg_id[256] = "";
+		char msg_id[MSG_ID_LEN] = "";
 		msgnum = 0;
 
 #ifdef IMAP_STORAGE
@@ -6610,13 +6629,7 @@
 		/* Store information */
 		txt = fdopen(txtdes, "w+");
 		if (txt) {
-			char msg_id_hash[256] = "";
-
-			/* Every voicemail msg gets its own unique msg id.  The msg id is the originate time
-			 * plus a hash of the extension, context, and callerid of the channel leaving the msg */
-			snprintf(msg_id_hash, sizeof(msg_id_hash), "%s%s%s", ast_channel_exten(chan), ast_channel_context(chan), callerid);
-			snprintf(msg_id, sizeof(msg_id), "%ld-%d", (long) time(NULL), ast_str_hash(msg_id_hash));
-
+			generate_msg_id(msg_id);
 			get_date(date, sizeof(date));
 			ast_callerid_merge(callerid, sizeof(callerid),
 				S_COR(ast_channel_caller(chan)->id.name.valid, ast_channel_caller(chan)->id.name.str, NULL),
@@ -11620,21 +11633,11 @@
 	return res;
 }
 
-static void generate_random_string(char *buf, size_t size)
-{
-	long val[4];
-	int x;
-
-	for (x=0; x<4; x++)
-		val[x] = ast_random();
-	snprintf(buf, size, "%08lx%08lx%08lx%08lx", val[0], val[1], val[2], val[3]);
-}
-
 static int add_message_id(struct ast_config *msg_cfg, char *dir, int msg, char *filename, char *id, size_t id_size, struct ast_vm_user *vmu, int folder)
 {
 	struct ast_variable *var;
 	struct ast_category *cat;
-	generate_random_string(id, id_size);
+	generate_msg_id(id);
 
 	var = ast_variable_new("msg_id", id, "");
 	if (!var) {
@@ -14968,7 +14971,7 @@
 			 * message ID. Add one to the message config
 			 * if it does not already exist
 			 */
-			char id[33];
+			char id[MSG_ID_LEN];
 			if (!(add_message_id(msg_cfg, vms->curdir, vms->curmsg,
 							filename, id, sizeof(id), vmu, mailbox_index))) {
 				ast_string_field_set(msg_snapshot, msg_id, id);

Modified: team/oej/bufo-manager-contexts-trunk/bridges/bridge_builtin_features.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/bufo-manager-contexts-trunk/bridges/bridge_builtin_features.c?view=diff&rev=379995&r1=379994&r2=379995
==============================================================================
--- team/oej/bufo-manager-contexts-trunk/bridges/bridge_builtin_features.c (original)
+++ team/oej/bufo-manager-contexts-trunk/bridges/bridge_builtin_features.c Wed Jan 23 02:01:27 2013
@@ -111,14 +111,12 @@
 	/* Grab the extension to transfer to */
 	if (!grab_transfer(bridge_channel->chan, exten, sizeof(exten), context)) {
 		ast_stream_and_wait(bridge_channel->chan, "pbx-invalid", AST_DIGIT_ANY);
-		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_WAIT);
 		return 0;
 	}
 
 	/* Get a channel that is the destination we wish to call */
 	if (!(chan = dial_transfer(bridge_channel->chan, exten, context))) {
 		ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_ANY);
-		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_WAIT);
 		return 0;
 	}
 
@@ -131,7 +129,11 @@
 /*! \brief Attended transfer feature to turn it into a threeway call */
 static int attended_threeway_transfer(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
 {
-	/* This is sort of abusing the depart state but in this instance it is only going to be handled in the below function so it is okay */
+	/*
+	 * This is sort of abusing the depart state but in this instance
+	 * it is only going to be handled by feature_attended_transfer()
+	 * so it is okay.
+	 */
 	ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_DEPART);
 	return 0;
 }
@@ -176,14 +178,12 @@
 	/* Grab the extension to transfer to */
 	if (!grab_transfer(bridge_channel->chan, exten, sizeof(exten), context)) {
 		ast_stream_and_wait(bridge_channel->chan, "pbx-invalid", AST_DIGIT_ANY);
-		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_WAIT);
 		return 0;
 	}
 
 	/* Get a channel that is the destination we wish to call */
 	if (!(chan = dial_transfer(bridge_channel->chan, exten, context))) {
 		ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_ANY);
-		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_WAIT);
 		return 0;
 	}
 
@@ -191,7 +191,6 @@
 	if (!(attended_bridge = ast_bridge_new(AST_BRIDGE_CAPABILITY_1TO1MIX, 0))) {
 		ast_hangup(chan);
 		ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_ANY);
-		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_WAIT);
 		return 0;
 	}
 
@@ -228,7 +227,6 @@
 		}
 	} else {
 		ast_stream_and_wait(bridge_channel->chan, "beeperr", AST_DIGIT_ANY);
-		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_WAIT);
 	}
 
 	/* Now that all channels are out of it we can destroy the bridge and the called features structure */
@@ -241,7 +239,11 @@
 /*! \brief Internal built in feature for hangup */
 static int feature_hangup(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
 {
-	/* This is very simple, we basically change the state on the bridge channel to end and the core takes care of the rest */
+	/*
+	 * This is very simple, we simply change the state on the
+	 * bridge_channel to force the channel out of the bridge and the
+	 * core takes care of the rest.
+	 */
 	ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
 	return 0;
 }

Modified: team/oej/bufo-manager-contexts-trunk/channels/chan_bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/bufo-manager-contexts-trunk/channels/chan_bridge.c?view=diff&rev=379995&r1=379994&r2=379995
==============================================================================
--- team/oej/bufo-manager-contexts-trunk/channels/chan_bridge.c (original)
+++ team/oej/bufo-manager-contexts-trunk/channels/chan_bridge.c Wed Jan 23 02:01:27 2013
@@ -126,9 +126,8 @@
 	}
 
 	/* Impart the output channel upon the given bridge of the input channel */
-	ast_bridge_impart(ast_channel_internal_bridge(p->input), p->output, NULL, NULL, 0);
-
-	return 0;
+	return ast_bridge_impart(ast_channel_internal_bridge(p->input), p->output, NULL, NULL, 0)
+		? -1 : 0;
 }
 
 /*! \brief Called when a channel should be hung up */

Modified: team/oej/bufo-manager-contexts-trunk/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/bufo-manager-contexts-trunk/channels/chan_skinny.c?view=diff&rev=379995&r1=379994&r2=379995
==============================================================================
--- team/oej/bufo-manager-contexts-trunk/channels/chan_skinny.c (original)
+++ team/oej/bufo-manager-contexts-trunk/channels/chan_skinny.c Wed Jan 23 02:01:27 2013
@@ -3125,25 +3125,6 @@
 	SKINNY_DEBUG(DEBUG_SUB, 3, "Sub %d - Updating\n", sub->callid);
 
 	send_callinfo(sub);
-	if (ast_channel_state(sub->owner) == AST_STATE_UP) {
-		transmit_callstate(d, l->instance, sub->callid, SKINNY_CONNECTED);
-		transmit_displaypromptstatus(d, "Connected", 0, l->instance, sub->callid);
-	} else {
-		if (sub->calldirection == SKINNY_INCOMING) {
-			transmit_callstate(d, l->instance, sub->callid, SKINNY_RINGIN);
-			transmit_displaypromptstatus(d, "Ring-In", 0, l->instance, sub->callid);
-		} else {
-			if (!sub->ringing) {
-				transmit_callstate(d, l->instance, sub->callid, SKINNY_RINGOUT);
-				transmit_displaypromptstatus(d, "Ring-Out", 0, l->instance, sub->callid);
-				sub->ringing = 1;
-			} else {
-				transmit_callstate(d, l->instance, sub->callid, SKINNY_PROGRESS);
-				transmit_displaypromptstatus(d, "Call Progress", 0, l->instance, sub->callid);
-				sub->progress = 1;
-			}
-		}
-	}
 }
 
 static void mwi_event_cb(const struct ast_event *event, void *userdata)
@@ -5265,6 +5246,9 @@
 			ast_log(LOG_WARNING, "Cannot set substate to SUBSTATE_RINGOUT from %s (on call-%d)\n", substate2str(sub->substate), sub->callid);
 			return;
 		}
+		if (sub->substate != SUBSTATE_PROGRESS) {
+			transmit_callstate(d, l->instance, sub->callid, SKINNY_PROGRESS);
+		}
 
 		if (!d->earlyrtp) {
 			transmit_start_tone(d, SKINNY_ALERT, l->instance, sub->callid);
@@ -5308,6 +5292,9 @@
 		sub->substate = SUBSTATE_CALLWAIT;
 		break;
 	case SUBSTATE_CONNECTED:
+		if (sub->substate == SUBSTATE_RINGIN) {
+			transmit_callstate(d, l->instance, sub->callid, SKINNY_OFFHOOK);
+		}
 		if (sub->substate == SUBSTATE_HOLD) {
 			ast_queue_control(sub->owner, AST_CONTROL_UNHOLD);
 			transmit_connect(d, sub);
@@ -6865,15 +6852,21 @@
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&sessions, cur, list) {
 		if (cur == s) {
 			AST_LIST_REMOVE_CURRENT(list);
-			if (s->fd > -1)
+			if (s->fd > -1) {
 				close(s->fd);
-
-			if (!s->device)
-				ast_atomic_fetchadd_int(&unauth_sessions, -1);
+			}
+
+			if (s->device) {
+				s->device->session = NULL;
+			} else {
+ 				ast_atomic_fetchadd_int(&unauth_sessions, -1);
+			}
 
 			ast_mutex_destroy(&s->lock);
 
 			ast_free(s);
+
+			break;
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END
@@ -7011,21 +7004,22 @@
 		res = get_input(s);
 		if (res < 0) {
 			ast_verb(3, "Ending Skinny session from %s (bad input)\n", ast_inet_ntoa(s->sin.sin_addr));
-			break;
+			destroy_session(s);
+			return NULL;
 		}
 
 		if (res > 0)
 		{
 			if (!(req = skinny_req_parse(s))) {
+				ast_verb(3, "Ending Skinny session from %s (failed parse)\n", ast_inet_ntoa(s->sin.sin_addr));
 				destroy_session(s);
-				ast_verb(3, "Ending Skinny session from %s (failed parse)\n", ast_inet_ntoa(s->sin.sin_addr));
 				return NULL;
 			}
 
 			res = handle_message(req, s);
 			if (res < 0) {
+				ast_verb(3, "Ending Skinny session from %s\n", ast_inet_ntoa(s->sin.sin_addr));
 				destroy_session(s);
-				ast_verb(3, "Ending Skinny session from %s\n", ast_inet_ntoa(s->sin.sin_addr));
 				return NULL;
 			}
 		}

Modified: team/oej/bufo-manager-contexts-trunk/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/oej/bufo-manager-contexts-trunk/configure.ac?view=diff&rev=379995&r1=379994&r2=379995
==============================================================================
--- team/oej/bufo-manager-contexts-trunk/configure.ac (original)
+++ team/oej/bufo-manager-contexts-trunk/configure.ac Wed Jan 23 02:01:27 2013
@@ -597,7 +597,7 @@
 # so that AC_CHECK_FUNCS can detect functions in that library.
 AC_CHECK_LIB([m], [sqrt])
 # BSD might not have exp2, and/or log2
-AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round trunc floor ceil])
+AC_CHECK_FUNCS([exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round roundf trunc floor ceil])
 
 # Certain architectures don't really have long double, even though
 # AC_CHECK_FUNCS would otherwise find the following functions.
@@ -1053,6 +1053,27 @@
 	[AST_NESTED_FUNCTIONS=-fnested-functions]
 )
 AC_SUBST(AST_NESTED_FUNCTIONS)
+
+dnl Check to see if rpath should be set in LDFLAGS
+AC_ARG_ENABLE(rpath,
+	[AC_HELP_STRING([--disable-rpath],
+			[Disables rpath linker option checking])],
+	[case "${enableval}" in
+		y|ye|yes) check_rpath=yes ;;
+		n|no) check_rpath=no ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --disable-rpath) ;;
+	esac], [check_rpath=yes])
+
+AC_MSG_CHECKING(whether to use rpath)
+AST_RPATH=
+if test "${check_rpath}" != yes; then
+	AC_MSG_RESULT(skipped)
+elif test "${prefix}" = /usr || test "${prefix}" = NONE; then
+	AC_MSG_RESULT(not needed)
+else
+	AST_RPATH="-Wl,-rpath,${libdir}"
+fi
+AC_SUBST(AST_RPATH)
 
 AC_MSG_CHECKING(for sysinfo)
 AC_LINK_IFELSE(




More information about the asterisk-commits mailing list