From 541568fbb6496bc5d644cfebd9a63a5a0710d06d Mon Sep 17 00:00:00 2001
From: Jeremy McNamara <jj@nufone.net>
Date: Mon, 24 Nov 2003 03:43:14 +0000
Subject: [PATCH] deal with accountcode correctly and update CDR on a goto

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1788 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 pbx.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pbx.c b/pbx.c
index f7dd0a2f09..ccc42c94f1 100755
--- a/pbx.c
+++ b/pbx.c
@@ -3828,6 +3828,7 @@ int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char
 		LOAD_OH(oh);
 		chan = __ast_request_and_dial(type, format, data, timeout, reason, callerid, &oh);
 		if (chan) {
+			pbx_builtin_setaccount(chan, account);
 			if (chan->_state == AST_STATE_UP) {
 					res = 0;
 				if (option_verbose > 3)
@@ -3883,6 +3884,7 @@ int ast_pbx_outgoing_exten(char *type, int format, void *data, int timeout, char
 			free(as);
 			return -1;
 		}
+		pbx_builtin_setaccount(chan, account);
 		as->chan = chan;
 		strncpy(as->context, context, sizeof(as->context) - 1);
 		strncpy(as->exten,  exten, sizeof(as->exten) - 1);
@@ -3938,6 +3940,7 @@ int ast_pbx_outgoing_app(char *type, int format, void *data, int timeout, char *
 	if (sync) {
 		chan = ast_request_and_dial(type, format, data, timeout, reason, callerid);
 		if (chan) {
+			pbx_builtin_setaccount(chan, account);
 			if (variable) {
 				vartmp = ast_strdupa(variable);
 				for (var = strtok_r(vartmp, "|", &vartmp); var; var = strtok_r(NULL, "|", &vartmp)) {
@@ -3986,6 +3989,7 @@ int ast_pbx_outgoing_app(char *type, int format, void *data, int timeout, char *
 			free(as);
 			return -1;
 		}
+		pbx_builtin_setaccount(chan, account);
 		as->chan = chan;
 		strncpy(as->app, app, sizeof(as->app) - 1);
 		if (appdata)
@@ -4321,6 +4325,7 @@ static int pbx_builtin_goto(struct ast_channel *chan, void *data)
 		strncpy(chan->context, context, sizeof(chan->context)-1);
 	if (option_verbose > 2)
 		ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1);
+	ast_cdr_update(chan);
 	return 0;
 }
 
-- 
GitLab