[asterisk-commits] juggie: branch group/cdr_backend_ast_str r110472 - in /team/group/cdr_backend...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 20 23:04:01 CDT 2008


Author: juggie
Date: Thu Mar 20 23:04:01 2008
New Revision: 110472

URL: http://svn.digium.com/view/asterisk?view=rev&rev=110472
Log:
Merged revisions 110020,110023,110036,110084,110087,110132,110161,110164,110211,110237,110268,110270,110272,110303,110337,110339,110396,110444 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r110020 | file | 2008-03-19 14:25:33 -0400 (Wed, 19 Mar 2008) | 14 lines

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

........
r110019 | file | 2008-03-19 15:20:28 -0300 (Wed, 19 Mar 2008) | 6 lines

Make sure that the mark bit does not incorrectly cause video frame timestamps to be calculated as if they are audio frames.
(closes issue #11429)
Reported by: sperreault
Patches:
      11429-frametype.diff uploaded by qwell (license 4)

........

................
r110023 | russell | 2008-03-19 14:57:16 -0400 (Wed, 19 Mar 2008) | 2 lines

remove svnmerge-blocked property that is not supposed to be here

................
r110036 | file | 2008-03-19 15:13:39 -0400 (Wed, 19 Mar 2008) | 12 lines

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

........
r110035 | file | 2008-03-19 16:11:33 -0300 (Wed, 19 Mar 2008) | 4 lines

Add sanity checking for position resuming. We *have* to make sure that the position does not exceed the total number of files present, and we have to make sure that the position's filename is the same as previous. These values can change if a music class is reloaded and give unpredictable behavior.
(closes issue #11663)
Reported by: junky

........

................
r110084 | mmichelson | 2008-03-19 16:34:13 -0400 (Wed, 19 Mar 2008) | 12 lines

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

........
r110083 | mmichelson | 2008-03-19 15:33:03 -0500 (Wed, 19 Mar 2008) | 4 lines

Add a missing unlock in the case that memory allocation fails in app_chanspy.
Thanks to Russell for confirming that this was an issue.


........

................
r110087 | jpeeler | 2008-03-19 17:05:24 -0400 (Wed, 19 Mar 2008) | 2 lines

This change adds DNS manager support for registrations not referencing a peer entry. It looks like there is support for DNS manager for realtime peers as well, however it is not implemented correctly. The improper usage occurs when ast_dnsmgr_lookup is called with one of the arguments being an address from the stack to be continually updated. The variable from the stack will go out of scope and dnsmgr will continue to try and update the memory there, causing possible stack corruption. This problem will be worked on next as well as adding DNS manager support for peer entries.

................
r110132 | qwell | 2008-03-19 17:56:15 -0400 (Wed, 19 Mar 2008) | 1 line

Rename very poorly named function to reflect what it actually does.  This was causing quite a bit of confusion for me...
................
r110161 | qwell | 2008-03-19 18:25:34 -0400 (Wed, 19 Mar 2008) | 5 lines

Rename DSP_FEATURE_DTMF_DETECT, because we are *NOT* only detecting DTMF digits.
This was very misleading.

Early cleanup for issue #11968

................
r110164 | russell | 2008-03-19 18:58:33 -0400 (Wed, 19 Mar 2008) | 13 lines

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

........
r110163 | russell | 2008-03-19 17:57:59 -0500 (Wed, 19 Mar 2008) | 5 lines

Fix a bug where when calls on the trunk side hang up while on hold, the state
is not properly reflected.

(closes issue #11990, reported by anakaoka, patched by me)

........

................
r110211 | tilghman | 2008-03-19 23:14:59 -0400 (Wed, 19 Mar 2008) | 2 lines

Fix recent trunk breakage

................
r110237 | tilghman | 2008-03-20 01:06:12 -0400 (Thu, 20 Mar 2008) | 5 lines

Upgrade the sounds version; add several directory enhancements:
	1) Number of digits to enter can now be configured
	2) The digits can now match on both first AND last name, instead of only one or the other
(Closes issue #7151)

................
r110268 | russell | 2008-03-20 13:41:22 -0400 (Thu, 20 Mar 2008) | 27 lines

Add some fixes that I made in regards to wideband codec handling to get
G.722 music on hold working for me.

(issue #12164, reported by milazzo and jsmith, patches by me)

res/res_musiconhold.c:
 - I moved a single line so that the sample queue update happened before
   ast_write().  The reason that this was a bug is that the G.722 frame
   originally says it has 320 samples in it (which is correct).  However,
   when the frame is written to a channel that uses RTP, main/rtp.c modifies
   the frame to cut the number of samples in half before it sends it on
   the wire.  This is to account for the stupid incorrect G.722 spec that
   makes it so we have to lie about the number of samples with RTP.  I should
   probably go and re-work the RTP code so it doesn't modify the frame so
   that a bug like this won't happen in the future.  However, this change to
   MOH is harmless.

main/channel.c:
 - I made two fixes in regards to generator timing.  Generators use samples
   for timing.  However, this code assumed 8 kHz samples.  In one case, it was
   a hard coded 160 samples, that is now written as the sample rate / 50.  The
   other place was dealing with timing a generator based on frames coming from
   the other direction.  However, that would have only worked if the sample
   rates for the formats in both directions were the same.  The code now takes
   into account that the sample rates may differ, and scales the generator
   samples accordingly.

................
r110270 | russell | 2008-03-20 13:45:29 -0400 (Thu, 20 Mar 2008) | 2 lines

Remove astobj.h from some places where it wasn't needed

................
r110272 | mmichelson | 2008-03-20 14:01:36 -0400 (Thu, 20 Mar 2008) | 3 lines

Add missing unlock


................
r110303 | russell | 2008-03-20 16:08:26 -0400 (Thu, 20 Mar 2008) | 8 lines

Fix a bug when using zaptel timing for playing back files that have a sample rate
other than 8 kHz.  The issue here is that format modules give a "whennext" sample
value, which is used to calculate when to set a timer for to retrieve the next
frame.  However, the zaptel timer operates on 8 kHz samples, so this must be taken
into account.

(another part of issue #12164, reported by milazzo and jsmith, patch by me)

................
r110337 | russell | 2008-03-20 17:55:50 -0400 (Thu, 20 Mar 2008) | 22 lines

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

................
r110336 | russell | 2008-03-20 16:54:58 -0500 (Thu, 20 Mar 2008) | 14 lines

Merged revisions 110335 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r110335 | russell | 2008-03-20 16:53:27 -0500 (Thu, 20 Mar 2008) | 6 lines

Fix some very broken code that was introduced in 1.2.26 as a part of the security
fix.  The dnsmgr is not appropriate here.  The dnsmgr takes a pointer to an address
structure that a background thread continuously updates.  However, in these cases,
a stack variable was passed.  That means that the dnsmgr thread would be continuously
writing to bogus memory.

........

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

................
r110339 | russell | 2008-03-20 18:02:20 -0400 (Thu, 20 Mar 2008) | 3 lines

Use the correct buffer for g722tolin16_sample.  This shouldn't have caused any
problems, but Qwell noticed the typo here.

................
r110396 | russell | 2008-03-20 19:14:13 -0400 (Thu, 20 Mar 2008) | 17 lines

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

........
r110395 | russell | 2008-03-20 18:13:56 -0500 (Thu, 20 Mar 2008) | 9 lines

Shorten the ast_waitfor() timeout from 500 ms to 50 ms in the autoservice thread.
This really should not make a difference except in very rare cases.  That case would
be that all of the channels in autoservice are not generating any frames.  In that
case, this change reduces the potential amount of time that a thread waits in
ast_autoservice_stop() for the autoservice thread to wrap back around to the beginning
of its loop.

(closes issue #12266, reported by dimas)

........

................
r110444 | tilghman | 2008-03-20 21:44:38 -0400 (Thu, 20 Mar 2008) | 2 lines

Add note of the added Directory options, from commit 110237 (closes issue #7151)

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

Modified:
    team/group/cdr_backend_ast_str/   (props changed)
    team/group/cdr_backend_ast_str/CHANGES
    team/group/cdr_backend_ast_str/apps/app_chanspy.c
    team/group/cdr_backend_ast_str/apps/app_directory.c
    team/group/cdr_backend_ast_str/apps/app_meetme.c
    team/group/cdr_backend_ast_str/apps/app_minivm.c
    team/group/cdr_backend_ast_str/channels/chan_h323.c
    team/group/cdr_backend_ast_str/channels/chan_iax2.c
    team/group/cdr_backend_ast_str/channels/chan_mgcp.c
    team/group/cdr_backend_ast_str/channels/chan_misdn.c
    team/group/cdr_backend_ast_str/channels/chan_sip.c
    team/group/cdr_backend_ast_str/channels/chan_usbradio.c
    team/group/cdr_backend_ast_str/channels/chan_vpb.cc
    team/group/cdr_backend_ast_str/channels/chan_zap.c
    team/group/cdr_backend_ast_str/codecs/codec_g722.c
    team/group/cdr_backend_ast_str/include/asterisk/dsp.h
    team/group/cdr_backend_ast_str/include/asterisk/netsock.h
    team/group/cdr_backend_ast_str/main/autoservice.c
    team/group/cdr_backend_ast_str/main/channel.c
    team/group/cdr_backend_ast_str/main/dial.c
    team/group/cdr_backend_ast_str/main/dsp.c
    team/group/cdr_backend_ast_str/main/file.c
    team/group/cdr_backend_ast_str/main/netsock.c
    team/group/cdr_backend_ast_str/main/rtp.c
    team/group/cdr_backend_ast_str/res/res_musiconhold.c
    team/group/cdr_backend_ast_str/sounds/Makefile

Propchange: team/group/cdr_backend_ast_str/
            ('svnmerge-blocked' removed)

Propchange: team/group/cdr_backend_ast_str/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Mar 20 23:04:01 2008
@@ -1,1 +1,1 @@
-/trunk:1-109974
+/trunk:1-110471

Modified: team/group/cdr_backend_ast_str/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/CHANGES?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/CHANGES (original)
+++ team/group/cdr_backend_ast_str/CHANGES Thu Mar 20 23:04:01 2008
@@ -11,6 +11,14 @@
 ----------------------------------------
  * Channels can now be configured using named sections in zapata.conf, just
    like other channel drivers, including the use of templates.
+
+Application Changes
+-------------------
+ * Directory now permits both first and last names to be matched at the same
+   time.  In addition, the number of digits to enter of the name can be set in
+   the arguments to Directory; previously, you could enter only 3, regardless
+   of how many names are in your company.  For large companies, this should be
+   quite helpful.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0  -------------
@@ -169,6 +177,7 @@
      more information on how it is used.
   * Added a new configuration option "authfailureevents" that enables manager events when
     a peer can't authenticate properly. 
+  * Added DNS manager support to registrations not referencing a peer entry.
 
 IAX2 changes
 ------------

Modified: team/group/cdr_backend_ast_str/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/apps/app_chanspy.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/apps/app_chanspy.c (original)
+++ team/group/cdr_backend_ast_str/apps/app_chanspy.c Thu Mar 20 23:04:01 2008
@@ -478,16 +478,15 @@
 
 	ast_mutex_lock(&chanspy_ds->lock);
 
-	chanspy_ds->chan = chan;
-
 	if (!(datastore = ast_channel_datastore_alloc(&chanspy_ds_info, NULL))) {
+		ast_mutex_unlock(&chanspy_ds->lock);
 		chanspy_ds = chanspy_ds_free(chanspy_ds);
 		ast_channel_unlock(chan);
 		return NULL;
 	}
-
+	
+	chanspy_ds->chan = chan;
 	datastore->data = chanspy_ds;
-
 	ast_channel_datastore_add(chan, datastore);
 
 	return chanspy_ds;

Modified: team/group/cdr_backend_ast_str/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/apps/app_directory.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/apps/app_directory.c (original)
+++ team/group/cdr_backend_ast_str/apps/app_directory.c Thu Mar 20 23:04:01 2008
@@ -37,6 +37,7 @@
 #include "asterisk/module.h"
 #include "asterisk/say.h"
 #include "asterisk/app.h"
+#include "asterisk/utils.h"
 
 #ifdef ODBC_STORAGE
 #include <sys/mman.h>
@@ -66,27 +67,53 @@
 "                   extension that the user has selected, or when jumping to the\n"
 "                   'o' or 'a' extension.\n\n"
 "  Options:\n"
-"    e - In addition to the name, also read the extension number to the\n"
-"        caller before presenting dialing options.\n"
-"    f - Allow the caller to enter the first name of a user in the directory\n"
-"        instead of using the last name.\n"
-"    m - Instead of reading each name sequentially and asking for confirmation,\n"
-"        create a menu of up to 8 names.\n";
+"    e           In addition to the name, also read the extension number to the\n"
+"              caller before presenting dialing options.\n"
+"    f[(<n>)]    Allow the caller to enter the first name of a user in the\n"
+"              directory instead of using the last name.  If specified, the\n"
+"              optional number argument will be used for the number of\n"
+"              characters the user should enter.\n"
+"    l[(<n>)]    Allow the caller to enter the last name of a user in the\n"
+"              directory.  This is the default.  If specified, the\n"
+"              optional number argument will be used for the number of\n"
+"              characters the user should enter.\n"
+"    b[(<n>)]    Allow the caller to enter either the first or the last name\n"
+"              of a user in the directory.  If specified, the optional number\n"
+"              argument will be used for the number of characters the user\n"
+"              should enter.\n"
+"    m           Instead of reading each name sequentially and asking for\n"
+"              confirmation, create a menu of up to 8 names.\n"
+"    p(<n>)      Pause for n milliseconds after the digits are typed.  This is\n"
+"              helpful for people with cellphones, who are not holding the\n"
+"              receiver to their ear while entering DTMF.\n"
+"\n"
+"    Only one of the f, l, or b options may be specified.  If more than one is\n"
+"    specified, then Directory will act as if 'b' was specified.  The number\n"
+"    of characters for the user to type defaults to 3.\n";
 
 /* For simplicity, I'm keeping the format compatible with the voicemail config,
    but i'm open to suggestions for isolating it */
 
 #define VOICEMAIL_CONFIG "voicemail.conf"
-
-/* How many digits to read in */
-#define NUMDIGITS 3
 
 enum {
 	OPT_LISTBYFIRSTNAME = (1 << 0),
 	OPT_SAYEXTENSION =    (1 << 1),
 	OPT_FROMVOICEMAIL =   (1 << 2),
 	OPT_SELECTFROMMENU =  (1 << 3),
+	OPT_LISTBYLASTNAME =  (1 << 4),
+	OPT_LISTBYEITHER =    OPT_LISTBYFIRSTNAME | OPT_LISTBYLASTNAME,
+	OPT_PAUSE =           (1 << 5),
 } directory_option_flags;
+
+enum {
+	OPT_ARG_FIRSTNAME =   0,
+	OPT_ARG_LASTNAME =    1,
+	OPT_ARG_EITHER =      2,
+	OPT_ARG_PAUSE =       3,
+	/* This *must* be the last value in this enum! */
+	OPT_ARG_ARRAY_SIZE =  4,
+};
 
 struct directory_item {
 	char exten[AST_MAX_EXTENSION + 1];
@@ -97,7 +124,10 @@
 };
 
 AST_APP_OPTIONS(directory_app_options, {
-	AST_APP_OPTION('f', OPT_LISTBYFIRSTNAME),
+	AST_APP_OPTION_ARG('f', OPT_LISTBYFIRSTNAME, OPT_ARG_FIRSTNAME),
+	AST_APP_OPTION_ARG('l', OPT_LISTBYLASTNAME, OPT_ARG_LASTNAME),
+	AST_APP_OPTION_ARG('b', OPT_LISTBYEITHER, OPT_ARG_EITHER),
+	AST_APP_OPTION_ARG('p', OPT_PAUSE, OPT_ARG_PAUSE),
 	AST_APP_OPTION('e', OPT_SAYEXTENSION),
 	AST_APP_OPTION('v', OPT_FROMVOICEMAIL),
 	AST_APP_OPTION('m', OPT_SELECTFROMMENU),
@@ -500,10 +530,11 @@
 	mailbox = NULL;
 	while ( (mailbox = ast_category_browse(rtdata, mailbox)) ) {
 		fullname = ast_variable_retrieve(rtdata, mailbox, "fullname");
-		hidefromdir = ast_variable_retrieve(rtdata, mailbox, "hidefromdir");
-		snprintf(tmp, sizeof(tmp), "no-password,%s,hidefromdir=%s",
-			fullname ? fullname : "",
-			hidefromdir ? hidefromdir : "no");
+		if (ast_true((hidefromdir = ast_variable_retrieve(rtdata, mailbox, "hidefromdir")))) {
+			/* Skip hidden */
+			continue;
+		}
+		snprintf(tmp, sizeof(tmp), "no-password,%s", S_OR(fullname, ""));
 		var = ast_variable_new(mailbox, tmp, "");
 		if (var)
 			ast_variable_append(cat, var);
@@ -556,7 +587,7 @@
 
 typedef AST_LIST_HEAD_NOLOCK(, directory_item) itemlist;
 
-static int search_directory(const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, int use_first_name, itemlist *alist)
+static int search_directory(const char *context, struct ast_config *vmcfg, struct ast_config *ucfg, const char *ext, struct ast_flags flags, itemlist *alist)
 {
 	struct ast_variable *v;
 	char buf[AST_MAX_EXTENSION + 1], *pos, *bufptr, *cat;
@@ -578,7 +609,14 @@
 		strsep(&bufptr, ",");
 		pos = strsep(&bufptr, ",");
 
-		res = check_match(&item, pos, v->name, ext, use_first_name);
+		res = 0;
+		if (ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
+			res = check_match(&item, pos, v->name, ext, 0 /* use_first_name */);
+		}
+		if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
+			res = check_match(&item, pos, v->name, ext, 1 /* use_first_name */);
+		}
+
 		if (!res)
 			continue;
 		else if (res < 0)
@@ -601,7 +639,14 @@
 			if (!pos)
 				continue;
 
-			res = check_match(&item, pos, cat, ext, use_first_name);
+			res = 0;
+			if (ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
+				res = check_match(&item, pos, v->name, ext, 0 /* use_first_name */);
+			}
+			if (!res && ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
+				res = check_match(&item, pos, v->name, ext, 1 /* use_first_name */);
+			}
+
 			if (!res)
 				continue;
 			else if (res < 0)
@@ -649,14 +694,14 @@
 	}
 }
 
-static int do_directory(struct ast_channel *chan, struct ast_config *vmcfg, struct ast_config *ucfg, char *context, char *dialcontext, char digit, struct ast_flags *flags)
+static int do_directory(struct ast_channel *chan, struct ast_config *vmcfg, struct ast_config *ucfg, char *context, char *dialcontext, char digit, int digits, struct ast_flags *flags)
 {
 	/* Read in the first three digits..  "digit" is the first digit, already read */
 	int res = 0;
 	itemlist alist = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
 	struct directory_item *item, **ptr, **sorted = NULL;
 	int count, i;
-	char ext[NUMDIGITS + 1] = "";
+	char ext[10] = "";
 
 	if (ast_strlen_zero(context)) {
 		ast_log(LOG_WARNING,
@@ -674,10 +719,10 @@
 	}
 
 	ext[0] = digit;
-	if (ast_readstring(chan, ext + 1, NUMDIGITS - 1, 3000, 3000, "#") < 0)
+	if (ast_readstring(chan, ext + 1, digits - 1, 3000, 3000, "#") < 0)
 		return -1;
 
-	res = search_directory(context, vmcfg, ucfg, ext, ast_test_flag(flags, OPT_LISTBYFIRSTNAME), &alist);
+	res = search_directory(context, vmcfg, ucfg, ext, *flags, &alist);
 	if (res)
 		goto exit;
 
@@ -735,12 +780,14 @@
 
 static int directory_exec(struct ast_channel *chan, void *data)
 {
-	int res = 0;
+	int res = 0, digit = 3;
 	struct ast_config *cfg, *ucfg;
 	const char *dirintro;
-	char *parse, *opts[0];
+	char *parse, *opts[OPT_ARG_ARRAY_SIZE];
 	struct ast_flags flags = { 0 };
 	struct ast_flags config_flags = { 0 };
+	enum { FIRST, LAST, BOTH } which = LAST;
+	char digits[9] = "digits/3";
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(vmcontext);
 		AST_APP_ARG(dialcontext);
@@ -773,15 +820,53 @@
 	dirintro = ast_variable_retrieve(cfg, args.vmcontext, "directoryintro");
 	if (ast_strlen_zero(dirintro))
 		dirintro = ast_variable_retrieve(cfg, "general", "directoryintro");
-	if (ast_strlen_zero(dirintro))
-		dirintro = ast_test_flag(&flags, OPT_LISTBYFIRSTNAME) ? "dir-intro-fn" : "dir-intro";
+
+	if (ast_test_flag(&flags, OPT_LISTBYFIRSTNAME) && ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
+		if (!ast_strlen_zero(opts[OPT_ARG_EITHER])) {
+			digit = atoi(opts[OPT_ARG_EITHER]);
+		}
+		which = BOTH;
+	} else if (ast_test_flag(&flags, OPT_LISTBYFIRSTNAME)) {
+		if (!ast_strlen_zero(opts[OPT_ARG_FIRSTNAME])) {
+			digit = atoi(opts[OPT_ARG_FIRSTNAME]);
+		}
+		which = FIRST;
+	} else {
+		if (!ast_strlen_zero(opts[OPT_ARG_LASTNAME])) {
+			digit = atoi(opts[OPT_ARG_LASTNAME]);
+		}
+		which = LAST;
+	}
+
+	/* If no options specified, search by last name */
+	if (!ast_test_flag(&flags, OPT_LISTBYFIRSTNAME) && !ast_test_flag(&flags, OPT_LISTBYLASTNAME)) {
+		ast_set_flag(&flags, OPT_LISTBYLASTNAME);
+		which = LAST;
+	}
+
+	if (digit > 9) {
+		digit = 9;
+	} else if (digit < 1) {
+		digit = 3;
+	}
+	digits[7] = digit + '0';
 
 	if (chan->_state != AST_STATE_UP)
 		res = ast_answer(chan);
 
 	for (;;) {
-		if (!res)
+		if (!ast_strlen_zero(dirintro) && !res) {
 			res = ast_stream_and_wait(chan, dirintro, AST_DIGIT_ANY);
+		} else if (!res) {
+			res = ast_stream_and_wait(chan, "dir-welcome", AST_DIGIT_ANY) ||
+				ast_stream_and_wait(chan, "dir-pls-enter", AST_DIGIT_ANY) ||
+				ast_stream_and_wait(chan, digits, AST_DIGIT_ANY) ||
+				ast_stream_and_wait(chan, 
+					which == FIRST ? "dir-first" :
+					which == LAST ? "dir-last" :
+					"dir-firstlast", AST_DIGIT_ANY) ||
+				ast_stream_and_wait(chan, "dir-usingkeypad", AST_DIGIT_ANY);
+		}
 		ast_stopstream(chan);
 		if (!res)
 			res = ast_waitfordigit(chan, 5000);
@@ -789,7 +874,7 @@
 		if (res <= 0)
 			break;
 
-		res = do_directory(chan, cfg, ucfg, args.vmcontext, args.dialcontext, res, &flags);
+		res = do_directory(chan, cfg, ucfg, args.vmcontext, args.dialcontext, res, digit, &flags);
 		if (res)
 			break;
 

Modified: team/group/cdr_backend_ast_str/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/apps/app_meetme.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/apps/app_meetme.c (original)
+++ team/group/cdr_backend_ast_str/apps/app_meetme.c Thu Mar 20 23:04:01 2008
@@ -54,7 +54,6 @@
 #include "asterisk/utils.h"
 #include "asterisk/translate.h"
 #include "asterisk/ulaw.h"
-#include "asterisk/astobj.h"
 #include "asterisk/devicestate.h"
 #include "asterisk/dial.h"
 #include "asterisk/causes.h"
@@ -5077,7 +5076,9 @@
 	conf = NULL;
 	trunk->chan = NULL;
 	trunk->on_hold = 0;
-	
+
+	sla_change_trunk_state(trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
+
 	if (!pbx_builtin_getvar_helper(chan, "SLATRUNK_STATUS"))
 		pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "SUCCESS");
 
@@ -5092,7 +5093,6 @@
 	AST_LIST_TRAVERSE_SAFE_END;
 	ast_mutex_unlock(&sla.lock);
 	if (ringing_trunk) {
-		sla_change_trunk_state(ringing_trunk->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL);
 		ast_free(ringing_trunk);
 		pbx_builtin_setvar_helper(chan, "SLATRUNK_STATUS", "UNANSWERED");
 		/* Queue reprocessing of ringing trunks to make stations stop ringing

Modified: team/group/cdr_backend_ast_str/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/apps/app_minivm.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/apps/app_minivm.c (original)
+++ team/group/cdr_backend_ast_str/apps/app_minivm.c Thu Mar 20 23:04:01 2008
@@ -155,7 +155,6 @@
 
 
 #include "asterisk/paths.h"	/* use various paths */
-#include "asterisk/astobj.h"
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
 #include "asterisk/channel.h"

Modified: team/group/cdr_backend_ast_str/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/channels/chan_h323.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/channels/chan_h323.c (original)
+++ team/group/cdr_backend_ast_str/channels/chan_h323.c Thu Mar 20 23:04:01 2008
@@ -1053,7 +1053,7 @@
 		/* Allocate dsp for in-band DTMF support */
 		if (pvt->options.dtmfmode & H323_DTMF_INBAND) {
 			pvt->vad = ast_dsp_new();
-			ast_dsp_set_features(pvt->vad, DSP_FEATURE_DTMF_DETECT);
+			ast_dsp_set_features(pvt->vad, DSP_FEATURE_DIGIT_DETECT);
 		}
 		/* Register channel functions. */
 		ch->tech_pvt = pvt;

Modified: team/group/cdr_backend_ast_str/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/channels/chan_iax2.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/channels/chan_iax2.c (original)
+++ team/group/cdr_backend_ast_str/channels/chan_iax2.c Thu Mar 20 23:04:01 2008
@@ -2959,10 +2959,9 @@
 		if (var && sin) {
 			for (tmp = var; tmp; tmp = tmp->next) {
 				if (!strcasecmp(tmp->name, "host")) {
-					struct in_addr sin2;
-					struct ast_dnsmgr_entry *dnsmgr = NULL;
-					memset(&sin2, 0, sizeof(sin2));
-					if ((ast_dnsmgr_lookup(tmp->value, &sin2, &dnsmgr) < 0) || (memcmp(&sin2, &sin->sin_addr, sizeof(sin2)) != 0)) {
+					struct ast_hostent ahp;
+					struct hostent *hp;
+					if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
 						/* No match */
 						ast_variables_destroy(var);
 						var = NULL;
@@ -3072,10 +3071,9 @@
 		if (var) {
 			for (tmp = var; tmp; tmp = tmp->next) {
 				if (!strcasecmp(tmp->name, "host")) {
-					struct in_addr sin2;
-					struct ast_dnsmgr_entry *dnsmgr = NULL;
-					memset(&sin2, 0, sizeof(sin2));
-					if ((ast_dnsmgr_lookup(tmp->value, &sin2, &dnsmgr) < 0) || (memcmp(&sin2, &sin->sin_addr, sizeof(sin2)) != 0)) {
+					struct ast_hostent ahp;
+					struct hostent *hp;
+					if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
 						/* No match */
 						ast_variables_destroy(var);
 						var = NULL;

Modified: team/group/cdr_backend_ast_str/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/channels/chan_mgcp.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/channels/chan_mgcp.c (original)
+++ team/group/cdr_backend_ast_str/channels/chan_mgcp.c Thu Mar 20 23:04:01 2008
@@ -1511,9 +1511,9 @@
 			ast_channel_set_fd(tmp, 0, ast_rtp_fd(sub->rtp));
 		if (i->dtmfmode & (MGCP_DTMF_INBAND | MGCP_DTMF_HYBRID)) {
 			i->dsp = ast_dsp_new();
-			ast_dsp_set_features(i->dsp,DSP_FEATURE_DTMF_DETECT);
+			ast_dsp_set_features(i->dsp, DSP_FEATURE_DIGIT_DETECT);
 			/* this is to prevent clipping of dtmf tones during dsp processing */
-			ast_dsp_digitmode(i->dsp, DSP_DIGITMODE_NOQUELCH);
+			ast_dsp_set_digitmode(i->dsp, DSP_DIGITMODE_NOQUELCH);
 		} else {
 			i->dsp = NULL;
 		}

Modified: team/group/cdr_backend_ast_str/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/channels/chan_misdn.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/channels/chan_misdn.c (original)
+++ team/group/cdr_backend_ast_str/channels/chan_misdn.c Thu Mar 20 23:04:01 2008
@@ -2154,9 +2154,9 @@
 			ch->dsp = ast_dsp_new();
 		if (ch->dsp) {
 			if (ch->faxdetect) 
-				ast_dsp_set_features(ch->dsp, DSP_FEATURE_DTMF_DETECT | DSP_FEATURE_FAX_DETECT);
+				ast_dsp_set_features(ch->dsp, DSP_FEATURE_DIGIT_DETECT | DSP_FEATURE_FAX_DETECT);
 			else 
-				ast_dsp_set_features(ch->dsp, DSP_FEATURE_DTMF_DETECT );
+				ast_dsp_set_features(ch->dsp, DSP_FEATURE_DIGIT_DETECT );
 		}
 		if (!ch->trans)
 			ch->trans = ast_translator_build_path(AST_FORMAT_SLINEAR, AST_FORMAT_ALAW);
@@ -5492,7 +5492,7 @@
 		if (!ch->dsp)
 			ch->dsp = ast_dsp_new();
 		if (ch->dsp)
-			ast_dsp_set_features(ch->dsp, DSP_FEATURE_DTMF_DETECT | DSP_FEATURE_FAX_DETECT);
+			ast_dsp_set_features(ch->dsp, DSP_FEATURE_DIGIT_DETECT | DSP_FEATURE_FAX_DETECT);
 		if (!ch->trans)
 			ch->trans = ast_translator_build_path(AST_FORMAT_SLINEAR, AST_FORMAT_ALAW);
 	}

Modified: team/group/cdr_backend_ast_str/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/channels/chan_sip.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/channels/chan_sip.c (original)
+++ team/group/cdr_backend_ast_str/channels/chan_sip.c Thu Mar 20 23:04:01 2008
@@ -1303,7 +1303,6 @@
 	struct sip_st_dlg *stimer;		/*!< SIP Session-Timers */              
 };
 
-
 /*! Max entires in the history list for a sip_pvt */
 #define MAX_HISTORY_ENTRIES 50
 
@@ -1547,6 +1546,8 @@
 	struct timeval regtime;		/*!< Last successful registration time */
 	int callid_valid;		/*!< 0 means we haven't chosen callid for this registry yet. */
 	unsigned int ocseq;		/*!< Sequence number we got to for REGISTERs for this registry */
+	struct ast_dnsmgr_entry *dnsmgr;	/*!<  DNS refresh manager for register */
+	struct sockaddr_in us;		/*!< Who the server thinks we are */
 	int noncecount;			/*!< Nonce-count */
 	char lastmsg[256];		/*!< Last Message sent/received */
 };
@@ -1959,7 +1960,7 @@
 static const struct sockaddr_in *sip_real_dst(const struct sip_pvt *p);
 static void build_via(struct sip_pvt *p);
 static int create_addr_from_peer(struct sip_pvt *r, struct sip_peer *peer);
-static int create_addr(struct sip_pvt *dialog, const char *opeer);
+static int create_addr(struct sip_pvt *dialog, const char *opeer, struct in_addr *sin);
 static char *generate_random_string(char *buf, size_t size);
 static void build_callid_pvt(struct sip_pvt *pvt);
 static void build_callid_registry(struct sip_registry *reg, struct in_addr ourip, const char *fromdomain);
@@ -2528,7 +2529,7 @@
 	int res = 0;
 	const struct sockaddr_in *dst = sip_real_dst(p);
 
-	ast_debug(1, "Trying to put '%.10s' onto %s socket...\n", data->str, get_transport(p->socket.type));
+	ast_debug(1, "Trying to put '%.10s' onto %s socket destined for %s\n", data->str, get_transport(p->socket.type), ast_inet_ntoa(dst->sin_addr));
 
 	if (sip_prepare_socket(p) < 0)
 		return XMIT_ERROR;
@@ -3603,10 +3604,9 @@
 			if (var) {
 				for (tmp = var; tmp; tmp = tmp->next) {
 					if (!strcasecmp(var->name, "host")) {
-						struct in_addr sin2;
-						struct ast_dnsmgr_entry *dnsmgr = NULL;
-						memset(&sin2, 0, sizeof(sin2));
-						if ((ast_dnsmgr_lookup(tmp->value, &sin2, &dnsmgr) < 0) || (memcmp(&sin2, &sin->sin_addr, sizeof(sin2)) != 0)) {
+						struct hostent *hp;
+						struct ast_hostent ahp;
+						if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {
 							/* No match */
 							ast_variables_destroy(var);
 							var = NULL;
@@ -4054,7 +4054,7 @@
 /*! \brief create address structure from peer name
  *      Or, if peer not found, find it in the global DNS 
  *      returns TRUE (-1) on failure, FALSE on success */
-static int create_addr(struct sip_pvt *dialog, const char *opeer)
+static int create_addr(struct sip_pvt *dialog, const char *opeer, struct in_addr *sin)
 {
 	struct hostent *hp;
 	struct ast_hostent ahp;
@@ -4063,6 +4063,7 @@
 	int portno;
 	char host[MAXHOSTNAMELEN], *hostn;
 	char peername[256];
+	int srv_ret = 0;
 
 	ast_copy_string(peername, opeer, sizeof(peername));
 	port = strchr(peername, ':');
@@ -4094,27 +4095,32 @@
 
 	/* Let's see if we can find the host in DNS. First try DNS SRV records,
    	   then hostname lookup */
-
 	hostn = peername;
 	portno = port ? atoi(port) : (dialog->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT;
 	if (global_srvlookup) {
 		char service[MAXHOSTNAMELEN];
 		int tportno;
-		int ret;
 
 		snprintf(service, sizeof(service), "_sip._%s.%s", get_transport(dialog->socket.type), peername);
-		ret = ast_get_srv(NULL, host, sizeof(host), &tportno, service);
-		if (ret > 0) {
+		srv_ret = ast_get_srv(NULL, host, sizeof(host), &tportno, service);
+		if (srv_ret > 0) {
 			hostn = host;
 			portno = tportno;
 		}
 	}
-	hp = ast_gethostbyname(hostn, &ahp);
-	if (!hp) {
-		ast_log(LOG_WARNING, "No such host: %s\n", peername);
-		return -1;
-	}
-	memcpy(&dialog->sa.sin_addr, hp->h_addr, sizeof(dialog->sa.sin_addr));
+
+	if (sin && srv_ret <= 0) {
+		memcpy(&dialog->sa.sin_addr, sin, sizeof(dialog->sa.sin_addr));
+		ast_log(LOG_DEBUG, "IP lookup for hostname=%s, using dnsmgr resolved to %s...\n", peername, ast_inet_ntoa(*sin));
+	} else {
+		hp = ast_gethostbyname(hostn, &ahp);
+		if (!hp) {
+			ast_log(LOG_WARNING, "No such host: %s\n", peername);
+			return -1;
+		}
+		memcpy(&dialog->sa.sin_addr, hp->h_addr, sizeof(dialog->sa.sin_addr));
+	}
+
 	dialog->sa.sin_port = htons(portno);
 	dialog->recv = dialog->sa;
 	return 0;
@@ -4252,6 +4258,7 @@
 	AST_SCHED_DEL(sched, reg->timeout);
 	ast_string_field_free_memory(reg);
 	regobjs--;
+	ast_dnsmgr_release(reg->dnsmgr);
 	ast_free(reg);
 	
 }
@@ -5306,9 +5313,9 @@
 
 	if (ast_test_flag(&i->flags[0], SIP_DTMF) ==  SIP_DTMF_INBAND) {
 		i->vad = ast_dsp_new();
-		ast_dsp_set_features(i->vad, DSP_FEATURE_DTMF_DETECT);
+		ast_dsp_set_features(i->vad, DSP_FEATURE_DIGIT_DETECT);
 		if (global_relaxdtmf)
-			ast_dsp_digitmode(i->vad, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_RELAXDTMF);
+			ast_dsp_set_digitmode(i->vad, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_RELAXDTMF);
 	}
 
 	/* Set file descriptors for audio, video, realtime text and UDPTL as needed */
@@ -9138,6 +9145,11 @@
 	if (!r)
 		return 0;
 
+	if (r->dnsmgr) {
+		/* If the registration has timed out, maybe the IP changed.  Force a refresh. */
+		ast_dnsmgr_refresh(r->dnsmgr);
+	}
+
 	ast_log(LOG_NOTICE, "   -- Registration for '%s@%s' timed out, trying again (Attempt #%d)\n", r->username, r->hostname, r->regattempts); 
 	/* If the initial tranmission failed, we may not have an existing dialog,
 	 * so it is possible that r->call == NULL.
@@ -9189,10 +9201,14 @@
 	struct sip_pvt *p;
 
 	/* exit if we are already in process with this registrar ?*/
-	if ( r == NULL || ((auth==NULL) && (r->regstate==REG_STATE_REGSENT || r->regstate==REG_STATE_AUTHSENT))) {
+	if (r == NULL || ((auth == NULL) && (r->regstate == REG_STATE_REGSENT || r->regstate == REG_STATE_AUTHSENT))) {
 		ast_log(LOG_NOTICE, "Strange, trying to register %s@%s when registration already pending\n", r->username, r->hostname);
 		return 0;
 	}
+
+	if (r->dnsmgr == NULL) {
+		ast_dnsmgr_lookup(r->hostname, &r->us.sin_addr, &r->dnsmgr);
+	} 
 
 	if (r->call) {	/* We have a registration */
 		if (!auth) {
@@ -9221,7 +9237,7 @@
 		p->outboundproxy = obproxy_get(p, NULL);
 
 		/* Find address to hostname */
-		if (create_addr(p, r->hostname)) {
+		if (create_addr(p, r->hostname, &r->us.sin_addr)) {
 			/* we have what we hope is a temporary network error,
 			 * probably DNS.  We need to reschedule a registration try */
 			sip_destroy(p);
@@ -13865,7 +13881,7 @@
 			return CLI_FAILURE;
 		}
 
-		if (create_addr(p, a->argv[i])) {
+		if (create_addr(p, a->argv[i], NULL)) {
 			/* Maybe they're not registered, etc. */
 			sip_destroy(p);
 			ast_cli(a->fd, "Could not create address for '%s'\n", a->argv[i]);
@@ -19111,7 +19127,7 @@
 		ext = extension (user part of URI)
 		dnid = destination of the call (applies to the To: header)
 	*/
-	if (create_addr(p, host)) {
+	if (create_addr(p, host, NULL)) {
 		*cause = AST_CAUSE_UNREGISTERED;
 		ast_debug(3, "Cant create SIP call - target device not registred\n");
 		sip_destroy(p);
@@ -21166,7 +21182,7 @@
 	if (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_INBAND) {
 		if (!p->vad) {
 			p->vad = ast_dsp_new();
-			ast_dsp_set_features(p->vad, DSP_FEATURE_DTMF_DETECT);
+			ast_dsp_set_features(p->vad, DSP_FEATURE_DIGIT_DETECT);
 		}
 	} else {
 		if (p->vad) {

Modified: team/group/cdr_backend_ast_str/channels/chan_usbradio.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/channels/chan_usbradio.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/channels/chan_usbradio.c (original)
+++ team/group/cdr_backend_ast_str/channels/chan_usbradio.c Thu Mar 20 23:04:01 2008
@@ -2285,7 +2285,7 @@
 	o->dsp = ast_dsp_new();
 	if (o->dsp) {
 		ast_dsp_set_features(o->dsp, DSP_FEATURE_DTMF_DETECT);
-		ast_dsp_digitmode(o->dsp, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_RELAXDTMF);
+		ast_dsp_set_digitmode(o->dsp, DSP_DIGITMODE_DTMF | DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_RELAXDTMF);
 	}
 
 	if (o->rxctcssfreq != 0 && o->rxdemod == RX_AUDIO_SPEAKER)

Modified: team/group/cdr_backend_ast_str/channels/chan_vpb.cc
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/channels/chan_vpb.cc?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/channels/chan_vpb.cc (original)
+++ team/group/cdr_backend_ast_str/channels/chan_vpb.cc Thu Mar 20 23:04:01 2008
@@ -1633,10 +1633,10 @@
 	}
 	if (use_ast_dtmfdet) {
 		tmp->vad = ast_dsp_new();
-		ast_dsp_set_features(tmp->vad, DSP_FEATURE_DTMF_DETECT);
-		ast_dsp_digitmode(tmp->vad, DSP_DIGITMODE_DTMF);
+		ast_dsp_set_features(tmp->vad, DSP_FEATURE_DIGIT_DETECT);
+		ast_dsp_set_digitmode(tmp->vad, DSP_DIGITMODE_DTMF);
 		if (relaxdtmf)
-			ast_dsp_digitmode(tmp->vad, DSP_DIGITMODE_DTMF|DSP_DIGITMODE_RELAXDTMF);
+			ast_dsp_set_digitmode(tmp->vad, DSP_DIGITMODE_DTMF|DSP_DIGITMODE_RELAXDTMF);
 	} else {
 		tmp->vad = NULL;
 	}

Modified: team/group/cdr_backend_ast_str/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/group/cdr_backend_ast_str/channels/chan_zap.c?view=diff&rev=110472&r1=110471&r2=110472
==============================================================================
--- team/group/cdr_backend_ast_str/channels/chan_zap.c (original)
+++ team/group/cdr_backend_ast_str/channels/chan_zap.c Thu Mar 20 23:04:01 2008
@@ -3000,7 +3000,7 @@
 		p->origcid_name = NULL;
 	}	
 	if (p->dsp)
-		ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_DTMF | p->dtmfrelax);
+		ast_dsp_set_digitmode(p->dsp, DSP_DIGITMODE_DTMF | p->dtmfrelax);
 	if (p->exten)
 		p->exten[0] = '\0';
 
@@ -3452,15 +3452,15 @@
 		switch (*cp) {
 		case 1:
 			ast_debug(1, "Set option TONE VERIFY, mode: MUTECONF(1) on %s\n",chan->name);
-			ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_MUTECONF | p->dtmfrelax);  /* set mute mode if desired */
+			ast_dsp_set_digitmode(p->dsp, DSP_DIGITMODE_MUTECONF | p->dtmfrelax);  /* set mute mode if desired */
 			break;
 		case 2:
 			ast_debug(1, "Set option TONE VERIFY, mode: MUTECONF/MAX(2) on %s\n",chan->name);
-			ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_MUTEMAX | p->dtmfrelax);  /* set mute mode if desired */
+			ast_dsp_set_digitmode(p->dsp, DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_MUTEMAX | p->dtmfrelax);  /* set mute mode if desired */
 			break;
 		default:
 			ast_debug(1, "Set option TONE VERIFY, mode: OFF(0) on %s\n",chan->name);
-			ast_dsp_digitmode(p->dsp,DSP_DIGITMODE_DTMF | p->dtmfrelax);  /* set mute mode if desired */

[... 404 lines stripped ...]



More information about the asterisk-commits mailing list