[asterisk-commits] murf: branch murf/bug6002 r105728 - in /team/murf/bug6002: ./ channels/ funcs...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 4 12:55:18 CST 2008


Author: murf
Date: Tue Mar  4 12:55:18 2008
New Revision: 105728

URL: http://svn.digium.com/view/asterisk?view=rev&rev=105728
Log:
Merged revisions 105558,105561,105564,105566,105569,105571,105573-105574,105589-105590,105592-105595,105597,105675,105677 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r105558 | file | 2008-03-03 08:16:57 -0700 (Mon, 03 Mar 2008) | 14 lines

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

........
r105557 | file | 2008-03-03 11:15:39 -0400 (Mon, 03 Mar 2008) | 6 lines

Add a comment to describe some logic.
(closes issue #12120)
Reported by: flefoll
Patches:
      chan_sip.c.br14.patch-just-a-comment uploaded by flefoll (license 244)

........

................
r105561 | file | 2008-03-03 08:30:29 -0700 (Mon, 03 Mar 2008) | 15 lines

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

........
r105560 | file | 2008-03-03 11:28:59 -0400 (Mon, 03 Mar 2008) | 7 lines

It is possible for no audio to pass between the current digit and next digit so expand logic that clears emulation to AST_FRAME_NULL.
(closes issue #11911)
Reported by: edgreenberg
Patches:
      v1-11911.patch uploaded by dimas (license 88)
Tested by: tbsky

........

................
r105564 | russell | 2008-03-03 08:59:50 -0700 (Mon, 03 Mar 2008) | 40 lines

3) In addition to merging the changes below, change trunk back to a regular
   LIST instead of an RWLIST.  The way this list works makes it such that
   a RWLIST provides no additional benefit.  Also, a mutex is needed for
   use with the thread condition.


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

........
r105563 | russell | 2008-03-03 09:50:43 -0600 (Mon, 03 Mar 2008) | 24 lines

Merge in some changes from team/russell/autoservice-nochans-1.4

These changes fix up some dubious code that I came across while auditing what
happens in the autoservice thread when there are no channels currently in
autoservice.

1) Change it so that autoservice thread doesn't keep looping around calling
   ast_waitfor_n() on 0 channels twice a second.  Instead, use a thread condition
   so that the thread properly goes to sleep and does not wake up until a
   channel is put into autoservice.

   This actually fixes an interesting bug, as well.  If the autoservice thread
   is already running (almost always is the case), then when the thread goes
   from having 0 channels to have 1 channel to autoservice, that channel would
   have to wait for up to 1/2 of a second to have the first frame read from it.

2) Fix up the code in ast_waitfor_nandfds() for when it gets called with no
   channels and no fds to poll() on, such as was the case with the previous code
   for the autoservice thread.  In this case, the code would call alloca(0), and
   pass the result as the first argument to poll().  In this case, the 2nd
   argument to poll() specified that there were no fds, so this invalid pointer
   shouldn't actually get dereferenced, but, this code makes it explicit and
   ensures the pointers are NULL unless we have valid data to put there.

(related to issue #12116)

........

................
r105566 | russell | 2008-03-03 09:02:19 -0700 (Mon, 03 Mar 2008) | 11 lines

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

........
r105565 | russell | 2008-03-03 10:01:50 -0600 (Mon, 03 Mar 2008) | 3 lines

Update the copyright information for autoservice.  Most of the code in this file
now is stuff that I have written recently ...

........

................
r105569 | russell | 2008-03-03 10:06:35 -0700 (Mon, 03 Mar 2008) | 11 lines

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

........
r105568 | russell | 2008-03-03 11:05:16 -0600 (Mon, 03 Mar 2008) | 3 lines

Fix a potential memory leak of the local_pvt struct when ast_channel allocation
fails.  Also, in passing, centralize the code necessary to destroy a local_pvt.

........

................
r105571 | russell | 2008-03-03 10:17:27 -0700 (Mon, 03 Mar 2008) | 11 lines

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

........
r105570 | russell | 2008-03-03 11:16:53 -0600 (Mon, 03 Mar 2008) | 3 lines

In the case of an ast_channel allocation failure, take the local_pvt out of the
pvt list before destroying it.

........

................
r105573 | qwell | 2008-03-03 11:08:05 -0700 (Mon, 03 Mar 2008) | 15 lines

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

........
r105572 | qwell | 2008-03-03 12:06:52 -0600 (Mon, 03 Mar 2008) | 7 lines

Fix types for astNumChannels and astConfigCallsProcessed.

(closes issue #12114)
Reported by: jeffg
Patches:
      12114.patch uploaded by jeffg (license 192)

........

................
r105574 | russell | 2008-03-03 11:49:34 -0700 (Mon, 03 Mar 2008) | 4 lines

Fix some code that was improperly changed in revision 104866 from issue #12079.

(closes issue #12129, reported by elguero, patched by me)

................
r105589 | russell | 2008-03-03 21:26:39 -0700 (Mon, 03 Mar 2008) | 3 lines

Use ast_copy_string() instead of strncpy(), and use sizeof() instead of
a magic number

................
r105590 | russell | 2008-03-03 21:28:48 -0700 (Mon, 03 Mar 2008) | 3 lines

 - Add curly braces around the while loop
 - Properly break out of the loop on error when an included context is not found

................
r105592 | russell | 2008-03-03 21:31:53 -0700 (Mon, 03 Mar 2008) | 11 lines

Blocked revisions 105591 via svnmerge

........
r105591 | russell | 2008-03-03 22:31:29 -0600 (Mon, 03 Mar 2008) | 4 lines

Backport a minor bug fix from trunk that I found while doing random code
cleanup.  Properly break out of the loop when a context isn't found when
verify that includes are valid.

........

................
r105593 | russell | 2008-03-03 21:44:28 -0700 (Mon, 03 Mar 2008) | 2 lines

remove unnecessary casts

................
r105594 | russell | 2008-03-03 21:47:32 -0700 (Mon, 03 Mar 2008) | 2 lines

Make it so you don't have to cast away const in a couple places

................
r105595 | russell | 2008-03-03 21:57:29 -0700 (Mon, 03 Mar 2008) | 2 lines

Simplify a trivial snprintf() with ast_copy_string()

................
r105597 | russell | 2008-03-04 09:55:17 -0700 (Tue, 04 Mar 2008) | 2 lines

Update CHANGES heading

................
r105675 | file | 2008-03-04 11:08:42 -0700 (Tue, 04 Mar 2008) | 16 lines

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

........
r105674 | file | 2008-03-04 14:05:28 -0400 (Tue, 04 Mar 2008) | 8 lines

When a new source of audio comes in (such as music on hold) make sure the marker bit gets set.
(closes issue #10355)
Reported by: wdecarne
Patches:
      10355.diff uploaded by file (license 11)
(closes issue #11491)
Reported by: kanderson

........

................
r105677 | file | 2008-03-04 11:11:38 -0700 (Tue, 04 Mar 2008) | 10 lines

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

........
r105676 | file | 2008-03-04 14:10:34 -0400 (Tue, 04 Mar 2008) | 2 lines

In addition to setting the marker bit let's change our ssrc so they know for sure it is a different source.

........

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

Modified:
    team/murf/bug6002/   (props changed)
    team/murf/bug6002/CHANGES
    team/murf/bug6002/channels/chan_local.c
    team/murf/bug6002/channels/chan_sip.c
    team/murf/bug6002/channels/chan_zap.c
    team/murf/bug6002/funcs/func_version.c
    team/murf/bug6002/include/asterisk/_private.h
    team/murf/bug6002/include/asterisk/rtp.h
    team/murf/bug6002/main/asterisk.c
    team/murf/bug6002/main/autoservice.c
    team/murf/bug6002/main/channel.c
    team/murf/bug6002/main/hashtab.c
    team/murf/bug6002/main/pbx.c
    team/murf/bug6002/main/rtp.c
    team/murf/bug6002/res/snmp/agent.c

Propchange: team/murf/bug6002/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

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

Propchange: team/murf/bug6002/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Mar  4 12:55:18 2008
@@ -1,1 +1,1 @@
-/trunk:1-105526
+/trunk:1-105727

Modified: team/murf/bug6002/CHANGES
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/CHANGES?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/CHANGES (original)
+++ team/murf/bug6002/CHANGES Tue Mar  4 12:55:18 2008
@@ -1,6 +1,12 @@
 ------------------------------------------------------------------------------
---- Functionality changes since Asterisk 1.4-beta was branched ----------------
--------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 1.6.0 to Asterisk 1.6.1  -------------
+------------------------------------------------------------------------------
+
+
+
+------------------------------------------------------------------------------
+--- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0  -------------
+------------------------------------------------------------------------------
 
 AMI - The manager (TCP/TLS/HTTP)
 --------------------------------

Modified: team/murf/bug6002/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/channels/chan_local.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/channels/chan_local.c (original)
+++ team/murf/bug6002/channels/chan_local.c Tue Mar  4 12:55:18 2008
@@ -157,6 +157,16 @@
 	return res;
 }
 
+/*!
+ * \note Assumes the pvt is no longer in the pvts list
+ */
+static struct local_pvt *local_pvt_destroy(struct local_pvt *pvt)
+{
+	ast_mutex_destroy(&pvt->lock);
+	ast_free(pvt);
+	return NULL;
+}
+
 static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us)
 {
 	struct ast_channel *other = NULL;
@@ -170,8 +180,7 @@
 		/* We had a glare on the hangup.  Forget all this business,
 		return and destroy p.  */
 		ast_mutex_unlock(&p->lock);
-		ast_mutex_destroy(&p->lock);
-		ast_free(p);
+		p = local_pvt_destroy(p);
 		return -1;
 	}
 	if (!other) {
@@ -548,8 +557,7 @@
 		ast_mutex_unlock(&p->lock);
 		/* And destroy */
 		if (!glaredetect) {
-			ast_mutex_destroy(&p->lock);
-			ast_free(p);
+			p = local_pvt_destroy(p);
 		}
 		return 0;
 	}
@@ -605,9 +613,7 @@
 
 	if (!ast_exists_extension(NULL, tmp->context, tmp->exten, 1, NULL)) {
 		ast_log(LOG_NOTICE, "No such extension/context %s@%s creating local channel\n", tmp->exten, tmp->context);
-		ast_mutex_destroy(&tmp->lock);
-		ast_free(tmp);
-		tmp = NULL;
+		tmp = local_pvt_destroy(tmp);
 	} else {
 		/* Add to list */
 		AST_LIST_LOCK(&locals);
@@ -682,7 +688,6 @@
 	return tmp;
 }
 
-
 /*! \brief Part of PBX interface */
 static struct ast_channel *local_request(const char *type, int format, void *data, int *cause)
 {
@@ -690,8 +695,14 @@
 	struct ast_channel *chan = NULL;
 
 	/* Allocate a new private structure and then Asterisk channel */
-	if ((p = local_alloc(data, format)))
-		chan = local_new(p, AST_STATE_DOWN);
+	if ((p = local_alloc(data, format))) {
+		if (!(chan = local_new(p, AST_STATE_DOWN))) {
+			AST_LIST_LOCK(&locals);
+			AST_LIST_REMOVE(&locals, p, list);
+			AST_LIST_UNLOCK(&locals);
+			p = local_pvt_destroy(p);
+		}
+	}
 
 	return chan;
 }

Modified: team/murf/bug6002/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/channels/chan_sip.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/channels/chan_sip.c (original)
+++ team/murf/bug6002/channels/chan_sip.c Tue Mar  4 12:55:18 2008
@@ -4825,8 +4825,10 @@
 		if (p->t38.state == T38_PEER_DIRECT) {
 			change_t38_state(p, T38_ENABLED);
 			res = transmit_response_with_t38_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL);
-		} else 
+		} else {
+			ast_rtp_new_source(p->rtp);
 			res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, FALSE);
+		}
 	}
 	sip_pvt_unlock(p);
 	return res;
@@ -4859,6 +4861,7 @@
 				if ((ast->_state != AST_STATE_UP) &&
 				    !ast_test_flag(&p->flags[0], SIP_PROGRESS_SENT) &&
 				    !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
+					ast_rtp_new_source(p->rtp);
 					transmit_response_with_sdp(p, "183 Session Progress", &p->initreq, XMIT_UNRELIABLE, FALSE);
 					ast_set_flag(&p->flags[0], SIP_PROGRESS_SENT);	
 				}
@@ -5096,9 +5099,11 @@
 		res = -1;
 		break;
 	case AST_CONTROL_HOLD:
+		ast_rtp_new_source(p->rtp);
 		ast_moh_start(ast, data, p->mohinterpret);
 		break;
 	case AST_CONTROL_UNHOLD:
+		ast_rtp_new_source(p->rtp);
 		ast_moh_stop(ast);
 		break;
 	case AST_CONTROL_VIDUPDATE:	/* Request a video frame update */
@@ -19383,6 +19388,7 @@
 	strcpy(user->language, default_language);
 	strcpy(user->mohinterpret, default_mohinterpret);
 	strcpy(user->mohsuggest, default_mohsuggest);
+	/* First we walk through the v parameters list and then the alt parameters list */
 	for (; v || ((v = alt) && !(alt=NULL)); v = v->next) {
 		if (handle_common_options(&userflags[0], &mask[0], v))
 			continue;

Modified: team/murf/bug6002/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/channels/chan_zap.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/channels/chan_zap.c (original)
+++ team/murf/bug6002/channels/chan_zap.c Tue Mar  4 12:55:18 2008
@@ -1148,7 +1148,7 @@
 {
 	ZT_BUFFERINFO bi;
 	int res;
-	if (p->subs[x].zfd < 0) {
+	if (p->subs[x].zfd >= 0) {
 		ast_log(LOG_WARNING, "%s subchannel of %d already in use\n", subnames[x], p->channel);
 		return -1;
 	}

Modified: team/murf/bug6002/funcs/func_version.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/funcs/func_version.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/funcs/func_version.c (original)
+++ team/murf/bug6002/funcs/func_version.c Tue Mar  4 12:55:18 2008
@@ -63,7 +63,7 @@
 
 	ast_debug(1, "VERSION returns %s result, given %s argument\n", response_char, args.info);
 
-	snprintf(buffer, buflen, "%s", response_char);
+	ast_copy_string(buffer, response_char, buflen);
 
 	return 0;
 }

Modified: team/murf/bug6002/include/asterisk/_private.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/include/asterisk/_private.h?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/include/asterisk/_private.h (original)
+++ team/murf/bug6002/include/asterisk/_private.h Tue Mar  4 12:55:18 2008
@@ -33,6 +33,7 @@
 int astobj2_init(void);			/*!< Provided by astobj2.c */
 int ast_file_init(void);		/*!< Provided by file.c */
 int ast_features_init(void);            /*!< Provided by features.c */
+void ast_autoservice_init(void);    /*!< Provided by autoservice.c */
 
 /*!
  * \brief Reload asterisk modules.

Modified: team/murf/bug6002/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/include/asterisk/rtp.h?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/include/asterisk/rtp.h (original)
+++ team/murf/bug6002/include/asterisk/rtp.h Tue Mar  4 12:55:18 2008
@@ -170,6 +170,8 @@
 
 int ast_rtp_setqos(struct ast_rtp *rtp, int tos, int cos, char *desc);
 
+void ast_rtp_new_source(struct ast_rtp *rtp);
+
 /*! \brief  Setting RTP payload types from lines in a SDP description: */
 void ast_rtp_pt_clear(struct ast_rtp* rtp);
 /*! \brief Set payload types to defaults */

Modified: team/murf/bug6002/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/main/asterisk.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/main/asterisk.c (original)
+++ team/murf/bug6002/main/asterisk.c Tue Mar  4 12:55:18 2008
@@ -3186,6 +3186,8 @@
 
 	astobj2_init();
 
+	ast_autoservice_init();
+
 	if (load_modules(1)) {		/* Load modules, pre-load only */
 		printf(term_quit());
 		exit(1);

Modified: team/murf/bug6002/main/autoservice.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/main/autoservice.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/main/autoservice.c (original)
+++ team/murf/bug6002/main/autoservice.c Tue Mar  4 12:55:18 2008
@@ -1,9 +1,10 @@
 /*
  * Asterisk -- An open source telephony toolkit.
  *
- * Copyright (C) 1999 - 2006, Digium, Inc.
+ * Copyright (C) 1999 - 2008, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
+ * Russell Bryant <russell at digium.com>
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
@@ -21,6 +22,7 @@
  * \brief Automatic channel service routines
  *
  * \author Mark Spencer <markster at digium.com> 
+ * \author Russell Bryant <russell at digium.com>
  */
 
 #include "asterisk.h"
@@ -29,6 +31,8 @@
 
 #include <sys/time.h>
 #include <signal.h>
+
+#include "asterisk/_private.h" /* prototype for ast_autoservice_init() */
 
 #include "asterisk/pbx.h"
 #include "asterisk/frame.h"
@@ -56,7 +60,8 @@
 	AST_LIST_ENTRY(asent) list;
 };
 
-static AST_RWLIST_HEAD_STATIC(aslist, asent);
+static AST_LIST_HEAD_STATIC(aslist, asent);
+static ast_cond_t as_cond;
 
 static pthread_t asthread = AST_PTHREADT_NULL;
 
@@ -67,14 +72,14 @@
 	struct ast_frame *dup_f;
 	struct asent *as;
 
-	AST_RWLIST_WRLOCK(&aslist);
-	AST_RWLIST_TRAVERSE(&aslist, as, list) {
+	AST_LIST_LOCK(&aslist);
+	AST_LIST_TRAVERSE(&aslist, as, list) {
 		if (as->chan != chan)
 			continue;
 		if ((dup_f = ast_frdup(f)))
 			AST_LIST_INSERT_TAIL(&as->dtmf_frames, dup_f, frame_list);
 	}
-	AST_RWLIST_UNLOCK(&aslist);
+	AST_LIST_UNLOCK(&aslist);
 }
 
 static void *autoservice_run(void *ign)
@@ -84,13 +89,16 @@
 		struct asent *as;
 		int x = 0, ms = 500;
 
-		AST_RWLIST_RDLOCK(&aslist);
+		AST_LIST_LOCK(&aslist);
 
 		/* At this point, we know that no channels that have been removed are going
 		 * to get used again. */
 		as_chan_list_state++;
 
-		AST_RWLIST_TRAVERSE(&aslist, as, list) {
+		if (AST_LIST_EMPTY(&aslist))
+			ast_cond_wait(&as_cond, &aslist.lock);
+
+		AST_LIST_TRAVERSE(&aslist, as, list) {
 			if (!ast_check_hangup(as->chan)) {
 				if (x < MAX_AUTOMONS)
 					mons[x++] = as->chan;
@@ -98,7 +106,8 @@
 					ast_log(LOG_WARNING, "Exceeded maximum number of automatic monitoring events.  Fix autoservice.c\n");
 			}
 		}
-		AST_RWLIST_UNLOCK(&aslist);
+
+		AST_LIST_UNLOCK(&aslist);
 
 		if ((chan = ast_waitfor_n(mons, x, &ms))) {
 			struct ast_frame *f = ast_read(chan);
@@ -158,14 +167,14 @@
 	int res = 0;
 	struct asent *as;
 
-	AST_RWLIST_WRLOCK(&aslist);
-	AST_RWLIST_TRAVERSE(&aslist, as, list) {
+	AST_LIST_LOCK(&aslist);
+	AST_LIST_TRAVERSE(&aslist, as, list) {
 		if (as->chan == chan) {
 			as->use_count++;
 			break;
 		}
 	}
-	AST_RWLIST_UNLOCK(&aslist);
+	AST_LIST_UNLOCK(&aslist);
 
 	if (as) {
 		/* Entry exists, autoservice is already handling this channel */
@@ -185,18 +194,20 @@
 		ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY);
 	ast_channel_unlock(chan);
 
-	AST_RWLIST_WRLOCK(&aslist);
-	AST_RWLIST_INSERT_HEAD(&aslist, as, list);
-	AST_RWLIST_UNLOCK(&aslist);
+	AST_LIST_LOCK(&aslist);
+	if (AST_LIST_EMPTY(&aslist))
+		ast_cond_signal(&as_cond);
+	AST_LIST_INSERT_HEAD(&aslist, as, list);
+	AST_LIST_UNLOCK(&aslist);
 
 	if (asthread == AST_PTHREADT_NULL) { /* need start the thread */
 		if (ast_pthread_create_background(&asthread, NULL, autoservice_run, NULL)) {
 			ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
 			/* There will only be a single member in the list at this point,
 			   the one we just added. */
-			AST_RWLIST_WRLOCK(&aslist);
-			AST_RWLIST_REMOVE(&aslist, as, list);
-			AST_RWLIST_UNLOCK(&aslist);
+			AST_LIST_LOCK(&aslist);
+			AST_LIST_REMOVE(&aslist, as, list);
+			AST_LIST_UNLOCK(&aslist);
 			free(as);
 			res = -1;
 		} else
@@ -218,7 +229,7 @@
 
 	AST_LIST_HEAD_INIT_NOLOCK(&dtmf_frames);
 
-	AST_RWLIST_WRLOCK(&aslist);
+	AST_LIST_LOCK(&aslist);
 
 	/* Save the autoservice channel list state.  We _must_ verify that the channel
 	 * list has been rebuilt before we return.  Because, after we return, the channel
@@ -226,9 +237,9 @@
 	 * it after its gone! */
 	chan_list_state = as_chan_list_state;
 
-	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&aslist, as, list) {	
+	AST_LIST_TRAVERSE_SAFE_BEGIN(&aslist, as, list) {	
 		if (as->chan == chan) {
-			AST_RWLIST_REMOVE_CURRENT(list);
+			AST_LIST_REMOVE_CURRENT(list);
 			as->use_count--;
 			if (as->use_count)
 				break;
@@ -241,12 +252,12 @@
 			break;
 		}
 	}
-	AST_RWLIST_TRAVERSE_SAFE_END;
+	AST_LIST_TRAVERSE_SAFE_END;
 
 	if (removed && asthread != AST_PTHREADT_NULL) 
 		pthread_kill(asthread, SIGURG);
 	
-	AST_RWLIST_UNLOCK(&aslist);
+	AST_LIST_UNLOCK(&aslist);
 
 	if (!removed)
 		return 0;
@@ -268,3 +279,8 @@
 
 	return res;
 }
+
+void ast_autoservice_init(void)
+{
+	ast_cond_init(&as_cond, NULL);
+}

Modified: team/murf/bug6002/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/main/channel.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/main/channel.c (original)
+++ team/murf/bug6002/main/channel.c Tue Mar  4 12:55:18 2008
@@ -1771,7 +1771,7 @@
 #endif
 {
 	struct timeval start = { 0 , 0 };
-	struct pollfd *pfds;
+	struct pollfd *pfds = NULL;
 	int res;
 	long rms;
 	int x, y, max;
@@ -1782,11 +1782,12 @@
 	struct fdmap {
 		int chan;
 		int fdno;
-	} *fdmap;
-
-	sz = n * AST_MAX_FDS + nfds;
-	pfds = alloca(sizeof(*pfds) * sz);
-	fdmap = alloca(sizeof(*fdmap) * sz);
+	} *fdmap = NULL;
+
+	if ((sz = n * AST_MAX_FDS + nfds)) {
+		pfds = alloca(sizeof(*pfds) * sz);
+		fdmap = alloca(sizeof(*fdmap) * sz);
+	}
 
 	if (outfd)
 		*outfd = -99999;
@@ -2537,9 +2538,16 @@
 			}
 			break;
 		case AST_FRAME_NULL:
+			/* The EMULATE_DTMF flag must be cleared here as opposed to when the duration
+			 * is reached , because we want to make sure we pass at least one
+			 * voice frame through before starting the next digit, to ensure a gap
+			 * between DTMF digits. */
 			if (ast_test_flag(chan, AST_FLAG_EMULATE_DTMF)) {
 				struct timeval now = ast_tvnow();
-				if (ast_tvdiff_ms(now, chan->dtmf_tv) >= chan->emulate_dtmf_duration) {
+				if (!chan->emulate_dtmf_duration) {
+					ast_clear_flag(chan, AST_FLAG_EMULATE_DTMF);
+					chan->emulate_dtmf_digit = 0;
+				} else if (ast_tvdiff_ms(now, chan->dtmf_tv) >= chan->emulate_dtmf_duration) {
 					chan->emulate_dtmf_duration = 0;
 					ast_frfree(f);
 					f = &chan->dtmff;

Modified: team/murf/bug6002/main/hashtab.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/main/hashtab.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/main/hashtab.c (original)
+++ team/murf/bug6002/main/hashtab.c Tue Mar  4 12:55:18 2008
@@ -45,12 +45,12 @@
 
 int ast_hashtab_compare_strings(const void *a, const void *b)
 {
-	return strcmp((char*)a,(char*)b);
+	return strcmp(a, b);
 }
 
 int ast_hashtab_compare_strings_nocase(const void *a, const void *b)
 {
-	return strcasecmp((const char*)a,(const char*)b);
+	return strcasecmp(a, b);
 }
 
 int ast_hashtab_compare_ints(const void *a, const void *b)
@@ -165,7 +165,7 @@
 
 unsigned int ast_hashtab_hash_string_sax(const void *obj) /* from Josh */
 {
-	unsigned char *str = (unsigned char *) obj;
+	const unsigned char *str = obj;
 	unsigned int total = 0, c = 0;
 
 	while ((c = *str++))
@@ -176,7 +176,7 @@
 
 unsigned int ast_hashtab_hash_string_nocase(const void *obj)
 {
-	unsigned char *str = (unsigned char*)obj;
+	const unsigned char *str = obj;
 	unsigned int total;
 
 	for (total = 0; *str; str++) {

Modified: team/murf/bug6002/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/main/pbx.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/main/pbx.c (original)
+++ team/murf/bug6002/main/pbx.c Tue Mar  4 12:55:18 2008
@@ -3627,7 +3627,9 @@
 {
 	struct ast_context *c = NULL;
 	struct fake_context item;
-	strncpy(item.name, context, 256);
+
+	ast_copy_string(item.name, context, sizeof(item.name));
+
 	ast_rdlock_contexts();
 	c = ast_hashtab_lookup(contexts_table,&item);
 
@@ -7919,12 +7921,16 @@
 	struct ast_include *inc = NULL;
 	int res = 0;
 
-	while ( (inc = ast_walk_context_includes(con, inc)) )
-		if (!ast_context_find(inc->rname)) {
-			res = -1;
-			ast_log(LOG_WARNING, "Context '%s' tries to include nonexistent context '%s'\n",
-					ast_get_context_name(con), inc->rname);
-		}
+	while ( (inc = ast_walk_context_includes(con, inc)) ) {
+		if (ast_context_find(inc->rname))
+			continue;
+
+		res = -1;
+		ast_log(LOG_WARNING, "Context '%s' tries to include nonexistent context '%s'\n",
+			ast_get_context_name(con), inc->rname);
+		break;
+	}
+
 	return res;
 }
 

Modified: team/murf/bug6002/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/main/rtp.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/main/rtp.c (original)
+++ team/murf/bug6002/main/rtp.c Tue Mar  4 12:55:18 2008
@@ -175,6 +175,8 @@
 
 	enum strict_rtp_state strict_rtp_state; /*!< Current state that strict RTP protection is in */
 	struct sockaddr_in strict_rtp_address;  /*!< Remote address information for strict RTP purposes */
+
+	int set_marker_bit:1;           /*!< Whether to set the marker bit or not */
 };
 
 /* Forward declarations */
@@ -2324,6 +2326,13 @@
 	return ast_netsock_set_qos(rtp->s, tos, cos, desc);
 }
 
+void ast_rtp_new_source(struct ast_rtp *rtp)
+{
+	rtp->set_marker_bit = 1;
+	rtp->ssrc = ast_random();
+	return;
+}
+
 void ast_rtp_set_peer(struct ast_rtp *rtp, struct sockaddr_in *them)
 {
 	rtp->them.sin_port = them->sin_port;
@@ -3036,6 +3045,13 @@
 			}
 		}
 	}
+
+	/* If we have been explicitly told to set the marker bit do so */
+	if (rtp->set_marker_bit) {
+		mark = 1;
+		rtp->set_marker_bit = 0;
+	}
+
 	/* If the timestamp for non-digit packets has moved beyond the timestamp
 	   for digits, update the digit timestamp.
 	*/

Modified: team/murf/bug6002/res/snmp/agent.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug6002/res/snmp/agent.c?view=diff&rev=105728&r1=105727&r2=105728
==============================================================================
--- team/murf/bug6002/res/snmp/agent.c (original)
+++ team/murf/bug6002/res/snmp/agent.c Tue Mar  4 12:55:18 2008
@@ -761,7 +761,7 @@
 		{ASTCONFPID,             ASN_INTEGER,   RONLY, ast_var_Config,              2, {ASTCONFIGURATION, ASTCONFPID}},
 		{ASTCONFSOCKET,          ASN_OCTET_STR, RONLY, ast_var_Config,              2, {ASTCONFIGURATION, ASTCONFSOCKET}},
 		{ASTCONFACTIVECALLS,     ASN_GAUGE,   	RONLY, ast_var_Config,              2, {ASTCONFIGURATION, ASTCONFACTIVECALLS}},
-		{ASTCONFPROCESSEDCALLS,  ASN_INTEGER,   RONLY, ast_var_Config,              2, {ASTCONFIGURATION, ASTCONFPROCESSEDCALLS}},
+		{ASTCONFPROCESSEDCALLS,  ASN_COUNTER,   RONLY, ast_var_Config,              2, {ASTCONFIGURATION, ASTCONFPROCESSEDCALLS}},
 		{ASTMODCOUNT,            ASN_INTEGER,   RONLY, ast_var_Modules ,            2, {ASTMODULES, ASTMODCOUNT}},
 		{ASTINDCOUNT,            ASN_INTEGER,   RONLY, ast_var_indications,         2, {ASTINDICATIONS, ASTINDCOUNT}},
 		{ASTINDCURRENT,          ASN_OCTET_STR, RONLY, ast_var_indications,         2, {ASTINDICATIONS, ASTINDCURRENT}},
@@ -769,7 +769,7 @@
 		{ASTINDCOUNTRY,          ASN_OCTET_STR, RONLY, ast_var_indications_table,   4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDCOUNTRY}},
 		{ASTINDALIAS,            ASN_OCTET_STR, RONLY, ast_var_indications_table,   4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDALIAS}},
 		{ASTINDDESCRIPTION,      ASN_OCTET_STR, RONLY, ast_var_indications_table,   4, {ASTINDICATIONS, ASTINDTABLE, 1, ASTINDDESCRIPTION}},
-		{ASTCHANCOUNT,           ASN_INTEGER,   RONLY, ast_var_channels,            2, {ASTCHANNELS, ASTCHANCOUNT}},
+		{ASTCHANCOUNT,           ASN_GAUGE,     RONLY, ast_var_channels,            2, {ASTCHANNELS, ASTCHANCOUNT}},
 		{ASTCHANINDEX,           ASN_INTEGER,   RONLY, ast_var_channels_table,      4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANINDEX}},
 		{ASTCHANNAME,            ASN_OCTET_STR, RONLY, ast_var_channels_table,      4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANNAME}},
 		{ASTCHANLANGUAGE,        ASN_OCTET_STR, RONLY, ast_var_channels_table,      4, {ASTCHANNELS, ASTCHANTABLE, 1, ASTCHANLANGUAGE}},




More information about the asterisk-commits mailing list