[Asterisk-cvs] asterisk/apps app_dial.c,1.83,1.84

markster at lists.digium.com markster at lists.digium.com
Mon Jul 12 11:00:26 CDT 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv10856/apps

Modified Files:
	app_dial.c 
Log Message:
First pass at properly handling account codes in forwarding


Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- app_dial.c	8 Jul 2004 09:20:14 -0000	1.83
+++ app_dial.c	12 Jul 2004 14:46:10 -0000	1.84
@@ -214,7 +214,6 @@
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, o->chan->name);
 					/* Setup parameters */
-					ast_hangup(o->chan);
 					o->chan = ast_request(tech, in->nativeformats, stuff);
 					if (!o->chan) {
 						ast_log(LOG_NOTICE, "Unable to create local channel for call forward to '%s/%s'\n", tech, stuff);
@@ -234,6 +233,8 @@
 							else
 								newcid = in->exten;
 							o->chan->callerid = strdup(newcid);
+							strncpy(o->chan->accountcode, winner->accountcode, sizeof(o->chan->accountcode) - 1);
+							o->chan->cdrflags = winner->cdrflags;
 							if (!o->chan->callerid)
 								ast_log(LOG_WARNING, "Out of memory\n");
 						} else {
@@ -241,6 +242,8 @@
 								o->chan->callerid = strdup(in->callerid);
 							if (!o->chan->callerid)
 								ast_log(LOG_WARNING, "Out of memory\n");
+							strncpy(o->chan->accountcode, in->accountcode, sizeof(o->chan->accountcode) - 1);
+							o->chan->cdrflags = in->cdrflags;
 						}
 
 						if (in->ani) {
@@ -266,6 +269,8 @@
 							numnochan++;
 						}
 					}
+					/* Hangup the original channel now, in case we needed it */
+					ast_hangup(winner);
 					continue;
 				}
 				f = ast_read(winner);




More information about the svn-commits mailing list