[Asterisk-cvs] asterisk/apps app_dial.c,1.133,1.134

markster at lists.digium.com markster at lists.digium.com
Mon Jan 31 19:52:02 CST 2005


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

Modified Files:
	app_dial.c 
Log Message:
Allow hints to have names (bug #3471)


Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- app_dial.c	30 Jan 2005 17:57:44 -0000	1.133
+++ app_dial.c	1 Feb 2005 01:53:24 -0000	1.134
@@ -217,6 +217,26 @@
 }
 
 
+static char *get_cid_name(char *name, int namelen, struct ast_channel *chan)
+{
+	char *context;
+	char *exten;
+	if (!ast_strlen_zero(chan->macrocontext))
+		context = chan->macrocontext;
+	else
+		context = chan->context;
+
+	if (!ast_strlen_zero(chan->macroexten))
+		exten = chan->macroexten;
+	else
+		exten = chan->exten;
+
+	if (ast_get_hint(NULL, 0, name, namelen, chan, context, exten))
+		return name;
+	else
+		return "";
+}
+
 static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localuser *outgoing, int *to, struct ast_flags *peerflags, int *sentringing, char *status, size_t statussize, int busystart, int nochanstart, int congestionstart, int *result)
 {
 	struct localuser *o;
@@ -235,6 +255,7 @@
 	int single;
 	struct ast_channel *winner;
 	char *context = NULL;
+	char cidname[AST_MAX_EXTENSION];
 
 	single = (outgoing && !outgoing->next && !ast_test_flag(outgoing, DIAL_MUSICONHOLD | DIAL_RINGBACKONLY));
 	
@@ -382,7 +403,7 @@
 							numnochan++;
 						} else {
 							/* After calling, set callerid to extension */
-							ast_set_callerid(o->chan, ast_strlen_zero(in->macroexten) ? in->exten : in->macroexten, NULL, NULL);
+							ast_set_callerid(o->chan, ast_strlen_zero(in->macroexten) ? in->exten : in->macroexten, get_cid_name(cidname, sizeof(cidname), in), NULL);
 						}
 					}
 					/* Hangup the original channel now, in case we needed it */
@@ -558,6 +579,7 @@
 	int cause;
 	char numsubst[AST_MAX_EXTENSION];
 	char restofit[AST_MAX_EXTENSION];
+	char cidname[AST_MAX_EXTENSION];
 	char *transfer = NULL;
 	char *newnum;
 	char *l;
@@ -991,7 +1013,7 @@
 		} else {
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
-			ast_set_callerid(tmp->chan, ast_strlen_zero(chan->macroexten) ? chan->exten : chan->macroexten, NULL, NULL);
+			ast_set_callerid(tmp->chan, ast_strlen_zero(chan->macroexten) ? chan->exten : chan->macroexten, get_cid_name(cidname, sizeof(cidname), chan), NULL);
 		}
 		/* Put them in the list of outgoing thingies...  We're ready now. 
 		   XXX If we're forcibly removed, these outgoing calls won't get




More information about the svn-commits mailing list