[asterisk-commits] oej: branch oej/multiparking r64207 - in /team/oej/multiparking: ./ apps/ cha...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon May 14 07:08:13 MST 2007


Author: oej
Date: Mon May 14 09:08:12 2007
New Revision: 64207

URL: http://svn.digium.com/view/asterisk?view=rev&rev=64207
Log:
Trying to reset this branch

Modified:
    team/oej/multiparking/   (props changed)
    team/oej/multiparking/CHANGES
    team/oej/multiparking/apps/app_dumpchan.c
    team/oej/multiparking/apps/app_meetme.c
    team/oej/multiparking/apps/app_stack.c
    team/oej/multiparking/apps/app_voicemail.c
    team/oej/multiparking/channels/chan_iax2.c
    team/oej/multiparking/channels/chan_sip.c
    team/oej/multiparking/channels/chan_zap.c
    team/oej/multiparking/configs/extensions.conf.sample
    team/oej/multiparking/configs/sla.conf.sample
    team/oej/multiparking/configure
    team/oej/multiparking/configure.ac
    team/oej/multiparking/include/asterisk/channel.h
    team/oej/multiparking/main/channel.c
    team/oej/multiparking/main/cli.c
    team/oej/multiparking/main/pbx.c
    team/oej/multiparking/main/rtp.c
    team/oej/multiparking/main/say.c
    team/oej/multiparking/main/slinfactory.c
    team/oej/multiparking/pbx/ael/ael-test/ref.ael-test2
    team/oej/multiparking/pbx/ael/ael-test/ref.ael-test3
    team/oej/multiparking/pbx/ael/ael-test/ref.ael-test4
    team/oej/multiparking/pbx/ael/ael-test/ref.ael-test6
    team/oej/multiparking/pbx/ael/ael-test/ref.ael-test7
    team/oej/multiparking/pbx/ael/ael-test/ref.ael-vtest13
    team/oej/multiparking/res/res_jabber.c

Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/oej/multiparking/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon May 14 09:08:12 2007
@@ -1,1 +1,1 @@
-/trunk:1-57451
+/trunk:1-57996

Modified: team/oej/multiparking/CHANGES
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/CHANGES?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/CHANGES (original)
+++ team/oej/multiparking/CHANGES Mon May 14 09:08:12 2007
@@ -67,6 +67,7 @@
   * Added 'o' and 'X' options to Chanspy.
   * Added the parkedcallreparking option to features.conf
   * SMDI is now enabled in voicemail using the smdienable option.
+  * Added zap show version CLI command to chan_zap.
 
 AMI - The manager (TCP/TLS/HTTP)
 --------------------------------

Modified: team/oej/multiparking/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_dumpchan.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/apps/app_dumpchan.c (original)
+++ team/oej/multiparking/apps/app_dumpchan.c Mon May 14 09:08:12 2007
@@ -86,7 +86,7 @@
 			 "CallerIDName=       %s\n"
 			 "DNIDDigits=         %s\n"
 			 "Parkinglot=         %s\n"
-			 "RDNIS=              %s\n" 
+ 			 "Language=           %s\n"
 			 "State=              %s (%d)\n"
 			 "Rings=              %d\n"
 			 "NativeFormat=       %s\n"
@@ -115,6 +115,7 @@
 			 S_OR(c->cid.cid_dnid, "(N/A)"),
 			 S_OR(c->cid.cid_rdnis, "(N/A)"),
 			 c->parkinglot,
+			 c->language,
 			 ast_state2str(c->_state),
 			 c->_state,
 			 c->rings,

Modified: team/oej/multiparking/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_meetme.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/apps/app_meetme.c (original)
+++ team/oej/multiparking/apps/app_meetme.c Mon May 14 09:08:12 2007
@@ -520,7 +520,7 @@
  *  conversion... the numbers have been modified
  *  to give the user a better level of adjustability
  */
-static const char const gain_map[] = {
+static char const gain_map[] = {
 	-15,
 	-13,
 	-10,
@@ -765,18 +765,6 @@
 		free(cnf);
 		cnf = NULL;
 		goto cnfout;
-	}
-	cnf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL);
-	if (cnf->lchan) {
-		ast_set_read_format(cnf->lchan, AST_FORMAT_SLINEAR);
-		ast_set_write_format(cnf->lchan, AST_FORMAT_SLINEAR);
-		ztc.chan = 0;
-		ztc.confmode = ZT_CONF_CONFANN | ZT_CONF_CONFANNMON;
-		if (ioctl(cnf->lchan->fds[0], ZT_SETCONF, &ztc)) {
-			ast_log(LOG_WARNING, "Error setting conference\n");
-			ast_hangup(cnf->lchan);
-			cnf->lchan = NULL;
-		}
 	}
 	/* Fill the conference struct */
 	cnf->start = time(NULL);
@@ -1402,11 +1390,22 @@
 		}
 	}
 
-	if ((conf->recording == MEETME_RECORD_OFF) && ((confflags & CONFFLAG_RECORDCONF) || (conf->lchan))) {
-		pthread_attr_init(&conf->attr);
-		pthread_attr_setdetachstate(&conf->attr, PTHREAD_CREATE_DETACHED);
-		ast_pthread_create_background(&conf->recordthread, &conf->attr, recordthread, conf);
-		pthread_attr_destroy(&conf->attr);
+	if ((conf->recording == MEETME_RECORD_OFF) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL)))) {
+		ast_set_read_format(conf->lchan, AST_FORMAT_SLINEAR);
+		ast_set_write_format(conf->lchan, AST_FORMAT_SLINEAR);
+		ztc.chan = 0;
+		ztc.confno = conf->zapconf;
+		ztc.confmode = ZT_CONF_CONFANN | ZT_CONF_CONFANNMON;
+		if (ioctl(conf->lchan->fds[0], ZT_SETCONF, &ztc)) {
+			ast_log(LOG_WARNING, "Error starting listen channel\n");
+			ast_hangup(conf->lchan);
+			conf->lchan = NULL;
+		} else {
+			pthread_attr_init(&conf->attr);
+			pthread_attr_setdetachstate(&conf->attr, PTHREAD_CREATE_DETACHED);
+			ast_pthread_create_background(&conf->recordthread, &conf->attr, recordthread, conf);
+			pthread_attr_destroy(&conf->attr);
+		}
 	}
 
 	time(&user->jointime);
@@ -4704,7 +4703,7 @@
 
 static int load_module(void)
 {
-	int res;
+	int res = 0;
 
 	res |= load_config(0);
 

Modified: team/oej/multiparking/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_stack.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/apps/app_stack.c (original)
+++ team/oej/multiparking/apps/app_stack.c Mon May 14 09:08:12 2007
@@ -44,7 +44,6 @@
 #include "asterisk/app.h"
 
 #define STACKVAR	"~GOSUB~STACK~"
-
 
 static const char *app_gosub = "Gosub";
 static const char *app_gosubif = "GosubIf";
@@ -73,55 +72,118 @@
 "  Removes last label on the stack, discarding it.\n";
 
 
-static int pop_exec(struct ast_channel *chan, void *data)
-{
-	const char *frame = pbx_builtin_getvar_helper(chan, STACKVAR);
-	int numargs = 0, i;
+static void gosub_free(void *data);
+
+static struct ast_datastore_info stack_info = {
+	.type = "GOSUB",
+	.destroy = gosub_free,
+};
+
+struct gosub_stack_frame {
+	AST_LIST_ENTRY(gosub_stack_frame) entries;
+	/* 100 arguments is all that we support anyway, but this will handle up to 255 */
+	unsigned char arguments;
+	int priority;
+	char *context;
+	char extension[0];
+};
+
+static void gosub_release_frame(struct ast_channel *chan, struct gosub_stack_frame *frame)
+{
+	unsigned char i;
 	char argname[15];
 
-	/* Pop any arguments for this stack frame off the variable stack */
-	if (frame) {
-		numargs = atoi(frame);
-		for (i = 1; i <= numargs; i++) {
-			snprintf(argname, sizeof(argname), "ARG%d", i);
+	/* If chan is not defined, then we're calling it as part of gosub_free,
+	 * and the channel variables will be deallocated anyway.  Otherwise, we're
+	 * just releasing a single frame, so we need to clean up the arguments for
+	 * that frame, so that we re-expose the variables from the previous frame
+	 * that were hidden by this one.
+	 */
+	if (chan) {
+		for (i = 1; i <= frame->arguments && i != 0; i++) {
+			snprintf(argname, sizeof(argname), "ARG%hhd", i);
 			pbx_builtin_setvar_helper(chan, argname, NULL);
 		}
 	}
-
-	/* Remove the last frame from the Gosub stack */
-	pbx_builtin_setvar_helper(chan, STACKVAR, NULL);
+	ast_free(frame);
+}
+
+static struct gosub_stack_frame *gosub_allocate_frame(const char *context, const char *extension, int priority, unsigned char arguments)
+{
+	struct gosub_stack_frame *new = NULL;
+	int len_extension = strlen(extension), len_context = strlen(context);
+
+	if ((new = ast_calloc(1, sizeof(*new) + 2 + len_extension + len_context))) {
+		strcpy(new->extension, extension);
+		new->context = new->extension + len_extension + 1;
+		strcpy(new->context, context);
+		new->priority = priority;
+		new->arguments = arguments;
+	}
+	return new;
+}
+
+static void gosub_free(void *data)
+{
+	AST_LIST_HEAD(, gosub_stack_frame) *oldlist = data;
+	struct gosub_stack_frame *oldframe;
+	AST_LIST_LOCK(oldlist);
+	while ((oldframe = AST_LIST_REMOVE_HEAD(oldlist, entries))) {
+		gosub_release_frame(NULL, oldframe);
+	}
+	AST_LIST_UNLOCK(oldlist);
+	AST_LIST_HEAD_DESTROY(oldlist);
+	ast_free(oldlist);
+}
+
+static int pop_exec(struct ast_channel *chan, void *data)
+{
+	struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
+	struct gosub_stack_frame *oldframe;
+	AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+
+	if (!stack_store) {
+		ast_log(LOG_WARNING, "%s called with no gosub stack allocated.\n", app_pop);
+		return 0;
+	}
+
+	oldlist = stack_store->data;
+	AST_LIST_LOCK(oldlist);
+	oldframe = AST_LIST_REMOVE_HEAD(oldlist, entries);
+	AST_LIST_UNLOCK(oldlist);
+
+	if (oldframe)
+		gosub_release_frame(chan, oldframe);
+	else
+		ast_log(LOG_DEBUG, "%s called with an empty gosub stack\n", app_pop);
 
 	return 0;
 }
 
 static int return_exec(struct ast_channel *chan, void *data)
 {
-	const char *label = pbx_builtin_getvar_helper(chan, STACKVAR);
-	char argname[15], *retval = data;
-	int numargs, i;
-
-	if (ast_strlen_zero(label)) {
+	struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
+	struct gosub_stack_frame *oldframe;
+	AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+	char *retval = data;
+
+	if (!stack_store) {
+		ast_log(LOG_ERROR, "Return without Gosub: stack is unallocated\n");
+		return -1;
+	}
+
+	oldlist = stack_store->data;
+	AST_LIST_LOCK(oldlist);
+	oldframe = AST_LIST_REMOVE_HEAD(oldlist, entries);
+	AST_LIST_UNLOCK(oldlist);
+
+	if (!oldframe) {
 		ast_log(LOG_ERROR, "Return without Gosub: stack is empty\n");
 		return -1;
 	}
 
-	/* Pop any arguments for this stack frame off the variable stack */
-	numargs = atoi(label);
-	for (i = 1; i <= numargs; i++) {
-		snprintf(argname, sizeof(argname), "ARG%d", i);
-		pbx_builtin_setvar_helper(chan, argname, NULL);
-	}
-
-	/* If the label exists, it will always have a ':' */
-	label = strchr(label, ':') + 1;
-
-	if (ast_parseable_goto(chan, label)) {
-		ast_log(LOG_WARNING, "No next statement after Gosub?\n");
-		return -1;
-	}
-
-	/* Remove the current frame from the Gosub stack */
-	pbx_builtin_setvar_helper(chan, STACKVAR, NULL);
+	ast_explicit_goto(chan, oldframe->context, oldframe->extension, oldframe->priority);
+	gosub_release_frame(chan, oldframe);
 
 	/* Set a return value, if any */
 	pbx_builtin_setvar_helper(chan, "GOSUB_RETVAL", S_OR(retval, ""));
@@ -130,7 +192,9 @@
 
 static int gosub_exec(struct ast_channel *chan, void *data)
 {
-	char newlabel[AST_MAX_EXTENSION + AST_MAX_CONTEXT + 11 + 11 + 4];
+	struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL);
+	AST_LIST_HEAD(, gosub_stack_frame) *oldlist;
+	struct gosub_stack_frame *newframe;
 	char argname[15], *tmp = ast_strdupa(data), *label, *endparen;
 	int i;
 	struct ast_module_user *u;
@@ -144,6 +208,28 @@
 	}
 
 	u = ast_module_user_add(chan);
+
+	if (!stack_store) {
+		ast_log(LOG_DEBUG, "Channel %s has no datastore, so we're allocating one.\n", chan->name);
+		stack_store = ast_channel_datastore_alloc(&stack_info, NULL);
+		if (!stack_store) {
+			ast_log(LOG_ERROR, "Unable to allocate new datastore.  Gosub will fail.\n");
+			ast_module_user_remove(u);
+			return -1;
+		}
+
+		oldlist = ast_calloc(1, sizeof(*oldlist));
+		if (!oldlist) {
+			ast_log(LOG_ERROR, "Unable to allocate datastore list head.  Gosub will fail.\n");
+			ast_channel_datastore_free(stack_store);
+			ast_module_user_remove(u);
+			return -1;
+		}
+
+		stack_store->data = oldlist;
+		AST_LIST_HEAD_INIT(oldlist);
+		ast_channel_datastore_add(chan, stack_store);
+	}
 
 	/* Separate the arguments from the label */
 	/* NOTE:  you cannot use ast_app_separate_args for this, because '(' cannot be used as a delimiter. */
@@ -159,10 +245,11 @@
 		args2.argc = 0;
 
 	/* Create the return address, but don't save it until we know that the Gosub destination exists */
-	snprintf(newlabel, sizeof(newlabel), "%d:%s|%s|%d", args2.argc, chan->context, chan->exten, chan->priority + 1);
+	newframe = gosub_allocate_frame(chan->context, chan->exten, chan->priority + 1, args2.argc);
 
 	if (ast_parseable_goto(chan, label)) {
 		ast_log(LOG_ERROR, "Gosub address is invalid: '%s'\n", (char *)data);
+		ast_free(newframe);
 		ast_module_user_remove(u);
 		return -1;
 	}
@@ -175,8 +262,11 @@
 	}
 
 	/* And finally, save our return address */
-	pbx_builtin_pushvar_helper(chan, STACKVAR, newlabel);
-	ast_log(LOG_DEBUG, "Setting gosub return address to '%s'\n", newlabel);
+	oldlist = stack_store->data;
+	AST_LIST_LOCK(oldlist);
+	AST_LIST_INSERT_HEAD(oldlist, newframe, entries);
+	AST_LIST_UNLOCK(oldlist);
+
 	ast_module_user_remove(u);
 
 	return 0;

Modified: team/oej/multiparking/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/apps/app_voicemail.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/apps/app_voicemail.c (original)
+++ team/oej/multiparking/apps/app_voicemail.c Mon May 14 09:08:12 2007
@@ -939,7 +939,7 @@
  * \param context String. Ignored if is null or empty string.
  * \param ext     String. Ignored if is null or empty string.
  * \param folder  String. Ignored if is null or empty string. 
- * \return 0 on failure, 1 on success.
+ * \return -1 on failure, 0 on success.
  */
 static int create_dirpath(char *dest, int len, const char *context, const char *ext, const char *folder)
 {
@@ -949,24 +949,24 @@
 		make_dir(dest, len, context, "", "");
 		if (mkdir(dest, mode) && errno != EEXIST) {
 			ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dest, strerror(errno));
-			return 0;
+			return -1;
 		}
 	}
 	if (!ast_strlen_zero(ext)) {
 		make_dir(dest, len, context, ext, "");
 		if (mkdir(dest, mode) && errno != EEXIST) {
 			ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dest, strerror(errno));
-			return 0;
+			return -1;
 		}
 	}
 	if (!ast_strlen_zero(folder)) {
 		make_dir(dest, len, context, ext, folder);
 		if (mkdir(dest, mode) && errno != EEXIST) {
 			ast_log(LOG_WARNING, "mkdir '%s' failed: %s\n", dest, strerror(errno));
-			return 0;
-		}
-	}
-	return 1;
+			return -1;
+		}
+	}
+	return 0;
 }
 
 /*! \brief Lock file path
@@ -2188,7 +2188,7 @@
 
 	snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, context, ext);
 
-	if (!(res = create_dirpath(dest, sizeof(dest), context, ext, "greet"))) {
+	if ((res = create_dirpath(dest, sizeof(dest), context, ext, "greet"))) {
 		ast_log(LOG_WARNING, "Failed to make directory(%s)\n", fn);
 		return -1;
 	}
@@ -2932,7 +2932,7 @@
 		snprintf(prefile, sizeof(prefile), "%s%s/%s/unavail", VM_SPOOL_DIR, vmu->context, ext);
 	}
 	snprintf(tempfile, sizeof(tempfile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, ext);
-	if (!(res = create_dirpath(dest, sizeof(dest), vmu->context, ext, "temp"))) {
+	if ((res = create_dirpath(dest, sizeof(dest), vmu->context, ext, "temp"))) {
 		ast_log(LOG_WARNING, "Failed to make directory (%s)\n", tempfile);
 		return -1;
 	}
@@ -4219,6 +4219,10 @@
 			}	
 		}
 	}
+
+	/* If anything failed above, we still have this list to free */
+	while ((vmtmp = AST_LIST_REMOVE_HEAD(&extensions, list)))
+		free_user(vmtmp);
 	return res ? res : cmd;
 }
 
@@ -5978,7 +5982,7 @@
 	}
 
 	snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username);
-	if (!(res = create_dirpath(dest, sizeof(dest), vmu->context, vms->username, "temp"))) {
+	if ((res = create_dirpath(dest, sizeof(dest), vmu->context, vms->username, "temp"))) {
 		ast_log(LOG_WARNING, "Failed to create directory (%s).\n", prefile);
 		return -1;
 	}

Modified: team/oej/multiparking/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_iax2.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/channels/chan_iax2.c (original)
+++ team/oej/multiparking/channels/chan_iax2.c Mon May 14 09:08:12 2007
@@ -7786,6 +7786,7 @@
 	f.src = "IAX2";
 	f.mallocd = 0;
 	f.offset = 0;
+	f.len = 0;
 	if (f.datalen && (f.frametype == AST_FRAME_VOICE)) {
 		f.samples = ast_codec_get_samples(&f);
 		/* We need to byteswap incoming slinear samples from network byte order */

Modified: team/oej/multiparking/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_sip.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/channels/chan_sip.c (original)
+++ team/oej/multiparking/channels/chan_sip.c Mon May 14 09:08:12 2007
@@ -15324,6 +15324,12 @@
 		}
 	}
 
+	if (!e && (p->method == SIP_INVITE || p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER || p->method == SIP_NOTIFY)) {
+		transmit_response(p, "503 Server error", req);
+		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
+		return -1;
+	}
+
 	/* Handle various incoming SIP methods in requests */
 	switch (p->method) {
 	case SIP_OPTIONS:

Modified: team/oej/multiparking/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/channels/chan_zap.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/channels/chan_zap.c (original)
+++ team/oej/multiparking/channels/chan_zap.c Mon May 14 09:08:12 2007
@@ -10999,6 +10999,29 @@
 #undef FORMAT2
 }
 
+static int zap_show_version(int fd, int argc, char *argv[])
+{
+	int pseudo_fd = -1;
+	struct zt_versioninfo vi;
+
+	if ((pseudo_fd = open("/dev/zap/ctl", O_RDONLY)) < 0) {
+		ast_cli(fd, "Failed to open control file to get version.\n");
+		return RESULT_SUCCESS;
+	}
+
+	strcpy(vi.version, "Unknown");
+	strcpy(vi.echo_canceller, "Unknown");
+
+	if (ioctl(pseudo_fd, ZT_GETVERSION, &vi))
+		ast_cli(fd, "Failed to get version from control file.\n");
+	else
+		ast_cli(fd, "Zaptel Version: %s Echo Canceller: %s\n", vi.version, vi.echo_canceller);
+
+	close(pseudo_fd);
+
+	return RESULT_SUCCESS;
+}
+
 static const char show_channels_usage[] =
 	"Usage: zap show channels\n"
 	"	Shows a list of available channels\n";
@@ -11022,6 +11045,10 @@
 	"	Note that this will STOP any running CALL on zaptel channels.\n"
 	"";
 
+static char zap_show_version_usage[] =
+        "Usage: zap show version\n"
+        "       Shows the Zaptel version in use\n";
+
 static struct ast_cli_entry zap_cli[] = {
 	{ { "zap", "show", "cadences", NULL },
 	handle_zap_show_cadences, "List cadences",
@@ -11046,6 +11073,10 @@
 	{ { "zap", "show", "status", NULL},
 	zap_show_status, "Show all Zaptel cards status",
 	zap_show_status_usage },
+
+	{ { "zap", "show", "version", NULL},
+	zap_show_version, "Show the Zaptel version in use",
+	zap_show_version_usage },
 };
 
 #define TRANSFER	0

Modified: team/oej/multiparking/configs/extensions.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/configs/extensions.conf.sample?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/configs/extensions.conf.sample (original)
+++ team/oej/multiparking/configs/extensions.conf.sample Mon May 14 09:08:12 2007
@@ -561,11 +561,11 @@
 ;
 ;exten = 8700,1,Dial(${MARK},30,A(/path/to/my/announcemsg))
 ;
-; For more information on applications, just type "show applications" at your
+; For more information on applications, just type "core show applications" at your
 ; friendly Asterisk CLI prompt.
 ;
-; 'show application <command>' will show details of how you
+; 'core show application <command>' will show details of how you
 ; use that particular application in this file, the dial plan. 
-; 'show functions" will list all dialplan functions
-; 'show function <COMMAND>' will show you more information about
+; 'core show functions" will list all dialplan functions
+; 'core show function <COMMAND>' will show you more information about
 ; one function. Remember that function names are UPPER CASE.

Modified: team/oej/multiparking/configs/sla.conf.sample
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/configs/sla.conf.sample?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/configs/sla.conf.sample (original)
+++ team/oej/multiparking/configs/sla.conf.sample Mon May 14 09:08:12 2007
@@ -111,6 +111,16 @@
                             ; This value is in seconds.
 
 
+;[station](!)               ; When there are a lot of stations that are configured the same way,
+                            ; it is convenient to use a configuration template like this so that
+                            ; the common settings stay in one place.
+;type=station
+;autocontext=sla_stations
+;trunk=line1
+;trunk=line2 
+;trunk=line3
+;trunk=line4 
+
 ;[station2](station)        ; Define a station that uses the configuration from the template "station".
 ;device=SIP/station2
 ;

Modified: team/oej/multiparking/configure
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/configure?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/configure (original)
+++ team/oej/multiparking/configure Mon May 14 09:08:12 2007
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 53851 .
+# From configure.ac Revision: 55077 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.60.
 #
@@ -36051,8 +36051,8 @@
 # Check for transcode support
 
     if test "x${PBX_ZAPTEL_TRANSCODE}" != "x1" -a "${USE_ZAPTEL_TRANSCODE}" != "no"; then
-	{ echo "$as_me:$LINENO: checking for ZT_TCOP_TRANSCODE in zaptel/zaptel.h" >&5
-echo $ECHO_N "checking for ZT_TCOP_TRANSCODE in zaptel/zaptel.h... $ECHO_C" >&6; }
+	{ echo "$as_me:$LINENO: checking for ZT_TCOP_ALLOCATE in zaptel/zaptel.h" >&5
+echo $ECHO_N "checking for ZT_TCOP_ALLOCATE in zaptel/zaptel.h... $ECHO_C" >&6; }
 	saved_cppflags="${CPPFLAGS}"
 	if test "x${ZAPTEL_TRANSCODE_DIR}" != "x"; then
 	    ZAPTEL_TRANSCODE_INCLUDE= "-I${ZAPTEL_TRANSCODE_DIR}/include"
@@ -36069,7 +36069,7 @@
 int
 main ()
 {
-int foo = ZT_TCOP_TRANSCODE;
+int foo = ZT_TCOP_ALLOCATE;
   ;
   return 0;
 }

Modified: team/oej/multiparking/configure.ac
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/configure.ac?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/configure.ac (original)
+++ team/oej/multiparking/configure.ac Mon May 14 09:08:12 2007
@@ -926,7 +926,7 @@
 AST_C_DEFINE_CHECK([ZAPTEL_VLDTMF], [ZT_TONE_DTMF_BASE], [zaptel/zaptel.h])
 
 # Check for transcode support
-AST_C_DEFINE_CHECK([ZAPTEL_TRANSCODE], [ZT_TCOP_TRANSCODE], [zaptel/zaptel.h])
+AST_C_DEFINE_CHECK([ZAPTEL_TRANSCODE], [ZT_TCOP_ALLOCATE], [zaptel/zaptel.h])
 
 # On FreeBSD, try old zaptel (0.80 or so) and pretend we have vldtmf
 case "${host_os}" in

Modified: team/oej/multiparking/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/include/asterisk/channel.h?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/include/asterisk/channel.h (original)
+++ team/oej/multiparking/include/asterisk/channel.h Mon May 14 09:08:12 2007
@@ -153,7 +153,9 @@
 #include "asterisk/linkedlists.h"
 #include "asterisk/stringfields.h"
 #include "asterisk/compiler.h"
-
+#include <limits.h>
+
+#define DATASTORE_INHERIT_FOREVER	INT_MAX
 
 #define AST_MAX_FDS		10
 /*
@@ -185,6 +187,7 @@
 /*! \brief Structure for a data store type */
 struct ast_datastore_info {
 	const char *type;		/*!< Type of data store */
+	void *(*duplicate)(void *data);	/*!< Duplicate item data (used for inheritance) */
 	void (*destroy)(void *data);	/*!< Destroy function */
 };
 
@@ -193,6 +196,7 @@
 	char *uid;		/*!< Unique data store identifier */
 	void *data;		/*!< Contained data */
 	const struct ast_datastore_info *info;	/*!< Data store type information */
+	unsigned int inheritance;	/*!< Number of levels this item will continue to be inherited */
 	AST_LIST_ENTRY(ast_datastore) entry; /*!< Used for easy linking */
 };
 
@@ -609,6 +613,9 @@
 /*! \brief Free a channel datastore structure */
 int ast_channel_datastore_free(struct ast_datastore *datastore);
 
+/*! \brief Inherit datastores from a parent to a child. */
+int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to);
+
 /*! \brief Add a datastore to a channel */
 int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore);
 

Modified: team/oej/multiparking/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/main/channel.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/main/channel.c (original)
+++ team/oej/multiparking/main/channel.c Mon May 14 09:08:12 2007
@@ -1145,7 +1145,7 @@
 
 	/* Free allocated UID memory */
 	if (datastore->uid != NULL) {
-		free(datastore->uid);
+		ast_free(datastore->uid);
 		datastore->uid = NULL;
 	}
 
@@ -1153,6 +1153,23 @@
 	free(datastore);
 
 	return res;
+}
+
+int ast_channel_datastore_inherit(struct ast_channel *from, struct ast_channel *to)
+{
+	struct ast_datastore *datastore = NULL, *datastore2;
+
+	AST_LIST_TRAVERSE(&from->datastores, datastore, entry) {
+		if (datastore->inheritance > 0) {
+			datastore2 = ast_channel_datastore_alloc(datastore->info, datastore->uid);
+			if (datastore2) {
+				datastore2->data = datastore->info->duplicate(datastore->data);
+				datastore2->inheritance = datastore->inheritance == DATASTORE_INHERIT_FOREVER ? DATASTORE_INHERIT_FOREVER : datastore->inheritance - 1;
+				AST_LIST_INSERT_TAIL(&to->datastores, datastore2, entry);
+			}
+		}
+	}
+	return 0;
 }
 
 int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
@@ -2817,8 +2834,10 @@
 		/* XXX why is this necessary, for the parent_channel perhaps ? */
 		if (!ast_strlen_zero(oh->cid_num) && !ast_strlen_zero(oh->cid_name))
 			ast_set_callerid(chan, oh->cid_num, oh->cid_name, oh->cid_num);
-		if (oh->parent_channel)
+		if (oh->parent_channel) {
 			ast_channel_inherit_variables(oh->parent_channel, chan);
+			ast_channel_datastore_inherit(oh->parent_channel, chan);
+		}
 		if (oh->account)
 			ast_cdr_setaccount(chan, oh->account);	
 	}

Modified: team/oej/multiparking/main/cli.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/main/cli.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/main/cli.c (original)
+++ team/oej/multiparking/main/cli.c Mon May 14 09:08:12 2007
@@ -801,6 +801,7 @@
 		"      Caller ID: %s\n"
 		" Caller ID Name: %s\n"
 		"    DNID Digits: %s\n"
+		"       Language: %s\n"
 		"          State: %s (%d)\n"
 		"          Rings: %d\n"
 		"  NativeFormats: %s\n"
@@ -827,7 +828,9 @@
 		c->name, c->tech->type, c->uniqueid,
 		S_OR(c->cid.cid_num, "(N/A)"),
 		S_OR(c->cid.cid_name, "(N/A)"),
-		S_OR(c->cid.cid_dnid, "(N/A)"), ast_state2str(c->_state), c->_state, c->rings, 
+		S_OR(c->cid.cid_dnid, "(N/A)"), 
+		c->language,	
+		ast_state2str(c->_state), c->_state, c->rings, 
 		ast_getformatname_multiple(nf, sizeof(nf), c->nativeformats), 
 		ast_getformatname_multiple(wf, sizeof(wf), c->writeformat), 
 		ast_getformatname_multiple(rf, sizeof(rf), c->readformat),

Modified: team/oej/multiparking/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/main/pbx.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/main/pbx.c (original)
+++ team/oej/multiparking/main/pbx.c Mon May 14 09:08:12 2007
@@ -319,24 +319,30 @@
 
 	{ "Goto", pbx_builtin_goto,
 	"Jump to a particular priority, extension, or context",
-	"  Goto([[context|]extension|]priority): This application will cause the\n"
-	"calling channel to continue dialplan execution at the specified priority.\n"
+	"  Goto([[context|]extension|]priority): This application will set the current\n"
+	"context, extension, and priority in the channel structure. After it completes, the\n"
+	"pbx engine will continue dialplan execution at the specified location.\n"
 	"If no specific extension, or extension and context, are specified, then this\n"
-	"application will jump to the specified priority of the current extension.\n"
+	"application will just set the specified priority of the current extension.\n"
 	"  At least a priority is required as an argument, or the goto will return a -1,\n"
 	"and the channel and call will be terminated.\n"
-	"  If the attempt to jump to another location in the dialplan is not successful,\n"
+	"  If the location that is put into the channel information is bogus, and asterisk cannot\n"
+        "find that location in the dialplan,\n"
 	"then the execution engine will try to find and execute the code in the 'i' (invalid)\n"
 	"extension in the current context. If that does not exist, it will try to execute the\n"
 	"'h' extension. If either or neither the 'h' or 'i' extensions have been defined, the\n"
 	"channel is hung up, and the execution of instructions on the channel is terminated.\n"
+	"What this means is that, for example, you specify a context that does not exist, then\n"
+	"it will not be possible to find the 'h' or 'i' extensions, and the call will terminate!\n"
 	},
 
 	{ "GotoIf", pbx_builtin_gotoif,
 	"Conditional goto",
-	"  GotoIf(condition?[labeliftrue]:[labeliffalse]): This application will cause\n"
-	"the calling channel to jump to the specified location in the dialplan based on\n"
-	"the evaluation of the given condition. The channel will continue at\n"
+	"  GotoIf(condition?[labeliftrue]:[labeliffalse]): This application will set the current\n"
+	"context, extension, and priority in the channel structure based on the evaluation of\n"
+	"the given condition. After this application completes, the\n"
+	"pbx engine will continue dialplan execution at the specified location in the dialplan.\n"
+	"The channel will continue at\n"
 	"'labeliftrue' if the condition is true, or 'labeliffalse' if the condition is\n"
 	"false. The labels are specified with the same syntax as used within the Goto\n"
 	"application.  If the label chosen by the condition is omitted, no jump is\n"
@@ -346,13 +352,18 @@
 	"extension in the current context. If that does not exist, it will try to execute the\n"
 	"'h' extension. If either or neither the 'h' or 'i' extensions have been defined, the\n"
 	"channel is hung up, and the execution of instructions on the channel is terminated.\n"
+	"Remember that this command can set the current context, and if the context specified\n"
+	"does not exist, then it will not be able to find any 'h' or 'i' extensions there, and\n"
+	"the channel and call will both be terminated!\n"
 	},
 
 	{ "GotoIfTime", pbx_builtin_gotoiftime,
 	"Conditional Goto based on the current time",
 	"  GotoIfTime(<times>|<weekdays>|<mdays>|<months>?[[context|]exten|]priority):\n"
-	"This application will have the calling channel jump to the specified location\n"
-	"in the dialplan if the current time matches the given time specification.\n"
+	"This application will set the context, extension, and priority in the channel structure\n"
+	"if the current time matches the given time specification. Otherwise, nothing is done.\n"
+        "Further information on the time specification can be found in examples\n"
+        "illustrating how to do time-based context includes in the dialplan.\n" 
 	"If the target jump location is bogus, the same actions would be taken as for Goto.\n"
 	},
 
@@ -5217,7 +5228,6 @@
 	struct ast_exten *e, *el, *en;
 	struct ast_ignorepat *ipi;
 
-	ast_wrlock_contexts();
 	for (tmp = contexts; tmp; ) {
 		struct ast_context *next;	/* next starting point */
 		for (; tmp; tmpl = tmp, tmp = tmp->next) {
@@ -5267,12 +5277,13 @@
 		/* if we have a specific match, we are done, otherwise continue */
 		tmp = con ? NULL : next;
 	}
+}
+
+void ast_context_destroy(struct ast_context *con, const char *registrar)
+{
+	ast_wrlock_contexts();
+	__ast_context_destroy(con,registrar);
 	ast_unlock_contexts();
-}
-
-void ast_context_destroy(struct ast_context *con, const char *registrar)
-{
-	__ast_context_destroy(con,registrar);
 }
 
 static void wait_for_hangup(struct ast_channel *chan, void *data)

Modified: team/oej/multiparking/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/main/rtp.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/main/rtp.c (original)
+++ team/oej/multiparking/main/rtp.c Mon May 14 09:08:12 2007
@@ -1102,7 +1102,7 @@
 	version = (seqno & 0xC0000000) >> 30;
 	payload = (seqno & 0x7f0000) >> 16;
 	padding = seqno & (1 << 29);
-	mark = seqno & (1 << 23);
+	mark = (seqno & 0x800000) >> 23;
 	ext = seqno & (1 << 28);
 	seqno &= 0xffff;
 

Modified: team/oej/multiparking/main/say.c
URL: http://svn.digium.com/view/asterisk/team/oej/multiparking/main/say.c?view=diff&rev=64207&r1=64206&r2=64207
==============================================================================
--- team/oej/multiparking/main/say.c (original)
+++ team/oej/multiparking/main/say.c Mon May 14 09:08:12 2007
@@ -25,6 +25,8 @@
  * 
  * \note 12-16-2004 : Support for Greek added by InAccess Networks (work funded by HOL, www.hol.gr) George Konstantoulakis <gkon at inaccessnetworks.com>
  *  						
+ * \note 2007-02-08 : Support for Georgian added by Alexander Shaduri <ashaduri at gmail.com>,
+ *  						Next Generation Networks (NGN).
  */
 
 #include "asterisk.h"
@@ -274,6 +276,7 @@
       \arg \b se    - Swedish
       \arg \b tw    - Taiwanese / Chinese
       \arg \b ru    - Russian
+      \arg \b ge    - Georgian
 
  \par Gender:
  For Some languages the numbers differ for gender and plural.
@@ -328,6 +331,7 @@
 static int ast_say_number_full_tw(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd);
 static int ast_say_number_full_gr(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd);
 static int ast_say_number_full_ru(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd);
+static int ast_say_number_full_ge(struct ast_channel *chan, int num, const char *ints, const char *language, const char *options, int audiofd, int ctrlfd);
 
 /* Forward declarations of language specific variants of ast_say_enumeration_full */
 static int ast_say_enumeration_full_en(struct ast_channel *chan, int num, const char *ints, const char *language, int audiofd, int ctrlfd);
@@ -342,6 +346,7 @@
 static int ast_say_date_nl(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_date_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_date_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_date_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 
 static int ast_say_date_with_format_en(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone);
 static int ast_say_date_with_format_da(struct ast_channel *chan, time_t time, const char *ints, const char *lang, const char *format, const char *timezone);
@@ -364,6 +369,7 @@
 static int ast_say_time_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_tw(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_time_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_time_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 
 static int ast_say_datetime_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_de(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
@@ -373,10 +379,12 @@
 static int ast_say_datetime_pt_BR(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_tw(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_gr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_datetime_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 
 static int ast_say_datetime_from_now_en(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_from_now_fr(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 static int ast_say_datetime_from_now_pt(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
+static int ast_say_datetime_from_now_ge(struct ast_channel *chan, time_t t, const char *ints, const char *lang);
 
 static int wait_file(struct ast_channel *chan, const char *ints, const char *file, const char *lang) 
 {
@@ -426,6 +434,8 @@
 	   return(ast_say_number_full_gr(chan, num, ints, language, audiofd, ctrlfd));
 	} else if (!strcasecmp(language, "ru") ) {	/* Russian syntax */
 	   return(ast_say_number_full_ru(chan, num, ints, language, options, audiofd, ctrlfd));
+	} else if (!strcasecmp(language, "ge") ) {	/* Georgian syntax */
+	   return(ast_say_number_full_ge(chan, num, ints, language, options, audiofd, ctrlfd));
 	}
 
 	/* Default to english */
@@ -2724,6 +2734,8 @@
 		return(ast_say_date_pt(chan, t, ints, lang));
 	} else if (!strcasecmp(lang, "gr") ) {  			/* Greek syntax */
 		return(ast_say_date_gr(chan, t, ints, lang));
+	} else if (!strcasecmp(lang, "ge") ) {  /* Georgian syntax */
+		return(ast_say_date_ge(chan, t, ints, lang));
 	}
 
 	/* Default to English */
@@ -5500,6 +5512,8 @@
 		return(ast_say_time_tw(chan, t, ints, lang));
 	} else if (!strcasecmp(lang, "gr") ) {  			/* Greek syntax */
 		return(ast_say_time_gr(chan, t, ints, lang));
+	} else if (!strcasecmp(lang, "ge") ) {  /* Georgian syntax */
+		return(ast_say_time_ge(chan, t, ints, lang));
 	}
 
 	/* Default to English */
@@ -5719,6 +5733,8 @@
 		return(ast_say_datetime_tw(chan, t, ints, lang));
 	} else if (!strcasecmp(lang, "gr") ) {  			/* Greek syntax */
 		return(ast_say_datetime_gr(chan, t, ints, lang));
+	} else if (!strcasecmp(lang, "ge") ) {  /* Georgian syntax */
+		return(ast_say_datetime_ge(chan, t, ints, lang));
 	}
 
 	/* Default to English */
@@ -6002,6 +6018,8 @@
 		return(ast_say_datetime_from_now_fr(chan, t, ints, lang));
 	} else if (!strcasecmp(lang, "pt") || !strcasecmp(lang, "pt_BR")) {	/* Portuguese syntax */
 		return(ast_say_datetime_from_now_pt(chan, t, ints, lang));

[... 859 lines stripped ...]


More information about the asterisk-commits mailing list