[asterisk-commits] rmudgett: branch rmudgett/cid r274784 - in /team/rmudgett/cid: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 8 17:08:46 CDT 2010


Author: rmudgett
Date: Thu Jul  8 17:08:42 2010
New Revision: 274784

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=274784
Log:
Merged revisions 274773,274782 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r274773 | rmudgett | 2010-07-08 14:12:55 -0500 (Thu, 08 Jul 2010) | 1 line
  
  Fix trunk compile.
........
  r274782 | rmudgett | 2010-07-08 17:05:40 -0500 (Thu, 08 Jul 2010) | 1 line
  
  Generate a correct AstData string for ast_callerid.cid_ton
........

Modified:
    team/rmudgett/cid/   (props changed)
    team/rmudgett/cid/main/channel.c

Propchange: team/rmudgett/cid/
------------------------------------------------------------------------------
--- cid-integrated (original)
+++ cid-integrated Thu Jul  8 17:08:42 2010
@@ -1,1 +1,1 @@
-/trunk:1-274752
+/trunk:1-274782

Modified: team/rmudgett/cid/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/cid/main/channel.c?view=diff&rev=274784&r1=274783&r2=274784
==============================================================================
--- team/rmudgett/cid/main/channel.c (original)
+++ team/rmudgett/cid/main/channel.c Thu Jul  8 17:08:42 2010
@@ -72,9 +72,9 @@
 #include <sys/epoll.h>
 #endif
 
-#ifdef HAVE_PRI
-#include "sig_pri.h"
-#endif
+#if defined(HAVE_PRI)
+#include "libpri.h"
+#endif	/* defined(HAVE_PRI) */
 
 struct ast_epoll_data {
 	struct ast_channel *chan;
@@ -283,28 +283,52 @@
 	ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS));
 }
 
-static const char *callerid_ton2str(int ton)
-{
-#ifdef HAVE_PRI
-	switch (ton) {
+static const char *party_number_ton2str(int ton)
+{
+#if defined(HAVE_PRI)
+	switch ((ton >> 4) & 0x07) {
 	case PRI_TON_INTERNATIONAL:
-		return "International Number";
+		return "International";
 	case PRI_TON_NATIONAL:
-		return "National Number";
+		return "National";
 	case PRI_TON_NET_SPECIFIC:
-		return "Network Specific Number";
+		return "Network Specific";
 	case PRI_TON_SUBSCRIBER:
-		return "Subscriber Number";
+		return "Subscriber";
 	case PRI_TON_ABBREVIATED:
-		return "Abbreviated number";
+		return "Abbreviated";
 	case PRI_TON_RESERVED:
-		return "Reserved Number";
+		return "Reserved";
 	case PRI_TON_UNKNOWN:
 	default:
-		return "Unknown Number Type";
-	}
-#endif
-	return "";
+		break;
+	}
+#endif	/* defined(HAVE_PRI) */
+	return "Unknown";
+}
+
+static const char *party_number_plan2str(int plan)
+{
+#if defined(HAVE_PRI)
+	switch (plan & 0x0F) {
+	default:
+	case PRI_NPI_UNKNOWN:
+		break;
+	case PRI_NPI_E163_E164:
+		return "Public";
+	case PRI_NPI_X121:
+		return "Data";
+	case PRI_NPI_F69:
+		return "Telex";
+	case PRI_NPI_NATIONAL:
+		return "National Standard";
+	case PRI_NPI_PRIVATE:
+		return "Private";
+	case PRI_NPI_RESERVED:
+		return "Reserved";
+	}
+#endif	/* defined(HAVE_PRI) */
+	return "Unknown";
 }
 
 int ast_channel_data_add_structure(struct ast_data *tree,
@@ -313,6 +337,7 @@
 	struct ast_channel *bc;
 	struct ast_data *data_bridged, *data_cdr, *data_flags, *data_zones;
 	struct ast_data *data_callerid, *enum_node, *data_softhangup;
+	char value_str[100];
 
 	if (!tree) {
 		return -1;
@@ -404,7 +429,10 @@
 		return -1;
 	}
 	ast_data_add_int(enum_node, "value", chan->cid.cid_ton);
-	ast_data_add_str(enum_node, "text", callerid_ton2str(chan->cid.cid_ton));
+	snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s",
+		party_number_ton2str(chan->cid.cid_ton),
+		party_number_plan2str(chan->cid.cid_ton));
+	ast_data_add_str(enum_node, "text", value_str);
 
 	/* tone zone */
 	if (chan->zone) {




More information about the asterisk-commits mailing list