[asterisk-commits] murf: branch murf/bug8684-trunk r81352 - in /team/murf/bug8684-trunk: ./ apps...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 29 13:12:42 CDT 2007


Author: murf
Date: Wed Aug 29 13:12:42 2007
New Revision: 81352

URL: http://svn.digium.com/view/asterisk?view=rev&rev=81352
Log:
Merged revisions 81326,81332-81335,81341,81343-81345,81347-81348,81350 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r81326 | file | 2007-08-28 20:21:08 -0600 (Tue, 28 Aug 2007) | 2 lines

Add inline function for signed linear subtraction.

................
r81332 | file | 2007-08-29 08:16:07 -0600 (Wed, 29 Aug 2007) | 12 lines

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

........
r81331 | file | 2007-08-29 11:13:55 -0300 (Wed, 29 Aug 2007) | 4 lines

(closes issue #9690)
Reported by: mattv
Make rtp timeouts work even if two RTP streams are directly bridged in the RTP stack.

........

................
r81333 | mmichelson | 2007-08-29 08:19:33 -0600 (Wed, 29 Aug 2007) | 5 lines

Changing a NOTICE to a DEBUG.

(closes issue #10591, reported and patched by junky, with small modification by me)


................
r81334 | file | 2007-08-29 09:19:11 -0600 (Wed, 29 Aug 2007) | 2 lines

Add API calls for iterating through an event. This should allow events to have multiple information elements (while there was nothing preventing it before you could not actually access any except the first one).

................
r81335 | tilghman | 2007-08-29 09:21:10 -0600 (Wed, 29 Aug 2007) | 2 lines

Changed one too many variable settings in issue #9315 (closes issue #10592)

................
r81341 | mmichelson | 2007-08-29 09:57:27 -0600 (Wed, 29 Aug 2007) | 16 lines

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

........
r81340 | mmichelson | 2007-08-29 10:52:42 -0500 (Wed, 29 Aug 2007) | 8 lines

This fix creates a more accurate way of detecting whether realtime members were deleted.
(closes issue 10541, reported by Alric, patched by me)

The REALLY nice things about this patch is that queue members now have a "realtime" field
which will be true if the member is a realtime member. This means we can check this value
prior to certain processing if it should ONLY be done for realtime members.


........

................
r81343 | russell | 2007-08-29 09:59:10 -0600 (Wed, 29 Aug 2007) | 11 lines

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

........
r81342 | russell | 2007-08-29 10:57:29 -0500 (Wed, 29 Aug 2007) | 3 lines

If chan_h323 is not being built, don't use g++ to do the final link of Asterisk.
(in response to a question on the asterisk-dev list)

........

................
r81344 | file | 2007-08-29 10:03:51 -0600 (Wed, 29 Aug 2007) | 2 lines

To keep others happy... revert part of my additions so trunk works.

................
r81345 | file | 2007-08-29 10:07:35 -0600 (Wed, 29 Aug 2007) | 2 lines

This concludes bringing trunk back to a working state.

................
r81347 | mmichelson | 2007-08-29 10:09:02 -0600 (Wed, 29 Aug 2007) | 11 lines

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

........
r81346 | mmichelson | 2007-08-29 11:08:09 -0500 (Wed, 29 Aug 2007) | 3 lines

Changed some tabs to spaces


........

................
r81348 | file | 2007-08-29 10:25:30 -0600 (Wed, 29 Aug 2007) | 2 lines

Return ast_event_get_ie_raw to using an iterator and fix logic in ast_event_iterator_next.

................
r81350 | mmichelson | 2007-08-29 10:39:40 -0600 (Wed, 29 Aug 2007) | 20 lines

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

........
r81349 | mmichelson | 2007-08-29 11:35:29 -0500 (Wed, 29 Aug 2007) | 12 lines

This patch, in essence, will correctly pause a realtime queue member and reflect those
changes in the realtime engine.

(issue #10424, reported by irroot, patch by me)

This patch creates a new function called update_realtime_member_field, which is a generic
function which will allow any one field of a realtime queue member to be updated. This patch
only uses this function to update the paused status of a queue member, but it lays the foundation
for persisting the state of a realtime member the same way that static members' state is maintained
when using the persistentmembers setting


........

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

Modified:
    team/murf/bug8684-trunk/   (props changed)
    team/murf/bug8684-trunk/apps/app_meetme.c
    team/murf/bug8684-trunk/apps/app_queue.c
    team/murf/bug8684-trunk/channels/chan_iax2.c
    team/murf/bug8684-trunk/channels/chan_sip.c
    team/murf/bug8684-trunk/include/asterisk/event.h
    team/murf/bug8684-trunk/include/asterisk/event_defs.h
    team/murf/bug8684-trunk/include/asterisk/utils.h
    team/murf/bug8684-trunk/main/Makefile
    team/murf/bug8684-trunk/main/event.c

Propchange: team/murf/bug8684-trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/murf/bug8684-trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Aug 29 13:12:42 2007
@@ -1,1 +1,1 @@
-/trunk:1-81302
+/trunk:1-81351

Modified: team/murf/bug8684-trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8684-trunk/apps/app_meetme.c?view=diff&rev=81352&r1=81351&r2=81352
==============================================================================
--- team/murf/bug8684-trunk/apps/app_meetme.c (original)
+++ team/murf/bug8684-trunk/apps/app_meetme.c Wed Aug 29 13:12:42 2007
@@ -2420,7 +2420,7 @@
 	ast_log(LOG_NOTICE,"The requested confno is '%s'?\n", confno);
 	AST_LIST_LOCK(&confs);
 	AST_LIST_TRAVERSE(&confs, cnf, list) {
-		ast_log(LOG_NOTICE,"Does conf %s match %s?\n", confno, cnf->confno);
+		ast_debug(3,"Does conf %s match %s?\n", confno, cnf->confno);
 		if (!strcmp(confno, cnf->confno)) 
 			break;
 	}
@@ -2458,7 +2458,7 @@
 					return NULL;
 				
 				AST_STANDARD_APP_ARGS(args, parse);
-				ast_log(LOG_NOTICE,"Will conf %s match %s?\n", confno, args.confno);
+				ast_debug(3,"Will conf %s match %s?\n", confno, args.confno);
 				if (!strcasecmp(args.confno, confno)) {
 					/* Bingo it's a valid conference */
 					cnf = build_conf(args.confno,

Modified: team/murf/bug8684-trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8684-trunk/apps/app_queue.c?view=diff&rev=81352&r1=81351&r2=81352
==============================================================================
--- team/murf/bug8684-trunk/apps/app_queue.c (original)
+++ team/murf/bug8684-trunk/apps/app_queue.c Wed Aug 29 13:12:42 2007
@@ -318,6 +318,7 @@
 	int penalty;                        /*!< Are we a last resort? */
 	int calls;                          /*!< Number of calls serviced by this member */
 	int dynamic;                        /*!< Are we dynamically added? */
+	int realtime;                       /*!< Is this member realtime? */
 	int status;                         /*!< Status of queue member */
 	int paused;                         /*!< Are we paused (not accepting calls)? */
 	time_t lastcall;                    /*!< When last successful call was hungup */
@@ -1049,6 +1050,7 @@
 	if (!m) {
 		if ((m = create_queue_member(interface, membername, penalty, paused))) {
 			m->dead = 0;
+			m->realtime = 1;
 			add_to_interfaces(interface);
 			if (prev_m) {
 				prev_m->next = m;
@@ -1173,10 +1175,10 @@
 		queue_set_param(q, tmp_name, v->value, -1, 0);
 	}
 
-	/* Temporarily set non-dynamic members dead so we can detect deleted ones. 
+	/* Temporarily set realtime members dead so we can detect deleted ones. 
 	 * Also set the membercount correctly for realtime*/
 	for (m = q->members; m; m = m->next, q->membercount++) {
-		if (!m->dynamic)
+		if (m->realtime)
 			m->dead = 1;
 	}
 
@@ -1263,6 +1265,25 @@
 	return q;
 }
 
+static int update_realtime_member_field(struct member *mem, const char *queue_name, const char *field, const char *value)
+{
+	struct ast_variable *var;
+	int ret = -1;
+
+	if(!(var = ast_load_realtime("queue_members", "interface", mem->interface, "queue_name", queue_name, NULL))) 
+		return ret;
+	while (var) {
+		if(!strcmp(var->name, "uniqueid"))
+			break;
+		var = var->next;
+	}
+	if(var && !ast_strlen_zero(var->value)) {
+		if ((ast_update_realtime("queue_members", "uniqueid", var->value, field, value, NULL)) > -1)
+			ret = 0;
+	}
+	return ret;
+}
+
 static void update_realtime_members(struct call_queue *q)
 {
 	struct ast_config *member_config = NULL;
@@ -1278,9 +1299,9 @@
 
 	ast_mutex_lock(&q->lock);
 	
-	/* Temporarily set non-dynamic members dead so we can detect deleted ones.*/ 
+	/* Temporarily set realtime  members dead so we can detect deleted ones.*/ 
 	for (m = q->members; m; m = m->next) {
-		if (!m->dynamic)
+		if (m->realtime)
 			m->dead = 1;
 	}
 
@@ -3171,6 +3192,9 @@
 				if (queue_persistent_members)
 					dump_queue_members(q);
 
+				if(mem->realtime)
+					update_realtime_member_field(mem, queuename, "paused", paused ? "1" : "0");
+
 				ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", "");
 
 				manager_event(EVENT_FLAG_AGENT, "QueueMemberPaused",
@@ -4188,8 +4212,9 @@
 				ast_str_set(&out, 0, "      %s", mem->interface);
 				if (mem->penalty)
 					ast_str_append(&out, 0, " with penalty %d", mem->penalty);
-				ast_str_append(&out, 0, "%s%s (%s)",
+				ast_str_append(&out, 0, "%s%s%s (%s)",
 					mem->dynamic ? " (dynamic)" : "",
+					mem->realtime ? " (realtime)" : "",
 					mem->paused ? " (paused)" : "",
 					devstate2str(mem->status));
 				if (mem->calls)

Modified: team/murf/bug8684-trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8684-trunk/channels/chan_iax2.c?view=diff&rev=81352&r1=81351&r2=81352
==============================================================================
--- team/murf/bug8684-trunk/channels/chan_iax2.c (original)
+++ team/murf/bug8684-trunk/channels/chan_iax2.c Wed Aug 29 13:12:42 2007
@@ -3710,7 +3710,6 @@
 	struct ast_channel *tmp;
 	struct chan_iax2_pvt *i;
 	struct ast_variable *v = NULL;
-	struct ast_datastore *variablestore = NULL;
 
 	if (!(i = iaxs[callno])) {
 		ast_log(LOG_WARNING, "No IAX2 pvt found for callno '%d' !\n", callno);
@@ -3759,29 +3758,8 @@
 
 	/* Set inherited variables */
 	if (i->vars) {
-		AST_LIST_HEAD(, ast_var_t) *varlist;
-		varlist = ast_calloc(1, sizeof(*varlist));
-		variablestore = ast_channel_datastore_alloc(&iax2_variable_datastore_info, NULL);
-		if (variablestore && varlist) {
-			variablestore->data = varlist;
-			variablestore->inheritance = DATASTORE_INHERIT_FOREVER;
-			AST_LIST_HEAD_INIT(varlist);
-			for (v = i->vars ; v ; v = v->next) {
-				struct ast_var_t *newvar = ast_var_assign(v->name, v->value);
-				if (!newvar) {
-					ast_log(LOG_ERROR, "Out of memory\n");
-					break;
-				}
-				AST_LIST_INSERT_TAIL(varlist, newvar, entries);
-			}
-			ast_channel_datastore_add(tmp, variablestore);
-		} else {
-			ast_log(LOG_ERROR, "Out of memory\n");
-			if (variablestore)
-				ast_channel_datastore_free(variablestore);
-			if (varlist)
-				ast_free(varlist);
-		}
+		for (v = i->vars ; v ; v = v->next)
+			pbx_builtin_setvar_helper(tmp, v->name, v->value);
 	}
 
 	if (state != AST_STATE_DOWN) {

Modified: team/murf/bug8684-trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8684-trunk/channels/chan_sip.c?view=diff&rev=81352&r1=81351&r2=81352
==============================================================================
--- team/murf/bug8684-trunk/channels/chan_sip.c (original)
+++ team/murf/bug8684-trunk/channels/chan_sip.c Wed Aug 29 13:12:42 2007
@@ -16427,13 +16427,10 @@
 					usleep(1);
 					sip_pvt_lock(dialog);
 				}
-				if (!(ast_rtp_get_bridged(dialog->rtp))) {
-					ast_log(LOG_NOTICE, "Disconnecting call '%s' for lack of RTP activity in %ld seconds\n",
-						dialog->owner->name, (long) (t - dialog->lastrtprx));
-					/* Issue a softhangup */
-					ast_softhangup_nolock(dialog->owner, AST_SOFTHANGUP_DEV);
-				} else
-					ast_log(LOG_NOTICE, "'%s' will not be disconnected in %ld seconds because it is directly bridged to another RTP stream\n", dialog->owner->name, (long) (t - dialog->lastrtprx));
+				ast_log(LOG_NOTICE, "Disconnecting call '%s' for lack of RTP activity in %ld seconds\n",
+					dialog->owner->name, (long) (t - dialog->lastrtprx));
+				/* Issue a softhangup */
+				ast_softhangup_nolock(dialog->owner, AST_SOFTHANGUP_DEV);
 				ast_channel_unlock(dialog->owner);
 				/* forget the timeouts for this call, since a hangup
 				   has already been requested and we don't want to

Modified: team/murf/bug8684-trunk/include/asterisk/event.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8684-trunk/include/asterisk/event.h?view=diff&rev=81352&r1=81351&r2=81352
==============================================================================
--- team/murf/bug8684-trunk/include/asterisk/event.h (original)
+++ team/murf/bug8684-trunk/include/asterisk/event.h Wed Aug 29 13:12:42 2007
@@ -413,4 +413,61 @@
  */
 enum ast_event_type ast_event_get_type(const struct ast_event *event);
 
+/*!
+ * \brief Initialize an event iterator instance
+ *
+ * \param iterator The iterator instance to initialize
+ * \param event The event that will be iterated through
+ *
+ * \return Nothing
+ */
+void ast_event_iterator_init(struct ast_event_iterator *iterator, const struct ast_event *event);
+
+/*!
+ * \brief Move iterator instance to next IE
+ *
+ * \param iterator The iterator instance
+ *
+ * \retval 0 on success
+ * \retval -1 if end is reached
+ */
+int ast_event_iterator_next(struct ast_event_iterator *iterator);
+
+/*!
+ * \brief Get the type of the current IE in the iterator instance
+ *
+ * \param iterator The iterator instance
+ *
+ * \return the ie type as represented by one of the value sin the
+ *         ast_event_ie_type enum
+ */
+enum ast_event_ie_type ast_event_iterator_get_ie_type(struct ast_event_iterator *iterator);
+
+/*!
+ * \brief Get the value of the current IE in the ierator as an integer payload
+ *
+ * \param iterator The iterator instance
+ *
+ * \return This returns the payload of the information element as a uint.
+ */
+uint32_t ast_event_iterator_get_ie_uint(struct ast_event_iterator *iterator);
+
+/*!
+ * \brief Get the value of the current IE in the iterator as a string payload
+ *
+ * \param iterator The iterator instance
+ *
+ * \return This returns the payload of the information element as a string.
+ */
+const char *ast_event_iterator_get_ie_str(struct ast_event_iterator *iterator);
+
+/*!
+ * \brief Get the value of the current IE in the iterator instance that has a raw payload
+ *
+ * \param iterator The iterator instance
+ *
+ * \return This returns the payload of the information element as type raw.
+ */
+void *ast_event_iterator_get_ie_raw(struct ast_event_iterator *iterator);
+
 #endif /* AST_EVENT_H */

Modified: team/murf/bug8684-trunk/include/asterisk/event_defs.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8684-trunk/include/asterisk/event_defs.h?view=diff&rev=81352&r1=81351&r2=81352
==============================================================================
--- team/murf/bug8684-trunk/include/asterisk/event_defs.h (original)
+++ team/murf/bug8684-trunk/include/asterisk/event_defs.h Wed Aug 29 13:12:42 2007
@@ -138,5 +138,6 @@
 struct ast_event;
 struct ast_event_ie;
 struct ast_event_sub;
+struct ast_event_iterator;
 
 #endif /* AST_EVENT_DEFS_H */

Modified: team/murf/bug8684-trunk/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug8684-trunk/include/asterisk/utils.h?view=diff&rev=81352&r1=81351&r2=81352
==============================================================================
--- team/murf/bug8684-trunk/include/asterisk/utils.h (original)
+++ team/murf/bug8684-trunk/include/asterisk/utils.h Wed Aug 29 13:12:42 2007
@@ -276,6 +276,19 @@
 	int res;
 
 	res = (int) *input + *value;
+	if (res > 32767)
+		*input = 32767;
+	else if (res < -32767)
+		*input = -32767;
+	else
+		*input = (short) res;
+}
+
+static force_inline void ast_slinear_saturated_subtract(short *input, short *value)
+{
+	int res;
+
+	res = (int) *input - *value;
 	if (res > 32767)
 		*input = 32767;
 	else if (res < -32767)

Modified: team/murf/bug8684-trunk/main/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug8684-trunk/main/Makefile?view=diff&rev=81352&r1=81351&r2=81352
==============================================================================
--- team/murf/bug8684-trunk/main/Makefile (original)
+++ team/murf/bug8684-trunk/main/Makefile Wed Aug 29 13:12:42 2007
@@ -142,7 +142,11 @@
 asterisk: $(OBJS) editline/libedit.a db1-ast/libdb1.a minimime/libmmime.a $(AST_EMBED_LDSCRIPTS)
 	@$(CC) -c -o buildinfo.o $(ASTCFLAGS) buildinfo.c
 	$(ECHO_PREFIX) echo "   [LD] $^ -> $@"
+ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),)
+	$(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS)
+else
 	$(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $^ buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS)
+endif
 	@$(ASTTOPDIR)/build_tools/strip_nonapi $@
 
 clean::

Modified: team/murf/bug8684-trunk/main/event.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug8684-trunk/main/event.c?view=diff&rev=81352&r1=81351&r2=81352
==============================================================================
--- team/murf/bug8684-trunk/main/event.c (original)
+++ team/murf/bug8684-trunk/main/event.c Wed Aug 29 13:12:42 2007
@@ -66,6 +66,12 @@
 	AST_LIST_ENTRY(ast_event_ref) entry;
 };
 
+struct ast_event_iterator {
+	uint16_t event_len;
+	const struct ast_event *event;
+	struct ast_event_ie *ie;
+};
+
 /*! \brief data shared between event dispatching threads */
 static struct {
 	ast_cond_t cond;
@@ -355,6 +361,40 @@
 	ast_event_sub_destroy(sub);
 }
 
+void ast_event_iterator_init(struct ast_event_iterator *iterator, const struct ast_event *event)
+{
+	iterator->event_len = ntohs(event->event_len);
+	iterator->event = event;
+	iterator->ie = ((void *) event) + sizeof(*event);
+	return;
+}
+
+int ast_event_iterator_next(struct ast_event_iterator *iterator)
+{
+	iterator->ie = ((void *) iterator->ie) + sizeof(*iterator->ie) + ntohs(iterator->ie->ie_payload_len);
+	return ((iterator->event_len < (((void *) iterator->ie) - ((void *) iterator->event))) ? -1 : 0);
+}
+
+enum ast_event_ie_type ast_event_iterator_get_ie_type(struct ast_event_iterator *iterator)
+{
+	return iterator->ie->ie_type;
+}
+
+uint32_t ast_event_iterator_get_ie_uint(struct ast_event_iterator *iterator)
+{
+	return ntohl(*iterator->ie->ie_payload);
+}
+
+const char *ast_event_iterator_get_ie_str(struct ast_event_iterator *iterator)
+{
+	return (const char*)iterator->ie->ie_payload;
+}
+
+void *ast_event_iterator_get_ie_raw(struct ast_event_iterator *iterator)
+{
+	return iterator->ie->ie_payload;
+}
+
 enum ast_event_type ast_event_get_type(const struct ast_event *event)
 {
 	return ntohs(event->type);
@@ -376,18 +416,14 @@
 
 const void *ast_event_get_ie_raw(const struct ast_event *event, enum ast_event_ie_type ie_type)
 {
-	struct ast_event_ie *ie;
-	uint16_t event_len;
+	struct ast_event_iterator iterator;
+	int res = 0;
 
 	ie_type = ntohs(ie_type);
-	event_len = ntohs(event->event_len);
-
-	ie = ((void *) event) + sizeof(*event);
-
-	while ((((void *) ie) - ((void *) event)) < event_len) {
-		if (ie->ie_type == ie_type)
-			return ie->ie_payload;
-		ie = ((void *) ie) + sizeof(*ie) + ntohs(ie->ie_payload_len);
+
+	for (ast_event_iterator_init(&iterator, event); !res; res = ast_event_iterator_next(&iterator)) {
+		if (ast_event_iterator_get_ie_type(&iterator) == ie_type)
+			return ast_event_iterator_get_ie_raw(&iterator);
 	}
 
 	return NULL;




More information about the asterisk-commits mailing list