[svn-commits] kpfleming: branch mnicholson/new-v21-detect r349229 - in /team/mnicholson/new...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Dec 27 15:26:45 CST 2011


Author: kpfleming
Date: Tue Dec 27 15:26:33 2011
New Revision: 349229

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=349229
Log:
Bring up to date with Asterisk 10 release branch.

Modified:
    team/mnicholson/new-v21-detect/   (props changed)
    team/mnicholson/new-v21-detect/apps/app_authenticate.c
    team/mnicholson/new-v21-detect/apps/app_chanspy.c
    team/mnicholson/new-v21-detect/apps/app_confbridge.c
    team/mnicholson/new-v21-detect/apps/app_dial.c
    team/mnicholson/new-v21-detect/apps/app_followme.c
    team/mnicholson/new-v21-detect/apps/app_originate.c
    team/mnicholson/new-v21-detect/apps/app_parkandannounce.c
    team/mnicholson/new-v21-detect/apps/app_queue.c
    team/mnicholson/new-v21-detect/apps/confbridge/   (props changed)
    team/mnicholson/new-v21-detect/cel/cel_pgsql.c
    team/mnicholson/new-v21-detect/channels/chan_iax2.c
    team/mnicholson/new-v21-detect/channels/chan_sip.c
    team/mnicholson/new-v21-detect/codecs/speex/   (props changed)
    team/mnicholson/new-v21-detect/configs/features.conf.sample
    team/mnicholson/new-v21-detect/configs/sip.conf.sample
    team/mnicholson/new-v21-detect/configure
    team/mnicholson/new-v21-detect/configure.ac
    team/mnicholson/new-v21-detect/funcs/func_cdr.c
    team/mnicholson/new-v21-detect/include/asterisk/cdr.h
    team/mnicholson/new-v21-detect/include/asterisk/format_pref.h
    team/mnicholson/new-v21-detect/include/asterisk/module.h
    team/mnicholson/new-v21-detect/include/asterisk/pbx.h
    team/mnicholson/new-v21-detect/main/app.c
    team/mnicholson/new-v21-detect/main/audiohook.c
    team/mnicholson/new-v21-detect/main/bridging.c
    team/mnicholson/new-v21-detect/main/channel.c
    team/mnicholson/new-v21-detect/main/features.c
    team/mnicholson/new-v21-detect/main/file.c
    team/mnicholson/new-v21-detect/main/message.c
    team/mnicholson/new-v21-detect/main/pbx.c
    team/mnicholson/new-v21-detect/main/say.c
    team/mnicholson/new-v21-detect/res/res_fax.c
    team/mnicholson/new-v21-detect/res/res_monitor.c
    team/mnicholson/new-v21-detect/res/res_musiconhold.c
    team/mnicholson/new-v21-detect/res/res_timing_dahdi.c
    team/mnicholson/new-v21-detect/res/res_timing_pthread.c
    team/mnicholson/new-v21-detect/res/res_timing_timerfd.c

Propchange: team/mnicholson/new-v21-detect/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Propchange: team/mnicholson/new-v21-detect/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Dec 27 15:26:33 2011
@@ -1,1 +1,1 @@
-/branches/10:1-348152
+/branches/10:1-349226

Modified: team/mnicholson/new-v21-detect/apps/app_authenticate.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/apps/app_authenticate.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/apps/app_authenticate.c (original)
+++ team/mnicholson/new-v21-detect/apps/app_authenticate.c Tue Dec 27 15:26:33 2011
@@ -213,14 +213,20 @@
 						continue;
 					ast_md5_hash(md5passwd, passwd);
 					if (!strcmp(md5passwd, md5secret)) {
-						if (ast_test_flag(&flags,OPT_ACCOUNT))
+						if (ast_test_flag(&flags,OPT_ACCOUNT)) {
+							ast_channel_lock(chan);
 							ast_cdr_setaccount(chan, buf);
+							ast_channel_unlock(chan);
+						}
 						break;
 					}
 				} else {
 					if (!strcmp(passwd, buf)) {
-						if (ast_test_flag(&flags, OPT_ACCOUNT))
+						if (ast_test_flag(&flags, OPT_ACCOUNT)) {
+							ast_channel_lock(chan);
 							ast_cdr_setaccount(chan, buf);
+							ast_channel_unlock(chan);
+						}
 						break;
 					}
 				}
@@ -242,8 +248,11 @@
 	}
 
 	if ((retries < 3) && !res) {
-		if (ast_test_flag(&flags,OPT_ACCOUNT) && !ast_test_flag(&flags,OPT_MULTIPLE))
+		if (ast_test_flag(&flags,OPT_ACCOUNT) && !ast_test_flag(&flags,OPT_MULTIPLE)) {
+			ast_channel_lock(chan);
 			ast_cdr_setaccount(chan, passwd);
+			ast_channel_unlock(chan);
+		}
 		if (!(res = ast_streamfile(chan, "auth-thankyou", chan->language)))
 			res = ast_waitstream(chan, "");
 	} else {

Modified: team/mnicholson/new-v21-detect/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/apps/app_chanspy.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/apps/app_chanspy.c (original)
+++ team/mnicholson/new-v21-detect/apps/app_chanspy.c Tue Dec 27 15:26:33 2011
@@ -546,6 +546,9 @@
 	memset(&csth, 0, sizeof(csth));
 	ast_copy_flags(&csth.flags, flags, AST_FLAGS_ALL);
 
+	/* This is the audiohook which gives us the audio off the channel we are
+	   spying on.
+	*/
 	ast_audiohook_init(&csth.spy_audiohook, AST_AUDIOHOOK_TYPE_SPY, "ChanSpy", 0);
 
 	if (start_spying(spyee_autochan, spyer_name, &csth.spy_audiohook)) {
@@ -553,17 +556,30 @@
 		return 0;
 	}
 
-	ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy", 0);
-	ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy", 0);
-	if (start_spying(spyee_autochan, spyer_name, &csth.whisper_audiohook)) {
-		ast_log(LOG_WARNING, "Unable to attach whisper audiohook to spyee %s. Whisper mode disabled!\n", name);
-	}
-	if ((spyee_bridge_autochan = ast_autochan_setup(ast_bridged_channel(spyee_autochan->chan)))) {
-		ast_channel_lock(spyee_bridge_autochan->chan);
-		if (start_spying(spyee_bridge_autochan, spyer_name, &csth.bridge_whisper_audiohook)) {
-			ast_log(LOG_WARNING, "Unable to attach barge audiohook on spyee %s. Barge mode disabled!\n", name);
-		}
-		ast_channel_unlock(spyee_bridge_autochan->chan);
+	if (ast_test_flag(flags, OPTION_WHISPER | OPTION_BARGE | OPTION_DTMF_SWITCH_MODES)) {
+		/* This audiohook will let us inject audio from our channel into the
+		   channel we are currently spying on.
+		*/
+		ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy", 0);
+
+		if (start_spying(spyee_autochan, spyer_name, &csth.whisper_audiohook)) {
+			ast_log(LOG_WARNING, "Unable to attach whisper audiohook to spyee %s. Whisper mode disabled!\n", name);
+		}
+	}
+
+	if (ast_test_flag(flags, OPTION_BARGE | OPTION_DTMF_SWITCH_MODES)) {
+		/* And this hook lets us inject audio into the channel that the spied on
+		   channel is currently bridged with.
+		*/
+		ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy", 0);
+
+		if ((spyee_bridge_autochan = ast_autochan_setup(ast_bridged_channel(spyee_autochan->chan)))) {
+			ast_channel_lock(spyee_bridge_autochan->chan);
+			if (start_spying(spyee_bridge_autochan, spyer_name, &csth.bridge_whisper_audiohook)) {
+				ast_log(LOG_WARNING, "Unable to attach barge audiohook on spyee %s. Barge mode disabled!\n", name);
+			}
+			ast_channel_unlock(spyee_bridge_autochan->chan);
+		}
 	}
 
 	ast_channel_lock(chan);
@@ -686,15 +702,19 @@
 	ast_clear_flag(chan, AST_FLAG_END_DTMF_ONLY);
 	ast_channel_unlock(chan);
 
-	ast_audiohook_lock(&csth.whisper_audiohook);
-	ast_audiohook_detach(&csth.whisper_audiohook);
-	ast_audiohook_unlock(&csth.whisper_audiohook);
-	ast_audiohook_destroy(&csth.whisper_audiohook);
-	
-	ast_audiohook_lock(&csth.bridge_whisper_audiohook);
-	ast_audiohook_detach(&csth.bridge_whisper_audiohook);
-	ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
-	ast_audiohook_destroy(&csth.bridge_whisper_audiohook);
+	if (ast_test_flag(flags, OPTION_WHISPER | OPTION_BARGE | OPTION_DTMF_SWITCH_MODES)) {
+		ast_audiohook_lock(&csth.whisper_audiohook);
+		ast_audiohook_detach(&csth.whisper_audiohook);
+		ast_audiohook_unlock(&csth.whisper_audiohook);
+		ast_audiohook_destroy(&csth.whisper_audiohook);
+	}
+
+	if (ast_test_flag(flags, OPTION_BARGE | OPTION_DTMF_SWITCH_MODES)) {
+		ast_audiohook_lock(&csth.bridge_whisper_audiohook);
+		ast_audiohook_detach(&csth.bridge_whisper_audiohook);
+		ast_audiohook_unlock(&csth.bridge_whisper_audiohook);
+		ast_audiohook_destroy(&csth.bridge_whisper_audiohook);
+	}
 
 	ast_audiohook_lock(&csth.spy_audiohook);
 	ast_audiohook_detach(&csth.spy_audiohook);

Modified: team/mnicholson/new-v21-detect/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/apps/app_confbridge.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/apps/app_confbridge.c (original)
+++ team/mnicholson/new-v21-detect/apps/app_confbridge.c Tue Dec 27 15:26:33 2011
@@ -57,6 +57,7 @@
 #include "confbridge/include/confbridge.h"
 #include "asterisk/paths.h"
 #include "asterisk/manager.h"
+#include "asterisk/test.h"
 
 /*** DOCUMENTATION
     <application name="ConfBridge" language="en_US">
@@ -464,6 +465,7 @@
 
 		chan = ast_channel_unref(chan);
 		pthread_join(thread, NULL);
+		ast_test_suite_event_notify("CONF_STOP_RECORD", "Message: stopped conference recording channel\r\nConference: %s", conference_bridge->b_profile.name);
 
 		ao2_lock(conference_bridge);
 	}
@@ -516,6 +518,7 @@
 		return -1;
 	}
 
+	ast_test_suite_event_notify("CONF_START_RECORD", "Message: started conference recording channel\r\nConference: %s", conference_bridge->b_profile.name);
 	ao2_unlock(conference_bridge);
 	return 0;
 }
@@ -1541,6 +1544,7 @@
 	/* Mute or unmute yourself, note we only allow manipulation if they aren't waiting for a marked user or if marked users exist */
 	if (!ast_test_flag(&conference_bridge_user->u_profile, USER_OPT_WAITMARKED) || conference_bridge->markedusers) {
 		conference_bridge_user->features.mute = (!conference_bridge_user->features.mute ? 1 : 0);
+		ast_test_suite_event_notify("CONF_MUTE", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", chan->name, conference_bridge_user->features.mute ? "muted" : "unmuted", conference_bridge_user->b_profile.name, chan->name);
 	}
 	return ast_stream_and_wait(chan, (conference_bridge_user->features.mute ?
 		conf_get_sound(CONF_SOUND_MUTED, conference_bridge_user->b_profile.sounds) :
@@ -1981,6 +1985,7 @@
 	}
 	ao2_lock(bridge);
 	bridge->locked = lock;
+	ast_test_suite_event_notify("CONF_LOCK", "Message: conference %s\r\nConference: %s", bridge->locked ? "locked" : "unlocked", bridge->b_profile.name);
 	ao2_unlock(bridge);
 	ao2_ref(bridge, -1);
 
@@ -2013,6 +2018,7 @@
 	}
 	if (participant) {
 		participant->features.mute = mute;
+		ast_test_suite_event_notify("CONF_MUTE", "Message: participant %s %s\r\nConference: %s\r\nChannel: %s", participant->chan->name, participant->features.mute ? "muted" : "unmuted", bridge->b_profile.name, participant->chan->name);
 	} else {
 		res = -2;;
 	}

Modified: team/mnicholson/new-v21-detect/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/apps/app_dial.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/apps/app_dial.c (original)
+++ team/mnicholson/new-v21-detect/apps/app_dial.c Tue Dec 27 15:26:33 2011
@@ -476,7 +476,7 @@
 			<para>If the <variable>OUTBOUND_GROUP</variable> variable is set, all peer channels created by this
 			application will be put into that group (as in Set(GROUP()=...).
 			If the <variable>OUTBOUND_GROUP_ONCE</variable> variable is set, all peer channels created by this
-			application will be put into that group (as in Set(GROUP()=...). Unlike OUTBOUND_GROUP,
+			application will be put into that group (as in Set(GROUP()=...). Unlike <variable>OUTBOUND_GROUP</variable>,
 			however, the variable will be unset after use.</para>
 
 			<para>This application sets the following channel variables:</para>

Modified: team/mnicholson/new-v21-detect/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/apps/app_followme.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/apps/app_followme.c (original)
+++ team/mnicholson/new-v21-detect/apps/app_followme.c Tue Dec 27 15:26:33 2011
@@ -492,10 +492,12 @@
 
 	if (tmpuser && tmpuser->ochan && tmpuser->state >= 0) {
 		outbound = tmpuser->ochan;
+		ast_channel_lock(outbound);
 		if (!outbound->cdr) {
 			outbound->cdr = ast_cdr_alloc();
-			if (outbound->cdr)
+			if (outbound->cdr) {
 				ast_cdr_init(outbound->cdr, outbound);
+			}
 		}
 		if (outbound->cdr) {
 			char tmp[256];
@@ -506,11 +508,15 @@
 			ast_cdr_start(outbound->cdr);
 			ast_cdr_end(outbound->cdr);
 			/* If the cause wasn't handled properly */
-			if (ast_cdr_disposition(outbound->cdr, outbound->hangupcause))
+			if (ast_cdr_disposition(outbound->cdr, outbound->hangupcause)) {
 				ast_cdr_failed(outbound->cdr);
-		} else
+			}
+		} else {
 			ast_log(LOG_WARNING, "Unable to create Call Detail Record\n");
-		ast_hangup(tmpuser->ochan);
+		}
+		ast_channel_unlock(outbound);
+		ast_hangup(outbound);
+		tmpuser->ochan = NULL;
 	}
 }
 
@@ -890,6 +896,7 @@
 					AST_LIST_INSERT_TAIL(findme_user_list, tmpuser, entry);
 				} else {
 					ast_verb(3, "couldn't reach at this number.\n");
+					ast_channel_lock(outbound);
 					if (!outbound->cdr) {
 						outbound->cdr = ast_cdr_alloc();
 					}
@@ -909,6 +916,7 @@
 					} else {
 						ast_log(LOG_ERROR, "Unable to create Call Detail Record\n");
 					}
+					ast_channel_unlock(outbound);
 					ast_hangup(outbound);
 					ast_free(tmpuser);
 				}

Modified: team/mnicholson/new-v21-detect/apps/app_originate.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/apps/app_originate.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/apps/app_originate.c (original)
+++ team/mnicholson/new-v21-detect/apps/app_originate.c Tue Dec 27 15:26:33 2011
@@ -116,6 +116,14 @@
 		goto return_cleanup;
 	}
 	ast_format_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
+	ast_format_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR12, 0));
+	ast_format_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR16, 0));
+	ast_format_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR24, 0));
+	ast_format_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR32, 0));
+	ast_format_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR44, 0));
+	ast_format_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR48, 0));
+	ast_format_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR96, 0));
+	ast_format_cap_add(cap_slin, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR192, 0));
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_ERROR, "Originate() requires arguments\n");

Modified: team/mnicholson/new-v21-detect/apps/app_parkandannounce.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/apps/app_parkandannounce.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/apps/app_parkandannounce.c (original)
+++ team/mnicholson/new-v21-detect/apps/app_parkandannounce.c Tue Dec 27 15:26:33 2011
@@ -96,6 +96,7 @@
 	char *dialtech, *tmp[100], buf[13];
 	int looptemp, i;
 	char *s;
+	struct ast_party_id caller_id;
 
 	struct ast_channel *dchan;
 	struct outgoing_helper oh = { 0, };
@@ -110,7 +111,7 @@
 		AST_APP_ARG(return_context);
 	);
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "ParkAndAnnounce requires arguments: (announce:template|timeout|dial|[return_context])\n");
+		ast_log(LOG_WARNING, "ParkAndAnnounce requires arguments: (announce_template,timeout,dial,[return_context])\n");
 		res = -1;
 		goto parkcleanup;
 	}
@@ -148,17 +149,24 @@
 		ast_verb(3, "Warning: Return Context Invalid, call will return to default|s\n");
 	}
 
+	/* Save the CallerID because the masquerade turns chan into a ZOMBIE. */
+	ast_channel_lock(chan);
+	ast_party_id_copy(&caller_id, &chan->caller.id);
+	ast_channel_unlock(chan);
+
 	/* we are using masq_park here to protect * from touching the channel once we park it.  If the channel comes out of timeout
 	before we are done announcing and the channel is messed with, Kablooeee.  So we use Masq to prevent this.  */
 
 	res = ast_masq_park_call(chan, NULL, timeout, &lot);
 	if (res) {
 		/* Parking failed. */
-		res = -1;
-		goto parkcleanup;
-	}
-
-	ast_verb(3, "Call Parking Called, lot: %d, timeout: %d, context: %s\n", lot, timeout, args.return_context);
+		ast_party_id_free(&caller_id);
+		res = -1;
+		goto parkcleanup;
+	}
+
+	ast_verb(3, "Call parked in space: %d, timeout: %d, return-context: %s\n",
+		lot, timeout, args.return_context ? args.return_context : "");
 
 	/* Now place the call to the extension */
 
@@ -167,9 +175,11 @@
 	oh.vars = ast_variable_new("_PARKEDAT", buf, "");
 	dchan = __ast_request_and_dial(dialtech, cap_slin, chan, args.dial, 30000,
 		&outstate,
-		S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL),
-		S_COR(chan->caller.id.name.valid, chan->caller.id.name.str, NULL),
+		S_COR(caller_id.number.valid, caller_id.number.str, NULL),
+		S_COR(caller_id.name.valid, caller_id.name.str, NULL),
 		&oh);
+	ast_variables_destroy(oh.vars);
+	ast_party_id_free(&caller_id);
 	if (dchan) {
 		if (dchan->_state == AST_STATE_UP) {
 			ast_verb(4, "Channel %s was answered.\n", dchan->name);
@@ -209,7 +219,6 @@
 				dres = ast_waitstream(dchan, "");
 			} else {
 				ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[i], dchan->name);
-				dres = 0;
 			}
 		}
 	}

Modified: team/mnicholson/new-v21-detect/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/apps/app_queue.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/apps/app_queue.c (original)
+++ team/mnicholson/new-v21-detect/apps/app_queue.c Tue Dec 27 15:26:33 2011
@@ -5076,9 +5076,9 @@
 			if ((strcasecmp(cdr->uniqueid, qe->chan->uniqueid)) &&
 			    (strcasecmp(cdr->linkedid, qe->chan->uniqueid)) &&
 			    (newcdr = ast_cdr_dup(cdr))) {
+				ast_channel_lock(qe->chan);
 				ast_cdr_init(newcdr, qe->chan);
 				ast_cdr_reset(newcdr, 0);
-				ast_channel_lock(qe->chan);
 				cdr = ast_cdr_append(cdr, newcdr);
 				cdr = cdr->next;
 				ast_channel_unlock(qe->chan);
@@ -6309,11 +6309,16 @@
 	buf[0] = '\0';
 
 	if (ast_strlen_zero(data)) {
-		ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
+		ast_log(LOG_ERROR, "Missing required argument. %s(<queuename>,<option>[<interface>])\n", cmd);
 		return -1;
 	}
 
 	AST_STANDARD_APP_ARGS(args, data);
+
+	if (args.argc < 2) {
+		ast_log(LOG_ERROR, "Missing required argument. %s(<queuename>,<option>[<interface>])\n", cmd);
+		return -1;
+	}
 
 	if ((q = find_load_queue_rt_friendly(args.queuename))) {
 		ao2_lock(q);
@@ -6364,6 +6369,9 @@
 			   ((m = interface_exists(q, args.interface)))) {
 			count = m->ignorebusy;
 			ao2_ref(m, -1);
+		} else {
+			ast_log(LOG_ERROR, "Unknown option %s provided to %s, valid values are: "
+				"logged, free, ready, count, penalty, paused, ignorebusy\n", args.option, cmd);
 		}
 		ao2_unlock(q);
 		queue_t_unref(q, "Done with temporary reference in QUEUE_MEMBER()");

Propchange: team/mnicholson/new-v21-detect/apps/confbridge/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Dec 27 15:26:33 2011
@@ -1,1 +1,2 @@
 *.o
+*.i

Modified: team/mnicholson/new-v21-detect/cel/cel_pgsql.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/cel/cel_pgsql.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/cel/cel_pgsql.c (original)
+++ team/mnicholson/new-v21-detect/cel/cel_pgsql.c Tue Dec 27 15:26:33 2011
@@ -145,13 +145,7 @@
 		int first = 1;
 
 		if (!sql || !sql2) {
-			if (sql) {
-				ast_free(sql);
-			}
-			if (sql2) {
-				ast_free(sql2);
-			}
-			return;
+			goto ast_log_cleanup;
 		}
 
 		ast_str_set(&sql, 0, "INSERT INTO %s (", table);
@@ -291,10 +285,10 @@
 		if (PQstatus(conn) == CONNECTION_OK) {
 			connected = 1;
 		} else {
-			ast_log(LOG_ERROR, "Connection was lost... attempting to reconnect.\n");
+			ast_log(LOG_WARNING, "Connection was lost... attempting to reconnect.\n");
 			PQreset(conn);
 			if (PQstatus(conn) == CONNECTION_OK) {
-				ast_log(LOG_ERROR, "Connection reestablished.\n");
+				ast_log(LOG_NOTICE, "Connection reestablished.\n");
 				connected = 1;
 			} else {
 				pgerror = PQerrorMessage(conn);
@@ -303,21 +297,18 @@
 				PQfinish(conn);
 				conn = NULL;
 				connected = 0;
-				ast_mutex_unlock(&pgsql_lock);
-				ast_free(sql);
-				ast_free(sql2);
-				return;
+				goto ast_log_cleanup;
 			}
 		}
 		result = PQexec(conn, ast_str_buffer(sql));
 		if (PQresultStatus(result) != PGRES_COMMAND_OK) {
 			pgerror = PQresultErrorMessage(result);
-			ast_log(LOG_ERROR, "Failed to insert call detail record into database!\n");
-			ast_log(LOG_ERROR, "Reason: %s\n", pgerror);
-			ast_log(LOG_ERROR, "Connection may have been lost... attempting to reconnect.\n");
+			ast_log(LOG_WARNING, "Failed to insert call detail record into database!\n");
+			ast_log(LOG_WARNING, "Reason: %s\n", pgerror);
+			ast_log(LOG_WARNING, "Connection may have been lost... attempting to reconnect.\n");
 			PQreset(conn);
 			if (PQstatus(conn) == CONNECTION_OK) {
-				ast_log(LOG_ERROR, "Connection reestablished.\n");
+				ast_log(LOG_NOTICE, "Connection reestablished.\n");
 				connected = 1;
 				PQclear(result);
 				result = PQexec(conn, ast_str_buffer(sql));
@@ -327,14 +318,16 @@
 					ast_log(LOG_ERROR, "Reason: %s\n", pgerror);
 				}
 			}
-			ast_mutex_unlock(&pgsql_lock);
 			PQclear(result);
-			ast_free(sql);
-			ast_free(sql2);
-			return;
-		}
-		ast_mutex_unlock(&pgsql_lock);
-	}
+			goto ast_log_cleanup;
+		}
+
+ast_log_cleanup:
+		ast_free(sql);
+		ast_free(sql2);
+	}
+
+	ast_mutex_unlock(&pgsql_lock);
 }
 
 static int my_unload_module(void)

Modified: team/mnicholson/new-v21-detect/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/channels/chan_iax2.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/channels/chan_iax2.c (original)
+++ team/mnicholson/new-v21-detect/channels/chan_iax2.c Tue Dec 27 15:26:33 2011
@@ -5839,8 +5839,10 @@
 		tmp->caller.ani.number.str = ast_strdup(i->cid_num);
 	}
 	tmp->dialed.number.str = ast_strdup(i->dnid);
-	tmp->redirecting.from.number.valid = 1;
-	tmp->redirecting.from.number.str = ast_strdup(i->rdnis);
+	if (!ast_strlen_zero(i->rdnis)) {
+		tmp->redirecting.from.number.valid = 1;
+		tmp->redirecting.from.number.str = ast_strdup(i->rdnis);
+	}
 	tmp->caller.id.name.presentation = i->calling_pres;
 	tmp->caller.id.number.presentation = i->calling_pres;
 	tmp->caller.id.number.plan = i->calling_ton;

Modified: team/mnicholson/new-v21-detect/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/channels/chan_sip.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/channels/chan_sip.c (original)
+++ team/mnicholson/new-v21-detect/channels/chan_sip.c Tue Dec 27 15:26:33 2011
@@ -2977,10 +2977,9 @@
 		}
 		dialog->registry = registry_unref(dialog->registry, "delete dialog->registry");
 	}
-	if (dialog->stateid > -1) {
-		ast_extension_state_del(dialog->stateid, NULL);
-		dialog_unref(dialog, "removing extension_state, should unref the associated dialog ptr that was stored there.");
-		dialog->stateid = -1; /* shouldn't we 'zero' this out? */
+	if (dialog->stateid != -1) {
+		ast_extension_state_del(dialog->stateid, cb_extensionstate);
+		dialog->stateid = -1;
 	}
 	/* Remove link from peer to subscription of MWI */
 	if (dialog->relatedpeer && dialog->relatedpeer->mwipvt == dialog) {
@@ -14648,6 +14647,13 @@
 	}
 }
 
+static void cb_extensionstate_destroy(int id, void *data)
+{
+	struct sip_pvt *p = data;
+
+	dialog_unref(p, "the extensionstate containing this dialog ptr was destroyed");
+}
+
 /*! \brief Callback for the devicestate notification (SUBSCRIBE) support subsystem
 \note	If you add an "hint" priority to the extension in the dial plan,
 	you will get notifications on device state changes */
@@ -14662,7 +14668,6 @@
 	case AST_EXTENSION_REMOVED:	/* Extension is gone */
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);	/* Delete subscription in 32 secs */
 		ast_verb(2, "Extension state: Watcher for hint %s %s. Notify User %s\n", exten, state == AST_EXTENSION_DEACTIVATED ? "deactivated" : "removed", p->username);
-		p->stateid = -1;
 		p->subscribed = NONE;
 		append_history(p, "Subscribestatus", "%s", state == AST_EXTENSION_REMOVED ? "HintRemoved" : "Deactivated");
 		break;
@@ -24996,7 +25001,7 @@
 {
 	int gotdest = 0;
 	int res = 0;
-	int firststate = AST_EXTENSION_REMOVED;
+	int firststate;
 	struct sip_peer *authpeer = NULL;
 	const char *eventheader = sip_get_header(req, "Event");	/* Get Event package name */
 	int resubscribe = (p->subscribed != NONE) && !req->ignore;
@@ -25290,12 +25295,15 @@
 
 	/* Add subscription for extension state from the PBX core */
 	if (p->subscribed != MWI_NOTIFICATION  && p->subscribed != CALL_COMPLETION && !resubscribe) {
-		if (p->stateid > -1) {
+		if (p->stateid != -1) {
 			ast_extension_state_del(p->stateid, cb_extensionstate);
-			/* we need to dec the refcount, now that the extensionstate is removed */
-			dialog_unref(p, "the extensionstate containing this dialog ptr was deleted");
-		}
-		p->stateid = ast_extension_state_add(p->context, p->exten, cb_extensionstate, dialog_ref(p,"copying dialog ptr into extension state struct"));
+		}
+		dialog_ref(p, "copying dialog ptr into extension state struct");
+		p->stateid = ast_extension_state_add_destroy(p->context, p->exten,
+			cb_extensionstate, cb_extensionstate_destroy, p);
+		if (p->stateid == -1) {
+			dialog_unref(p, "copying dialog ptr into extension state struct failed");
+		}
 	}
 
 	if (!req->ignore && p)

Propchange: team/mnicholson/new-v21-detect/codecs/speex/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Dec 27 15:26:33 2011
@@ -1,1 +1,2 @@
 *.o
+*.i

Modified: team/mnicholson/new-v21-detect/configs/features.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/configs/features.conf.sample?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/configs/features.conf.sample (original)
+++ team/mnicholson/new-v21-detect/configs/features.conf.sample Tue Dec 27 15:26:33 2011
@@ -43,6 +43,8 @@
                                 ;         created in the 'park-dial' context.  This extension will be set up to do a
                                 ;         Dial() to 'SIP/0004F2040001'.
                                 ;
+                                ;         During the timeout procedure, the following variable is set
+                                ;         PARKINGSLOT - extension that the call was parked in prior to timing out
 
 ;courtesytone = beep            ; Sound file to play to when someone picks up a parked call
                                 ; and also when the Touch Monitor is activated/deactivated.

Modified: team/mnicholson/new-v21-detect/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/configs/sip.conf.sample?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/configs/sip.conf.sample (original)
+++ team/mnicholson/new-v21-detect/configs/sip.conf.sample Tue Dec 27 15:26:33 2011
@@ -808,8 +808,8 @@
 ; However, this is only useful if the external traffic can reach us.
 ; The following settings are allowed (both globally and in individual sections):
 ;
-;        nat = no                ; Default. Use rport if the remote side says to use it.
-;        nat = force_rport       ; Force rport to always be on.
+;        nat = no                ; Use rport if the remote side says to use it.
+;        nat = force_rport       ; Force rport to always be on. (default)
 ;        nat = yes               ; Force rport to always be on and perform comedia RTP handling.
 ;        nat = comedia           ; Use rport if the remote side says to use it and perform comedia RTP handling.
 ;
@@ -826,7 +826,7 @@
 ; by outside parties as Asterisk will respond to different ports for defined and
 ; undefined peers. For this reason it is recommended to ONLY DEFINE NAT SETTINGS IN THE
 ; GENERAL SECTION. Specifically, if nat=force_rport in one section and nat=no in the
-; other, then valid users with settings differing from those in the general section will
+; other, then valid peers with settings differing from those in the general section will
 ; be discoverable.
 ;
 ; In addition to these settings, Asterisk *always* uses 'symmetric RTP' mode as defined by

Modified: team/mnicholson/new-v21-detect/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/configure.ac?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/configure.ac (original)
+++ team/mnicholson/new-v21-detect/configure.ac Tue Dec 27 15:26:33 2011
@@ -898,9 +898,37 @@
 AST_GCC_ATTRIBUTE(deprecated)
 AST_GCC_ATTRIBUTE(sentinel)
 AST_GCC_ATTRIBUTE(warn_unused_result)
-AST_GCC_ATTRIBUTE(weak_import, [], [], PBX_WEAKREF)
-AST_GCC_ATTRIBUTE(weak, [], [], PBX_WEAKREF)
-AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)
+
+# Support weak symbols on a platform specific basis.  The Mac OS X
+# (Darwin) support must be isolated from the other platforms because
+# it has caused other platforms to fail.
+#
+case "${OSARCH}" in
+	darwin*)
+	# Allow weak symbol support on Darwin platforms only because there
+	# is active community support for it.
+	# However, Darwin seems to break weak symbols for each new version.
+	#
+	AST_GCC_ATTRIBUTE(weak_import, [], [], PBX_WEAKREF)
+
+	# Several other platforms including Linux have GCC versions that
+	# define the weak attribute.  However, this attribute is only
+	# setup for use in the code by Darwin.
+	AST_GCC_ATTRIBUTE(weak, [], [], PBX_WEAKREF)
+	;;
+	linux-gnu)
+	# Primarily support weak symbols on Linux platforms.
+	#
+	AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)
+	;;
+	*)
+	# Allow weak symbols on other platforms.  However, any problems
+	# with this feature on other platforms must be fixed by the
+	# community.
+	#
+	AST_GCC_ATTRIBUTE(weakref, [weakref("foo")], static, PBX_WEAKREF)
+	;;
+esac
 
 AC_MSG_CHECKING(for -ffunction-sections support)
 saved_CFLAGS="${CFLAGS}"

Modified: team/mnicholson/new-v21-detect/funcs/func_cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/funcs/func_cdr.c?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/funcs/func_cdr.c (original)
+++ team/mnicholson/new-v21-detect/funcs/func_cdr.c Tue Dec 27 15:26:33 2011
@@ -197,17 +197,21 @@
 {
 	char *ret;
 	struct ast_flags flags = { 0 };
-	struct ast_cdr *cdr = chan ? chan->cdr : NULL;
+	struct ast_cdr *cdr;
 	AST_DECLARE_APP_ARGS(args,
 			     AST_APP_ARG(variable);
 			     AST_APP_ARG(options);
 	);
 
-	if (ast_strlen_zero(parse))
+	if (ast_strlen_zero(parse) || !chan)
 		return -1;
 
-	if (!cdr)
+	ast_channel_lock(chan);
+	cdr = chan->cdr;
+	if (!cdr) {
+		ast_channel_unlock(chan);
 		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -255,13 +259,14 @@
 				   ast_test_flag(&flags, OPT_UNPARSED));
 	}
 
+	ast_channel_unlock(chan);
 	return ret ? 0 : -1;
 }
 
 static int cdr_write(struct ast_channel *chan, const char *cmd, char *parse,
 		     const char *value)
 {
-	struct ast_cdr *cdr = chan ? chan->cdr : NULL;
+	struct ast_cdr *cdr;
 	struct ast_flags flags = { 0 };
 	AST_DECLARE_APP_ARGS(args,
 			     AST_APP_ARG(variable);
@@ -271,8 +276,12 @@
 	if (ast_strlen_zero(parse) || !value || !chan)
 		return -1;
 
-	if (!cdr)
+	ast_channel_lock(chan);
+	cdr = chan->cdr;
+	if (!cdr) {
+		ast_channel_unlock(chan);
 		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -296,6 +305,7 @@
 		/* No need to worry about the u flag, as all fields for which setting
 		 * 'u' would do anything are marked as readonly. */
 
+	ast_channel_unlock(chan);
 	return 0;
 }
 

Modified: team/mnicholson/new-v21-detect/include/asterisk/cdr.h
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/include/asterisk/cdr.h?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/include/asterisk/cdr.h (original)
+++ team/mnicholson/new-v21-detect/include/asterisk/cdr.h Tue Dec 27 15:26:33 2011
@@ -211,6 +211,7 @@
  * \param cdr Call Detail Record to use for channel
  * \param chan Channel to bind CDR with
  * Initializes a CDR and associates it with a particular channel
+ * \note The channel should be locked before calling.
  * \return 0 by default
  */
 int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan);
@@ -220,6 +221,7 @@
  * \param cdr Call Detail Record to use for channel
  * \param chan Channel to bind CDR with
  * Initializes a CDR and associates it with a particular channel
+ * \note The channel should be locked before calling.
  * \return 0 by default
  */
 int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan);
@@ -403,22 +405,40 @@
  */
 void ast_cdr_merge(struct ast_cdr *to, struct ast_cdr *from);
 
-/*! \brief Set account code, will generate AMI event */
+/*!
+ * \brief Set account code, will generate AMI event
+ * \note The channel should be locked before calling.
+ */
 int ast_cdr_setaccount(struct ast_channel *chan, const char *account);
 
-/*! \brief Set the peer account */
+/*!
+ * \brief Set the peer account
+ * \note The channel should be locked before calling.
+ */
 int ast_cdr_setpeeraccount(struct ast_channel *chan, const char *account);
 
-/*! \brief Set AMA flags for channel */
+/*!
+ * \brief Set AMA flags for channel
+ * \note The channel should be locked before calling.
+ */
 int ast_cdr_setamaflags(struct ast_channel *chan, const char *amaflags);
 
-/*! \brief Set CDR user field for channel (stored in CDR) */
+/*!
+ * \brief Set CDR user field for channel (stored in CDR)
+ * \note The channel should be locked before calling.
+ */
 int ast_cdr_setuserfield(struct ast_channel *chan, const char *userfield);
-/*! \brief Append to CDR user field for channel (stored in CDR) */
+/*!
+ * \brief Append to CDR user field for channel (stored in CDR)
+ * \note The channel should be locked before calling.
+ */
 int ast_cdr_appenduserfield(struct ast_channel *chan, const char *userfield);
 
 
-/*! Update CDR on a channel */
+/*!
+ * \brief Update CDR on a channel
+ * \note The channel should be locked before calling.
+ */
 int ast_cdr_update(struct ast_channel *chan);
 
 

Modified: team/mnicholson/new-v21-detect/include/asterisk/format_pref.h
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/include/asterisk/format_pref.h?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/include/asterisk/format_pref.h (original)
+++ team/mnicholson/new-v21-detect/include/asterisk/format_pref.h Tue Dec 27 15:26:33 2011
@@ -34,7 +34,7 @@
 	/*! This array represents the format id's index in the global format list. */
 	char order[AST_CODEC_PREF_SIZE];
 	/*! This array represents the format's framing size if present. */
-	char framing[AST_CODEC_PREF_SIZE];
+	int framing[AST_CODEC_PREF_SIZE];
 };
 
 /*! \page AudioCodecPref Audio Codec Preferences

Modified: team/mnicholson/new-v21-detect/include/asterisk/module.h
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/include/asterisk/module.h?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/include/asterisk/module.h (original)
+++ team/mnicholson/new-v21-detect/include/asterisk/module.h Tue Dec 27 15:26:33 2011
@@ -205,6 +205,7 @@
 	AST_MODPRI_REALTIME_DEPEND =    10,  /*!< Dependency for a realtime driver */
 	AST_MODPRI_REALTIME_DEPEND2 =   20,  /*!< Second level dependency for a realtime driver (func_curl needs res_curl, but is needed by res_config_curl) */
 	AST_MODPRI_REALTIME_DRIVER =    30,  /*!< A realtime driver, which provides configuration services for other modules */
+	AST_MODPRI_TIMING =             40,  /*!< Dependency for a channel (MOH needs timing interfaces to be fully loaded) */
 	AST_MODPRI_CHANNEL_DEPEND =     50,  /*!< Channel driver dependency (may depend upon realtime, e.g. MOH) */
 	AST_MODPRI_CHANNEL_DRIVER =     60,  /*!< Channel drivers (provide devicestate) */
 	AST_MODPRI_APP_DEPEND =         70,  /*!< Dependency for an application */

Modified: team/mnicholson/new-v21-detect/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/team/mnicholson/new-v21-detect/include/asterisk/pbx.h?view=diff&rev=349229&r1=349228&r2=349229
==============================================================================
--- team/mnicholson/new-v21-detect/include/asterisk/pbx.h (original)
+++ team/mnicholson/new-v21-detect/include/asterisk/pbx.h Tue Dec 27 15:26:33 2011
@@ -77,6 +77,9 @@
 
 /*! \brief Typedef for devicestate and hint callbacks */
 typedef int (*ast_state_cb_type)(const char *context, const char *exten, enum ast_extension_states state, void *data);
+
+/*! \brief Typedef for devicestate and hint callback removal indication callback */
+typedef void (*ast_state_cb_destroy_type)(int id, void *data);
 
 /*! \brief Data structure associated with a custom dialplan function */
 struct ast_custom_function {
@@ -408,33 +411,54 @@
 const char *ast_extension_state2str(int extension_state);
 
 /*!
- * \brief Registers a state change callback
+ * \brief Registers a state change callback with destructor.
+ * \since 1.8.9
+ * \since 10.1.0
  *
  * \param context which context to look in
  * \param exten which extension to get state
- * \param callback callback to call if state changed
+ * \param change_cb callback to call if state changed
+ * \param destroy_cb callback to call when registration destroyed.
  * \param data to pass to callback
  *
- * The callback is called if the state of an extension is changed.
+ * \note The change_cb is called if the state of an extension is changed.
+ *
+ * \note The destroy_cb is called when the registration is
+ * deleted so the registerer can release any associated
+ * resources.
  *
  * \retval -1 on failure
  * \retval ID on success
  */
+int ast_extension_state_add_destroy(const char *context, const char *exten,
+	ast_state_cb_type change_cb, ast_state_cb_destroy_type destroy_cb, void *data);
+
+/*!
+ * \brief Registers a state change callback
+ *
+ * \param context which context to look in
+ * \param exten which extension to get state
+ * \param change_cb callback to call if state changed
+ * \param data to pass to callback
+ *
+ * \note The change_cb is called if the state of an extension is changed.
+ *

[... 978 lines stripped ...]



More information about the svn-commits mailing list