[Asterisk-cvs] asterisk/apps app_dial.c,1.137,1.138

markster at lists.digium.com markster at lists.digium.com
Mon Feb 7 09:19:06 CST 2005


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

Modified Files:
	app_dial.c 
Log Message:
Add "Dial" event to link callerid, src and destination channel (bug #3494)


Index: app_dial.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_dial.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -r1.137 -r1.138
--- app_dial.c	3 Feb 2005 04:21:07 -0000	1.137
+++ app_dial.c	7 Feb 2005 15:19:34 -0000	1.138
@@ -27,6 +27,7 @@
 #include <asterisk/utils.h>
 #include <asterisk/app.h>
 #include <asterisk/causes.h>
+#include <asterisk/manager.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
@@ -240,6 +241,20 @@
 		return "";
 }
 
+static void senddialevent(struct ast_channel *src, struct ast_channel *dst)
+{
+	manager_event(EVENT_FLAG_CALL, "Dial", 
+								   "Source: %s\r\n"
+								   "Destination: %s\r\n"
+								   "CallerID: %s\r\n"
+								   "CallerIDName: %s\r\n"
+								   "SrcUniqueID: %s\r\n"
+								   "DestUniqueID: %s\r\n",
+								   src->name, dst->name, src->cid.cid_num ? src->cid.cid_num : "<unknown>",
+								   src->cid.cid_name ? src->cid.cid_name : "<unknown>", src->uniqueid,
+								   dst->uniqueid);
+}
+
 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;
@@ -405,6 +420,7 @@
 							o->chan = NULL;
 							numnochan++;
 						} else {
+							senddialevent(in, o->chan);
 							/* After calling, set callerid to extension */
 							if (!ast_test_flag(peerflags, DIAL_PRESERVE_CALLERID))
 								ast_set_callerid(o->chan, ast_strlen_zero(in->macroexten) ? in->exten : in->macroexten, get_cid_name(cidname, sizeof(cidname), in), NULL);
@@ -1016,6 +1032,7 @@
 			cur = rest;
 			continue;
 		} else {
+			senddialevent(chan, tmp->chan);
 			if (option_verbose > 2)
 				ast_verbose(VERBOSE_PREFIX_3 "Called %s\n", numsubst);
 			if (!ast_test_flag(peerflags, DIAL_PRESERVE_CALLERID))




More information about the svn-commits mailing list