[svn-commits] mnicholson: branch group/newcdr r202493 - in /team/group/newcdr: apps/ cdr/ m...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 22 14:33:09 CDT 2009


Author: mnicholson
Date: Mon Jun 22 14:33:05 2009
New Revision: 202493

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=202493
Log:
Use ast_dummy_channel_alloc for variable substitution.

Modified:
    team/group/newcdr/apps/app_voicemail.c
    team/group/newcdr/cdr/cdr_custom.c
    team/group/newcdr/cdr/cdr_manager.c
    team/group/newcdr/cdr/cdr_sqlite3_custom.c
    team/group/newcdr/main/manager.c
    team/group/newcdr/main/pbx.c

Modified: team/group/newcdr/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/apps/app_voicemail.c?view=diff&rev=202493&r1=202492&r2=202493
==============================================================================
--- team/group/newcdr/apps/app_voicemail.c (original)
+++ team/group/newcdr/apps/app_voicemail.c Mon Jun 22 14:33:05 2009
@@ -4105,7 +4105,7 @@
 
 	if (!ast_strlen_zero(fromstring)) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", NULL, 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *ptr;
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, enc_cidnum, enc_cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, fromstring);
@@ -4151,7 +4151,7 @@
 	if (!ast_strlen_zero(emailsubject) || !ast_strlen_zero(vmu->emailsubject)) {
 		char *e_subj = !ast_strlen_zero(vmu->emailsubject) ? vmu->emailsubject : emailsubject;
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", NULL, 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, e_subj);
 			if (check_mime(ast_str_buffer(str1))) {
@@ -4234,7 +4234,7 @@
 	if (emailbody || vmu->emailbody) {
 		char* e_body = vmu->emailbody ? vmu->emailbody : emailbody;
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", NULL, 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, e_body);
 			fprintf(p, "%s" ENDL, ast_str_buffer(str1));
@@ -4434,7 +4434,7 @@
 
 	if (!ast_strlen_zero(pagerfromstring)) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", NULL, 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			char *ptr;
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, enc_cidnum, enc_cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, pagerfromstring);
@@ -4479,7 +4479,7 @@
 
 	if (!ast_strlen_zero(pagersubject)) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", NULL, 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, pagersubject);
 			if (check_mime(ast_str_buffer(str1))) {
@@ -4512,7 +4512,7 @@
 	ast_strftime(date, sizeof(date), "%A, %B %d, %Y at %r", &tm);
 	if (pagerbody) {
 		struct ast_channel *ast;
-		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", NULL, 0, "Substitution/voicemail"))) {
+		if ((ast = ast_dummy_channel_alloc())) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag);
 			ast_str_substitute_variables(&str1, 0, ast, pagerbody);
 			fprintf(p, "%s" ENDL, ast_str_buffer(str1));

Modified: team/group/newcdr/cdr/cdr_custom.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/cdr/cdr_custom.c?view=diff&rev=202493&r1=202492&r2=202493
==============================================================================
--- team/group/newcdr/cdr/cdr_custom.c (original)
+++ team/group/newcdr/cdr/cdr_custom.c Mon Jun 22 14:33:05 2009
@@ -124,7 +124,7 @@
 		return -1;
 	}
 
-	dummy = ast_channel_alloc(0, 0, "", "", "", "", "", "", 0, "Substitution/%p", cdr);
+	dummy = ast_dummy_channel_alloc();
 
 	if (!dummy) {
 		ast_log(LOG_ERROR, "Unable to allocate channel for variable subsitution.\n");

Modified: team/group/newcdr/cdr/cdr_manager.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/cdr/cdr_manager.c?view=diff&rev=202493&r1=202492&r2=202493
==============================================================================
--- team/group/newcdr/cdr/cdr_manager.c (original)
+++ team/group/newcdr/cdr/cdr_manager.c Mon Jun 22 14:33:05 2009
@@ -156,7 +156,7 @@
 	buf[0] = '\0';
 	ast_rwlock_rdlock(&customfields_lock);
 	if (customfields && ast_str_strlen(customfields)) {
-		struct ast_channel *dummy = ast_channel_alloc(0, 0, "", "", "", "", "", "", 0, "Substitution/%p", cdr);
+		struct ast_channel *dummy = ast_dummy_channel_alloc();
 		if (!dummy) {
 			ast_log(LOG_ERROR, "Unable to allocate channel for variable substitution.\n");
 			return 0;

Modified: team/group/newcdr/cdr/cdr_sqlite3_custom.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/cdr/cdr_sqlite3_custom.c?view=diff&rev=202493&r1=202492&r2=202493
==============================================================================
--- team/group/newcdr/cdr/cdr_sqlite3_custom.c (original)
+++ team/group/newcdr/cdr/cdr_sqlite3_custom.c Mon Jun 22 14:33:05 2009
@@ -241,7 +241,7 @@
 		struct ast_channel *dummy;
 		struct ast_str *value_string = ast_str_create(1024);
 
-		dummy = ast_channel_alloc(0, 0, "", "", "", "", "", "", 0, "Substitution/%p", cdr);
+		dummy = ast_dummy_channel_alloc();
 		if (!dummy) {
 			ast_log(LOG_ERROR, "Unable to allocate channel for variable subsitution.\n");
 			ast_free(value_string);

Modified: team/group/newcdr/main/manager.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/main/manager.c?view=diff&rev=202493&r1=202492&r2=202493
==============================================================================
--- team/group/newcdr/main/manager.c (original)
+++ team/group/newcdr/main/manager.c Mon Jun 22 14:33:05 2009
@@ -2488,7 +2488,7 @@
 
 	if (varname[strlen(varname) - 1] == ')') {
 		if (!c) {
-			c = ast_channel_alloc(0, AST_STATE_DOWN, "", "", "", "", "", "", 0, "Bogus/%p", NULL);
+			c = ast_dummy_channel_alloc();
 			if (c) {
 				ast_func_read(c, (char *) varname, workspace, sizeof(workspace));
 				c = ast_channel_release(c);

Modified: team/group/newcdr/main/pbx.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/newcdr/main/pbx.c?view=diff&rev=202493&r1=202492&r2=202493
==============================================================================
--- team/group/newcdr/main/pbx.c (original)
+++ team/group/newcdr/main/pbx.c Mon Jun 22 14:33:05 2009
@@ -3626,7 +3626,7 @@
 					cp4 = ast_func_read2(c, finalvars, &substr3, 0) ? NULL : ast_str_buffer(substr3);
 				} else {
 					struct varshead old;
-					struct ast_channel *bogus = ast_channel_alloc(0, 0, "", "", "", "", "", NULL, 0, "Bogus/%p", vars);
+					struct ast_channel *bogus = ast_dummy_channel_alloc();
 					if (bogus) {
 						memcpy(&old, &bogus->varshead, sizeof(old));
 						memcpy(&bogus->varshead, headp, sizeof(bogus->varshead));
@@ -7909,7 +7909,10 @@
 
 	/* If we are adding a hint evalulate in variables and global variables */
 	if (priority == PRIORITY_HINT && strstr(application, "${") && !strstr(extension, "_")) {
-		struct ast_channel *c = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", extension, con->name, NULL, 0, "Bogus/%s", __PRETTY_FUNCTION__);
+		struct ast_channel *c = ast_dummy_channel_alloc();
+		ast_copy_string(c->exten, extension, sizeof(c->exten));
+		ast_copy_string(c->context, con->name, sizeof(c->context));
+
 		pbx_substitute_variables_helper(c, application, expand_buf, sizeof(expand_buf));
 		application = expand_buf;
 		ast_channel_release(c);
@@ -8158,11 +8161,12 @@
 static int ast_pbx_outgoing_cdr_failed(void)
 {
 	/* allocate a channel */
-	struct ast_channel *chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", NULL, 0, 0);
+	struct ast_channel *chan = ast_dummy_channel_alloc();
 
 	if (!chan)
 		return -1;  /* failure */
 
+	chan->cdr = ast_cdr_alloc();
 	if (!chan->cdr) {
 		/* allocation of the cdr failed */
 		chan = ast_channel_release(chan);   /* free the channel */




More information about the svn-commits mailing list