From 3e4a081e1cdae046b37c16177f6ea5d57ae8c7fb Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Mon, 2 Oct 2006 20:35:16 +0000
Subject: [PATCH] Make callerid fields in Manager events more consistent.
 CallerIDNum for number and CallerIDName for name. (issue #7976 reported by
 suhler)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44217 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 CHANGES             | 2 ++
 apps/app_dial.c     | 3 +--
 apps/app_dumpchan.c | 2 +-
 apps/app_meetme.c   | 4 ++--
 apps/app_queue.c    | 4 ++--
 main/channel.c      | 6 +++---
 res/res_features.c  | 8 ++++----
 7 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/CHANGES b/CHANGES
index 2a9a0ca1a2..c32fdefb91 100644
--- a/CHANGES
+++ b/CHANGES
@@ -21,3 +21,5 @@ Changes since Asterisk 1.4-beta was branched:
      statistics during a reload.
   * Added rotatetimestamp option to logger.conf which will use
      the time to name the logger files instead of sequence number.
+  * The output of CallerID in Manager events is now more consistent.
+     CallerIDNum is used for number and CallerIDName for name.
diff --git a/apps/app_dial.c b/apps/app_dial.c
index 8f9a050712..da68e83fe5 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -373,11 +373,10 @@ static const char *get_cid_name(char *name, int namelen, struct ast_channel *cha
 
 static void senddialevent(struct ast_channel *src, struct ast_channel *dst)
 {
-	/* XXX do we need also CallerIDnum ? */
 	manager_event(EVENT_FLAG_CALL, "Dial", 
 			   "Source: %s\r\n"
 			   "Destination: %s\r\n"
-			   "CallerID: %s\r\n"
+			   "CallerIDNum: %s\r\n"
 			   "CallerIDName: %s\r\n"
 			   "SrcUniqueID: %s\r\n"
 			   "DestUniqueID: %s\r\n",
diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c
index 426ba4eab2..8e42e9d393 100644
--- a/apps/app_dumpchan.c
+++ b/apps/app_dumpchan.c
@@ -82,7 +82,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size)
 			 "Name=               %s\n"
 			 "Type=               %s\n"
 			 "UniqueID=           %s\n"
-			 "CallerID=           %s\n"
+			 "CallerIDNum=        %s\n"
 			 "CallerIDName=       %s\n"
 			 "DNIDDigits=         %s\n"
 			 "RDNIS=              %s\n" 
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 9659f3ad46..aa52c3b40e 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -1910,8 +1910,8 @@ bailoutandtrynormal:
 				      "Uniqueid: %s\r\n"
 				      "Meetme: %s\r\n"
 				      "Usernum: %d\r\n"
-				      "CallerIDnum: %s\r\n"
-				      "CallerIDname: %s\r\n"
+				      "CallerIDNum: %s\r\n"
+				      "CallerIDName: %s\r\n"
 				      "Duration: %ld\r\n",
 				      chan->name, chan->uniqueid, conf->confno, 
 				      user->user_no,
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 6ec3c4ef3e..7e37b19236 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -1659,7 +1659,7 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
 		manager_event(EVENT_FLAG_AGENT, "AgentCalled",
 					"AgentCalled: %s\r\n"
 					"ChannelCalling: %s\r\n"
-					"CallerID: %s\r\n"
+					"CallerIDNum: %s\r\n"
 					"CallerIDName: %s\r\n"
 					"Context: %s\r\n"
 					"Extension: %s\r\n"
@@ -4131,7 +4131,7 @@ static int manager_queues_status(struct mansession *s, struct message *m)
 					"Queue: %s\r\n"
 					"Position: %d\r\n"
 					"Channel: %s\r\n"
-					"CallerID: %s\r\n"
+					"CallerIDNum: %s\r\n"
 					"CallerIDName: %s\r\n"
 					"Wait: %ld\r\n"
 					"%s"
diff --git a/main/channel.c b/main/channel.c
index 4425be921e..6a5ecaef1f 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2846,7 +2846,7 @@ struct ast_channel *ast_request(const char *type, int format, void *data, int *c
 			manager_event(EVENT_FLAG_CALL, "Newchannel",
 				      "Channel: %s\r\n"
 				      "State: %s\r\n"
-				      "CallerID: %s\r\n"
+				      "CallerIDNum: %s\r\n"
 				      "CallerIDName: %s\r\n"
 				      "Uniqueid: %s\r\n",
 				      c->name, ast_state2str(c->_state),
@@ -3473,7 +3473,7 @@ void ast_set_callerid(struct ast_channel *chan, const char *callerid, const char
 		ast_cdr_setcid(chan->cdr, chan);
 	manager_event(EVENT_FLAG_CALL, "Newcallerid",
 				"Channel: %s\r\n"
-				"CallerID: %s\r\n"
+				"CallerIDNum: %s\r\n"
 				"CallerIDName: %s\r\n"
 				"Uniqueid: %s\r\n"
 				"CID-CallingPres: %d (%s)\r\n",
@@ -3499,7 +3499,7 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state)
 		      (oldstate == AST_STATE_DOWN) ? "Newchannel" : "Newstate",
 		      "Channel: %s\r\n"
 		      "State: %s\r\n"
-		      "CallerID: %s\r\n"
+		      "CallerIDNum: %s\r\n"
 		      "CallerIDName: %s\r\n"
 		      "Uniqueid: %s\r\n",
 		      chan->name, ast_state2str(chan->_state),
diff --git a/res/res_features.c b/res/res_features.c
index 3947bb360f..9b521453e0 100644
--- a/res/res_features.c
+++ b/res/res_features.c
@@ -399,7 +399,7 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
 		"Channel: %s\r\n"
 		"From: %s\r\n"
 		"Timeout: %ld\r\n"
-		"CallerID: %s\r\n"
+		"CallerIDNum: %s\r\n"
 		"CallerIDName: %s\r\n",
 		pu->parkingexten, pu->chan->name, peer ? peer->name : "",
 		(long)pu->start.tv_sec + (long)(pu->parkingtime/1000) - (long)time(NULL),
@@ -1514,7 +1514,7 @@ static void post_manager_event(const char *s, char *parkingexten, struct ast_cha
 	manager_event(EVENT_FLAG_CALL, s,
 		"Exten: %s\r\n"
 		"Channel: %s\r\n"
-		"CallerID: %s\r\n"
+		"CallerIDNum: %s\r\n"
 		"CallerIDName: %s\r\n\r\n",
 		parkingexten, 
 		chan->name,
@@ -1768,7 +1768,7 @@ static int park_exec(struct ast_channel *chan, void *data)
 			"Exten: %s\r\n"
 			"Channel: %s\r\n"
 			"From: %s\r\n"
-			"CallerID: %s\r\n"
+			"CallerIDNum: %s\r\n"
 			"CallerIDName: %s\r\n",
 			pu->parkingexten, pu->chan->name, chan->name,
 			S_OR(pu->chan->cid.cid_num, "<unknown>"),
@@ -1951,7 +1951,7 @@ static int manager_parking_status( struct mansession *s, struct message *m )
 			"Channel: %s\r\n"
 			"From: %s\r\n"
 			"Timeout: %ld\r\n"
-			"CallerID: %s\r\n"
+			"CallerIDNum: %s\r\n"
 			"CallerIDName: %s\r\n"
 			"%s"
 			"\r\n",
-- 
GitLab