[asterisk-commits] rmudgett: branch group/issue8824 r142574 - in /team/group/issue8824: channels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 11 17:53:29 CDT 2008


Author: rmudgett
Date: Thu Sep 11 17:53:28 2008
New Revision: 142574

URL: http://svn.digium.com/view/asterisk?view=rev&rev=142574
Log:
channels/chan_misdn.c
channels/misdn/isdn_lib.c
channels/misdn/isdn_lib.h
channels/misdn/isdn_msg_parser.c
*  Added more asterisk redirecting information support.
*  Made chan_misdn fill in the asterisk channel type-of-number like other
channel types (Q.931 type-of-number/numbering-plan).

funcs/func_callerid.c
funcs/func_connectedline.c
*  Minor tweaks

funcs/func_redirecting.c
*  New dialplan function REDIRECTING() to allow	the user to manipulate
the channel call redirecting information.

main/channel.c
*  Fixed ast_set_redirecting() to put the
ast_channel.redirecting.from.number into ast_channel.cid.cid_rdnis.


Added:
    team/group/issue8824/funcs/func_redirecting.c   (with props)
Modified:
    team/group/issue8824/channels/chan_misdn.c
    team/group/issue8824/channels/misdn/isdn_lib.c
    team/group/issue8824/channels/misdn/isdn_lib.h
    team/group/issue8824/channels/misdn/isdn_msg_parser.c
    team/group/issue8824/funcs/func_callerid.c
    team/group/issue8824/funcs/func_connectedline.c
    team/group/issue8824/main/channel.c

Modified: team/group/issue8824/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/chan_misdn.c?view=diff&rev=142574&r1=142573&r2=142574
==============================================================================
--- team/group/issue8824/channels/chan_misdn.c (original)
+++ team/group/issue8824/channels/chan_misdn.c Thu Sep 11 17:53:28 2008
@@ -531,7 +531,7 @@
 int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len);
 
 
-void debug_numplan(int port, int numplan, char *type);
+void debug_numtype(int port, int numtype, char *type);
 
 
 int add_out_calls(int port);
@@ -569,6 +569,282 @@
   
 	return NULL;
 }
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Convert the mISDN type of number code to a string
+ *
+ * \param number_type mISDN type of number code.
+ *
+ * \return The mISDN type of number code as a string
+ */
+static const char *misdn_ton_to_str(enum mISDN_NUMBER_TYPE number_type)
+{
+	const char *str;
+
+	switch (number_type) {
+	default:
+	case NUMTYPE_UNKNOWN:
+		str = "Unknown";
+		break;
+
+	case NUMTYPE_INTERNATIONAL:
+		str = "International";
+		break;
+
+	case NUMTYPE_NATIONAL:
+		str = "National";
+		break;
+
+	case NUMTYPE_NETWORK_SPECIFIC:
+		str = "Network Specific";
+		break;
+
+	case NUMTYPE_SUBSCRIBER:
+		str = "Subscriber";
+		break;
+
+	case NUMTYPE_ABBREVIATED:
+		str = "Abbreviated";
+		break;
+	}	/* end switch */
+
+	return str;
+}	/* end misdn_ton_to_str() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Convert the mISDN type of number code to Asterisk type of number code
+ *
+ * \param number_type mISDN type of number code.
+ *
+ * \return Asterisk type of number code
+ */
+static int misdn_ton_to_ast_ton(enum mISDN_NUMBER_TYPE number_type)
+{
+	int ast_number_type;
+
+	switch (number_type) {
+	default:
+	case NUMTYPE_UNKNOWN:
+		ast_number_type = NUMTYPE_UNKNOWN << 4;
+		break;
+
+	case NUMTYPE_INTERNATIONAL:
+		ast_number_type = NUMTYPE_INTERNATIONAL << 4;
+		break;
+
+	case NUMTYPE_NATIONAL:
+		ast_number_type = NUMTYPE_NATIONAL << 4;
+		break;
+
+	case NUMTYPE_NETWORK_SPECIFIC:
+		ast_number_type = NUMTYPE_NETWORK_SPECIFIC << 4;
+		break;
+
+	case NUMTYPE_SUBSCRIBER:
+		ast_number_type = NUMTYPE_SUBSCRIBER << 4;
+		break;
+
+	case NUMTYPE_ABBREVIATED:
+		ast_number_type = NUMTYPE_ABBREVIATED << 4;
+		break;
+	}	/* end switch */
+
+	return ast_number_type;
+}	/* end misdn_ton_to_ast_ton() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Convert the Asterisk type of number code to mISDN type of number code
+ *
+ * \param ast_number_type Asterisk type of number code.
+ *
+ * \return mISDN type of number code
+ */
+static enum mISDN_NUMBER_TYPE ast_ton_to_misdn_ton(unsigned ast_number_type)
+{
+	enum mISDN_NUMBER_TYPE number_type;
+
+	switch ((ast_number_type >> 4) & 0x07) {
+	default:
+	case NUMTYPE_UNKNOWN:
+		number_type = NUMTYPE_UNKNOWN;
+		break;
+
+	case NUMTYPE_INTERNATIONAL:
+		number_type = NUMTYPE_INTERNATIONAL;
+		break;
+
+	case NUMTYPE_NATIONAL:
+		number_type = NUMTYPE_NATIONAL;
+		break;
+
+	case NUMTYPE_NETWORK_SPECIFIC:
+		number_type = NUMTYPE_NETWORK_SPECIFIC;
+		break;
+
+	case NUMTYPE_SUBSCRIBER:
+		number_type = NUMTYPE_SUBSCRIBER;
+		break;
+
+	case NUMTYPE_ABBREVIATED:
+		number_type = NUMTYPE_ABBREVIATED;
+		break;
+	}	/* end switch */
+
+	return number_type;
+}	/* end ast_ton_to_misdn_ton() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Convert the mISDN numbering plan code to a string
+ *
+ * \param number_plan mISDN numbering plan code.
+ *
+ * \return The mISDN numbering plan code as a string
+ */
+static const char *misdn_plan_to_str(enum mISDN_NUMBER_PLAN number_plan)
+{
+	const char *str;
+
+	switch (number_plan) {
+	default:
+	case NUMPLAN_UNKNOWN:
+		str = "Unknown";
+		break;
+
+	case NUMPLAN_ISDN:
+		str = "ISDN";
+		break;
+
+	case NUMPLAN_DATA:
+		str = "Data";
+		break;
+
+	case NUMPLAN_TELEX:
+		str = "Telex";
+		break;
+
+	case NUMPLAN_NATIONAL:
+		str = "National";
+		break;
+
+	case NUMPLAN_PRIVATE:
+		str = "Private";
+		break;
+	}	/* end switch */
+
+	return str;
+}	/* end misdn_plan_to_str() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Convert the mISDN numbering plan code to Asterisk numbering plan code
+ *
+ * \param number_plan mISDN numbering plan code.
+ *
+ * \return Asterisk numbering plan code
+ */
+static int misdn_plan_to_ast_plan(enum mISDN_NUMBER_PLAN number_plan)
+{
+	int ast_number_plan;
+
+	switch (number_plan) {
+	default:
+	case NUMPLAN_UNKNOWN:
+		ast_number_plan = NUMPLAN_UNKNOWN;
+		break;
+
+	case NUMPLAN_ISDN:
+		ast_number_plan = NUMPLAN_ISDN;
+		break;
+
+	case NUMPLAN_DATA:
+		ast_number_plan = NUMPLAN_DATA;
+		break;
+
+	case NUMPLAN_TELEX:
+		ast_number_plan = NUMPLAN_TELEX;
+		break;
+
+	case NUMPLAN_NATIONAL:
+		ast_number_plan = NUMPLAN_NATIONAL;
+		break;
+
+	case NUMPLAN_PRIVATE:
+		ast_number_plan = NUMPLAN_PRIVATE;
+		break;
+	}	/* end switch */
+
+	return ast_number_plan;
+}	/* end misdn_plan_to_ast_plan() */
+
+
+
+
+/* ******************************************************************* */
+/*!
+ * \internal
+ * \brief Convert the Asterisk numbering plan code to mISDN numbering plan code
+ *
+ * \param ast_number_plan Asterisk numbering plan code.
+ *
+ * \return mISDN numbering plan code
+ */
+static enum mISDN_NUMBER_PLAN ast_plan_to_misdn_plan(unsigned ast_number_plan)
+{
+	enum mISDN_NUMBER_PLAN number_plan;
+
+	switch (ast_number_plan & 0x0F) {
+	default:
+	case NUMPLAN_UNKNOWN:
+		number_plan = NUMPLAN_UNKNOWN;
+		break;
+
+	case NUMPLAN_ISDN:
+		number_plan = NUMPLAN_ISDN;
+		break;
+
+	case NUMPLAN_DATA:
+		number_plan = NUMPLAN_DATA;
+		break;
+
+	case NUMPLAN_TELEX:
+		number_plan = NUMPLAN_TELEX;
+		break;
+
+	case NUMPLAN_NATIONAL:
+		number_plan = NUMPLAN_NATIONAL;
+		break;
+
+	case NUMPLAN_PRIVATE:
+		number_plan = NUMPLAN_PRIVATE;
+		break;
+	}	/* end switch */
+
+	return number_plan;
+}	/* end ast_plan_to_misdn_plan() */
 
 
 
@@ -1565,7 +1841,7 @@
 		help->originator == ORG_AST ? "*" : "I",
 		ast ? ast->exten : "",
 		(ast && ast->cid.cid_num) ? ast->cid.cid_num : "",
-		bc->redirecting.number,
+		bc->redirecting.from.number,
 		ast ? ast->context : "",
 		misdn_get_ch_state(help));
 	if (misdn_debug[bc->port] > 0) {
@@ -2244,20 +2520,26 @@
 }
 
 
-void debug_numplan(int port, int numplan, char *type)
-{
-	switch (numplan) {
-	case NUMPLAN_INTERNATIONAL:
+void debug_numtype(int port, int numtype, char *type)
+{
+	switch (numtype) {
+	case NUMTYPE_UNKNOWN:
+		chan_misdn_log(2, port, " --> %s: Unknown\n", type);
+		break;
+	case NUMTYPE_INTERNATIONAL:
 		chan_misdn_log(2, port, " --> %s: International\n", type);
 		break;
-	case NUMPLAN_NATIONAL:
+	case NUMTYPE_NATIONAL:
 		chan_misdn_log(2, port, " --> %s: National\n", type);
 		break;
-	case NUMPLAN_SUBSCRIBER:
+	case NUMTYPE_NETWORK_SPECIFIC:
+		chan_misdn_log(2, port, " --> %s: Network Specific\n", type);
+		break;
+	case NUMTYPE_SUBSCRIBER:
 		chan_misdn_log(2, port, " --> %s: Subscriber\n", type);
 		break;
-	case NUMPLAN_UNKNOWN:
-		chan_misdn_log(2, port, " --> %s: Unknown\n", type);
+	case NUMTYPE_ABBREVIATED:
+		chan_misdn_log(2, port, " --> %s: Abbreviated\n", type);
 		break;
 		/* Maybe we should cut off the prefix if present ? */
 	default:
@@ -2399,6 +2681,8 @@
 	if (orig == ORG_AST) {
 		char callerid[BUFFERSIZE + 1];
 
+		/* ORIGINATOR Asterisk (outgoing call) */
+
 		misdn_cfg_get(port, MISDN_CFG_TE_CHOOSE_CHANNEL, &(bc->te_choose_channel), sizeof(bc->te_choose_channel));
 
  		if (strstr(faxdetect, "outgoing") || strstr(faxdetect, "both")) {
@@ -2410,20 +2694,27 @@
 
 		misdn_cfg_get(port, MISDN_CFG_CALLERID, callerid, sizeof(callerid));
 		if ( ! ast_strlen_zero(callerid) ) {
-			chan_misdn_log(1, port, " --> * Setting Cid to %s\n", callerid);
+			chan_misdn_log(1, port, " --> * Setting Caller id to %s\n", callerid);
 			ast_copy_string(bc->caller.number, callerid, sizeof(bc->caller.number));
 		}
 
 		misdn_cfg_get(port, MISDN_CFG_DIALPLAN, &bc->dialed.number_type, sizeof(bc->dialed.number_type));
+		bc->dialed.number_plan = NUMPLAN_ISDN;
+		debug_numtype(port, bc->dialed.number_type, "TON");
+
 		misdn_cfg_get(port, MISDN_CFG_LOCALDIALPLAN, &bc->caller.number_type, sizeof(bc->caller.number_type));
+		bc->caller.number_plan = NUMPLAN_ISDN;
+		debug_numtype(port, bc->caller.number_type, "LTON");
+
 		misdn_cfg_get(port, MISDN_CFG_CPNDIALPLAN, &bc->connected.number_type, sizeof(bc->connected.number_type));
-		debug_numplan(port, bc->dialed.number_type, "TON");
-		debug_numplan(port, bc->caller.number_type, "LTON");
-		debug_numplan(port, bc->connected.number_type, "CTON");
+		bc->connected.number_plan = NUMPLAN_ISDN;
+		debug_numtype(port, bc->connected.number_type, "CTON");
 
 		ch->overlap_dial = 0;
-	} else { /** ORIGINATOR MISDN **/
-		char prefix[BUFFERSIZE + 1] = "";
+	} else {
+		char prefix[BUFFERSIZE + 1];
+
+		/* ORIGINATOR MISDN (incoming call) */
 
  		if (strstr(faxdetect, "incoming") || strstr(faxdetect, "both")) {
  			if (strstr(faxdetect, "nojump"))
@@ -2433,20 +2724,21 @@
  		}
 
 		misdn_cfg_get(port, MISDN_CFG_CPNDIALPLAN, &bc->connected.number_type, sizeof(bc->connected.number_type));
-		debug_numplan(port, bc->connected.number_type, "CTON");
-
+		bc->connected.number_plan = NUMPLAN_ISDN;
+		debug_numtype(port, bc->connected.number_type, "CTON");
+
+		/* Add configured prefix to caller.number */
+		prefix[0] = 0;
 		switch (bc->caller.number_type) {
-		case NUMPLAN_INTERNATIONAL:
+		case NUMTYPE_INTERNATIONAL:
 			misdn_cfg_get(bc->port, MISDN_CFG_INTERNATPREFIX, prefix, sizeof(prefix));
 			break;
-
-		case NUMPLAN_NATIONAL:
+		case NUMTYPE_NATIONAL:
 			misdn_cfg_get(bc->port, MISDN_CFG_NATPREFIX, prefix, sizeof(prefix));
 			break;
 		default:
 			break;
 		}
-
 		ast_copy_string(buf, bc->caller.number, sizeof(buf));
 		snprintf(bc->caller.number, sizeof(bc->caller.number), "%s%s", prefix, buf);
 
@@ -2454,19 +2746,18 @@
 			ast_copy_string(bc->dialed.number, bc->keypad, sizeof(bc->dialed.number));
 		}
 
+		/* Add configured prefix to dialed.number */
 		prefix[0] = 0;
-
 		switch (bc->dialed.number_type) {
-		case NUMPLAN_INTERNATIONAL:
+		case NUMTYPE_INTERNATIONAL:
 			misdn_cfg_get(bc->port, MISDN_CFG_INTERNATPREFIX, prefix, sizeof(prefix));
 			break;
-		case NUMPLAN_NATIONAL:
+		case NUMTYPE_NATIONAL:
 			misdn_cfg_get(bc->port, MISDN_CFG_NATPREFIX, prefix, sizeof(prefix));
 			break;
 		default:
 			break;
 		}
-
 		ast_copy_string(buf, bc->dialed.number, sizeof(buf));
 		snprintf(bc->dialed.number, sizeof(bc->dialed.number), "%s%s", prefix, buf);
 
@@ -2476,19 +2767,19 @@
 
 		ast_set_callerid(ast, bc->caller.number, NULL, bc->caller.number);
 
-		if (!ast_strlen_zero(bc->redirecting.number)) {
-			if (ast->cid.cid_rdnis)
+		if (!ast_strlen_zero(bc->redirecting.from.number)) {
+			if (ast->cid.cid_rdnis) {
 				ast_free(ast->cid.cid_rdnis);
-			ast->cid.cid_rdnis = ast_strdup(bc->redirecting.number);
-
-			//! \todo XXX Need to convert the mISDN number type to Q.931 number type/plan
-			//ast->redirecting.from.number_type = misdn_type_to_ast_type(bc->redirecting.number_type)
-			// | misdn_plan_to_ast_plan(bc->redirecting.plan);
+			}
+			ast->cid.cid_rdnis = ast_strdup(bc->redirecting.from.number);
+
+			ast->redirecting.from.number_type =
+				misdn_ton_to_ast_ton(bc->redirecting.from.number_type)
+				| misdn_plan_to_ast_plan(bc->redirecting.from.number_plan);
 			ast->redirecting.from.number_presentation =
-				misdn_pres_to_ast_pres(bc->redirecting.presentation)
-				| misdn_screen_to_ast_screen(bc->redirecting.screening);
-			// Also need a redirecting reason parameter. 
-			//ast->redirecting.reason = bc->redirecting_reason;
+				misdn_pres_to_ast_pres(bc->redirecting.from.presentation)
+				| misdn_screen_to_ast_screen(bc->redirecting.from.screening);
+			ast->redirecting.reason = bc->redirecting.reason;
 		}
 	
 		misdn_cfg_get(bc->port, MISDN_CFG_OVERLAP_DIAL, &ch->overlap_dial, sizeof(ch->overlap_dial));
@@ -2532,9 +2823,11 @@
  */
 static void misdn_update_connectedline(struct ast_channel *ast, struct misdn_bchannel *bc)
 {
-	ast_copy_string(bc->connected.number, ast->connected.id.number, sizeof(bc->connected.number));
+	ast_copy_string(bc->connected.number, S_OR(ast->connected.id.number, ""), sizeof(bc->connected.number));
 	bc->connected.presentation = ast_pres_to_misdn_pres(ast->connected.id.number_presentation);
 	bc->connected.screening = ast_screen_to_misdn_screen(ast->connected.id.number_presentation);
+	bc->connected.number_type = ast_ton_to_misdn_ton(ast->connected.id.number_type);
+	bc->connected.number_plan = ast_plan_to_misdn_plan(ast->connected.id.number_type);
 }	/* end misdn_update_connectedline() */
 
 
@@ -2552,7 +2845,12 @@
  */
 static void misdn_update_redirecting(struct ast_channel *ast, struct misdn_bchannel *bc)
 {
-	/*! \todo BUGBUG misdn_update_redirecting() not written */
+	ast_copy_string(bc->redirecting.from.number, S_OR(ast->cid.cid_rdnis, ""), sizeof(bc->redirecting.from.number));
+	bc->redirecting.from.presentation = ast_pres_to_misdn_pres(ast->redirecting.from.number_presentation);
+	bc->redirecting.from.screening = ast_screen_to_misdn_screen(ast->redirecting.from.number_presentation);
+	bc->redirecting.from.number_type = ast_ton_to_misdn_ton(ast->redirecting.from.number_type);
+	bc->redirecting.from.number_plan = ast_plan_to_misdn_plan(ast->redirecting.from.number_type);
+	bc->redirecting.reason = ast->redirecting.reason;
 }	/* end misdn_update_redirecting() */
 
 
@@ -2657,14 +2955,12 @@
 		newbc->caller.presentation = newbc->presentation;
 	}
 
-	/*!
-	 * \todo XXX We should be getting all of the redirect parameters from the asterisk channel 
-	 * but its not supported now. 
-	 * Also need a redirecting reason parameter. 
-	 */
-	ast_copy_string(newbc->redirecting.number, S_OR(ast->cid.cid_rdnis, ""), sizeof(newbc->redirecting.number));
-	newbc->redirecting.presentation = newbc->caller.presentation;
-	newbc->redirecting.screening = newbc->caller.screening;
+	ast_copy_string(newbc->redirecting.from.number, S_OR(ast->cid.cid_rdnis, ""), sizeof(newbc->redirecting.from.number));
+	newbc->redirecting.from.presentation = ast_pres_to_misdn_pres(ast->redirecting.from.number_presentation);
+	newbc->redirecting.from.screening = ast_screen_to_misdn_screen(ast->redirecting.from.number_presentation);
+	newbc->redirecting.from.number_type = ast_ton_to_misdn_ton(ast->redirecting.from.number_type);
+	newbc->redirecting.from.number_plan = ast_plan_to_misdn_plan(ast->redirecting.from.number_type);
+	newbc->redirecting.reason = ast->redirecting.reason;
 
 	/*check for bridging*/
 	misdn_cfg_get(0, MISDN_GEN_BRIDGING, &bridging, sizeof(bridging));
@@ -2750,9 +3046,10 @@
 	if (ast_strlen_zero(p->bc->connected.number)) {
 		chan_misdn_log(2,p->bc->port," --> empty connected number using dialed number\n");
 		ast_copy_string(p->bc->connected.number, p->bc->dialed.number, sizeof(p->bc->connected.number));
-		p->bc->connected.number_type = p->bc->dialed.number_type;
 		p->bc->connected.presentation = p->bc->presentation;
 		p->bc->connected.screening = 0;	/* unscreened */
+		p->bc->connected.number_type = p->bc->dialed.number_type;
+		p->bc->connected.number_plan = p->bc->dialed.number_plan;
 	}
 
 	misdn_lib_send_event( p->bc, EVENT_CONNECT);
@@ -4619,7 +4916,6 @@
 		int msn_valid = misdn_cfg_is_msn_valid(bc->port, bc->dialed.number);
 		struct ast_channel *chan;
 		int exceed;
-		int pres,screen;
 		int ai;
 		int im;
 
@@ -4699,13 +4995,15 @@
 		ch->ast->rings = 1;
 		ast_setstate(ch->ast, AST_STATE_RINGING);
 
+		chan_misdn_log(2, bc->port, " --> TON: %s(%d)\n", misdn_ton_to_str(bc->caller.number_type), bc->caller.number_type);
+		chan_misdn_log(2, bc->port, " --> PLAN: %s(%d)\n", misdn_plan_to_str(bc->caller.number_plan), bc->caller.number_plan);
+		chan->cid.cid_ton = misdn_ton_to_ast_ton(bc->caller.number_type)
+			| misdn_plan_to_ast_plan(bc->caller.number_plan);
+
 		chan_misdn_log(2, bc->port, " --> PRES: %s(%d)\n", misdn_pres_to_str(bc->caller.presentation), bc->caller.presentation);
-		pres = misdn_pres_to_ast_pres(bc->caller.presentation);
-
 		chan_misdn_log(2, bc->port, " --> SCREEN: %s(%d)\n", misdn_screen_to_str(bc->caller.screening), bc->caller.screening);
-		screen = misdn_screen_to_ast_screen(bc->caller.screening);
-
-		chan->cid.cid_pres = pres | screen;
+		chan->cid.cid_pres = misdn_pres_to_ast_pres(bc->caller.presentation)
+			| misdn_screen_to_ast_screen(bc->caller.screening);
 
 		pbx_builtin_setvar_helper(chan, "TRANSFERCAPABILITY", ast_transfercapability2str(bc->capability));
 		chan->transfercapability = bc->capability;
@@ -4982,15 +5280,14 @@
 				bridged_ch->bc->connected = bc->connected;
 			}
 		} else {
-			int presentation;
 			struct ast_party_id line_id;
 
 			ast_party_id_init(&line_id);
-			presentation = misdn_pres_to_ast_pres(bc->connected.presentation)
+			line_id.number = bc->connected.number;
+			line_id.number_type = misdn_ton_to_ast_ton(bc->connected.number_type)
+				| misdn_plan_to_ast_plan(bc->connected.number_plan);
+			line_id.number_presentation = misdn_pres_to_ast_pres(bc->connected.presentation)
 				| misdn_screen_to_ast_screen(bc->connected.screening);
-			line_id.number = bc->connected.number;
-			line_id.number_type = bc->connected.number_type;
-			line_id.number_presentation = presentation;
 			ast_queue_connected_line_update(ch->ast, &line_id, 0 /*! \todo XXX Need an answer value to put here */);
 		}
 	

Modified: team/group/issue8824/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/misdn/isdn_lib.c?view=diff&rev=142574&r1=142573&r2=142574
==============================================================================
--- team/group/issue8824/channels/misdn/isdn_lib.c (original)
+++ team/group/issue8824/channels/misdn/isdn_lib.c Thu Sep 11 17:53:28 2008
@@ -637,19 +637,24 @@
 static void empty_bc(struct misdn_bchannel *bc)
 {
 	bc->caller.presentation = 0;	/* allowed */
-	bc->caller.number_type = NUMPLAN_UNKNOWN;
+	bc->caller.number_plan = NUMPLAN_ISDN;
+	bc->caller.number_type = NUMTYPE_UNKNOWN;
 	bc->caller.number[0] = 0;
 	bc->caller.subaddress[0] = 0;
 
 	bc->connected.presentation = 0;	/* allowed */
-	bc->connected.number_type = NUMPLAN_UNKNOWN;
+	bc->connected.number_plan = NUMPLAN_ISDN;
+	bc->connected.number_type = NUMTYPE_UNKNOWN;
 	bc->connected.number[0] = 0;
 	bc->connected.subaddress[0] = 0;
 
-	bc->redirecting.presentation = 0;	/* allowed */
-	bc->redirecting.number_type = NUMPLAN_UNKNOWN;
-	bc->redirecting.number[0] = 0;
-	bc->redirecting.subaddress[0] = 0;
+	bc->redirecting.from.presentation = 0;	/* allowed */
+	bc->redirecting.from.number_plan = NUMPLAN_ISDN;
+	bc->redirecting.from.number_type = NUMTYPE_UNKNOWN;
+	bc->redirecting.from.number[0] = 0;
+	bc->redirecting.from.subaddress[0] = 0;
+
+	bc->redirecting.reason = REDIRECTING_REASON_UNKNOWN;
 
 	bc->dummy=0;
 
@@ -722,7 +727,8 @@
 	
 	bc->hdlc=0;
 	
-	bc->dialed.number_type = NUMPLAN_UNKNOWN;
+	bc->dialed.number_plan = NUMPLAN_ISDN;
+	bc->dialed.number_type = NUMTYPE_UNKNOWN;
 	bc->dialed.number[0] = 0;
 	bc->dialed.subaddress[0] = 0;
 	
@@ -3330,28 +3336,33 @@
 		bc->out_cause);
 	
 	cb_log(2, stack->port,
-		" --> info_dad:%s dnumtype:%c\n",
+		" --> info_dad:%s dnumtype:%d plan:%d\n",
 		bc->info_dad,
-		bc->dialed.number_type >= 0 ? '0' + bc->dialed.number_type : ' ');
+		bc->dialed.number_type,
+		bc->dialed.number_plan);
 
 	cb_log(2, stack->port,
-		" --> caller:%s type:%c pres:%d screen:%d\n",
+		" --> caller:%s type:%d plan:%d pres:%d screen:%d\n",
 		bc->caller.number,
-		bc->caller.number_type >= 0 ? '0' + bc->caller.number_type : ' ',
+		bc->caller.number_type,
+		bc->caller.number_plan,
 		bc->caller.presentation,
 		bc->caller.screening);
 
 	cb_log(2, stack->port,
-		" --> redirecting:%s type:%c pres:%d screen:%d\n",
-		bc->redirecting.number,
-		bc->redirecting.number_type >= 0 ? '0' + bc->redirecting.number_type : ' ',
-		bc->redirecting.presentation,
-		bc->redirecting.screening);
+		" --> redirecting:%s type:%d plan:%d pres:%d screen:%d reason:%d\n",
+		bc->redirecting.from.number,
+		bc->redirecting.from.number_type,
+		bc->redirecting.from.number_plan,
+		bc->redirecting.from.presentation,
+		bc->redirecting.from.screening,
+		bc->redirecting.reason);
 
 	cb_log(2, stack->port,
-		" --> connected:%s type:%c pres:%d screen:%d\n",
+		" --> connected:%s type:%d plan:%d pres:%d screen:%d\n",
 		bc->connected.number,
-		bc->connected.number_type >= 0 ? '0' + bc->connected.number_type : ' ',
+		bc->connected.number_type,
+		bc->connected.number_plan,
 		bc->connected.presentation,
 		bc->connected.screening);
 	

Modified: team/group/issue8824/channels/misdn/isdn_lib.h
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/misdn/isdn_lib.h?view=diff&rev=142574&r1=142573&r2=142574
==============================================================================
--- team/group/issue8824/channels/misdn/isdn_lib.h (original)
+++ team/group/issue8824/channels/misdn/isdn_lib.h Thu Sep 11 17:53:28 2008
@@ -96,15 +96,23 @@
 	ENOCHAN=1
 };
 
-
 enum mISDN_NUMBER_PLAN {
-	NUMPLAN_UNINITIALIZED=-1,
-	NUMPLAN_UNKNOWN=0x0,
-	NUMPLAN_INTERNATIONAL=0x1,
-	NUMPLAN_NATIONAL=0x2,
-	NUMPLAN_SUBSCRIBER=0x4
-};
-
+	NUMPLAN_UNKNOWN = 0x0,
+	NUMPLAN_ISDN = 0x1,		/* ISDN/Telephony numbering plan E.164 */
+	NUMPLAN_DATA = 0x3,		/* Data numbering plan X.121 */
+	NUMPLAN_TELEX = 0x4,	/* Telex numbering plan F.69 */
+	NUMPLAN_NATIONAL = 0x8,
+	NUMPLAN_PRIVATE = 0x9
+};
+
+enum mISDN_NUMBER_TYPE {
+	NUMTYPE_UNKNOWN = 0x0,
+	NUMTYPE_INTERNATIONAL = 0x1,
+	NUMTYPE_NATIONAL = 0x2,
+	NUMTYPE_NETWORK_SPECIFIC = 0x3,
+	NUMTYPE_SUBSCRIBER = 0x4,
+	NUMTYPE_ABBREVIATED = 0x5
+};
 
 enum event_response_e {
 	RESPONSE_IGNORE_SETUP_WITHOUT_CLOSE,
@@ -189,6 +197,19 @@
 	INFO_PI_INTERWORKING_NO_RELEASE_POST_ANSWER =0x13
 };
 
+/*! 
+ * \brief Q.931 encoded redirecting reason
+ */
+enum mISDN_REDIRECTING_REASON {
+	REDIRECTING_REASON_UNKNOWN = 0x0,
+	REDIRECTING_REASON_CALL_FWD_BUSY = 0x1,	/* Call forwarding busy or called DTE busy */
+	REDIRECTING_REASON_NO_REPLY = 0x2,		/* Call forwarding no reply */
+	REDIRECTING_REASON_DEFLECTION = 0x4,	/* Call deflection */
+	REDIRECTING_REASON_OUT_OF_ORDER = 0x9,	/* Called DTE out of order */
+	REDIRECTING_REASON_CALL_FWD_DTE = 0xA,	/* Call forwarding by the called DTE */
+	REDIRECTING_REASON_CALL_FWD = 0xF		/* Call forwarding unconditional or systematic call redirection */
+};
+
 enum { /*CODECS*/
 	INFO_CODEC_ULAW=2,
 	INFO_CODEC_ALAW=3
@@ -212,7 +233,7 @@
 #define MISDN_MAX_KEYPAD_LEN		(31 + 1)
 
 /*! \brief Connected-Line/Calling/Redirecting ID info struct */
-struct misdn_endpoint_id {
+struct misdn_party_id {
 	/*! \brief Number presentation restriction code
 	 * 0=Allowed, 1=Restricted, 2=Unavailable
 	 */
@@ -224,13 +245,25 @@
 	int screening;
 
 	/*! \brief Type-of-number in ISDN terms for the number */
-	enum mISDN_NUMBER_PLAN number_type;
+	enum mISDN_NUMBER_TYPE number_type;
+
+	/*! \brief Type-of-number numbering plan. */
+	enum mISDN_NUMBER_PLAN number_plan;
 
 	/*! \brief Phone number (Address) */
 	char number[MISDN_MAX_NUMBER_LEN];
 
 	/*! \brief Subaddress number */
 	char subaddress[MISDN_MAX_SUBADDRESS_LEN];
+};
+
+/*! \brief Redirecting information struct */
+struct misdn_party_redirecting {
+	/*! \brief Who is redirecting the call (Sent to the party the call is redirected toward) */
+	struct misdn_party_id from;
+
+	/*! \brief Reason a call is being redirected (Q.931 field value) */
+	enum mISDN_REDIRECTING_REASON reason;
 };
 
 
@@ -243,18 +276,17 @@
 	 * \note The number_type element is set to "localdialplan" in /etc/asterisk/misdn.conf for outgoing calls
 	 * \note The number element can be set to "callerid" in /etc/asterisk/misdn.conf for outgoing calls
 	 */
-	struct misdn_endpoint_id caller;
+	struct misdn_party_id caller;
 
 	/*! \brief Connected-Party/Connected-Line ID information struct
 	 * \note The number_type element is set to "cpndialplan" in /etc/asterisk/misdn.conf for outgoing calls
 	 */
-	struct misdn_endpoint_id connected;
-
-	/*! \brief Redirecting ID information struct (Where a call diversion or transfer was invoked)
-	 * \note The number_type element is collected from the incoming SETUP message but not used.
+	struct misdn_party_id connected;
+
+	/*! \brief Redirecting information struct (Where a call diversion or transfer was invoked)
 	 * \note The redirecting subaddress is not defined in Q.931 so it is not used.
 	 */
-	struct misdn_endpoint_id redirecting;
+	struct misdn_party_redirecting redirecting;
 
 	/*! \brief TRUE if this is a dummy BC record */
 	int dummy;
@@ -493,7 +525,10 @@
 		/*! \brief Type-of-number in ISDN terms for the dialed/called number
 		 * \note This value is set to "dialplan" in /etc/asterisk/misdn.conf for outgoing calls
 		 */
-		enum mISDN_NUMBER_PLAN number_type;
+		enum mISDN_NUMBER_TYPE number_type;
+
+		/*! \brief Type-of-number numbering plan. */
+		enum mISDN_NUMBER_PLAN number_plan;
 
 		/*! \brief Dialed/Called Phone Number (Address) */
 		char number[MISDN_MAX_NUMBER_LEN];

Modified: team/group/issue8824/channels/misdn/isdn_msg_parser.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/channels/misdn/isdn_msg_parser.c?view=diff&rev=142574&r1=142573&r2=142574
==============================================================================
--- team/group/issue8824/channels/misdn/isdn_msg_parser.c (original)
+++ team/group/issue8824/channels/misdn/isdn_msg_parser.c Thu Sep 11 17:53:28 2008
@@ -161,59 +161,74 @@
 	int HEADER_LEN = nt?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
 	SETUP_t *setup= (SETUP_t*)((unsigned long)msg->data+HEADER_LEN);
 	Q931_info_t *qi=(Q931_info_t*)((unsigned long)msg->data+HEADER_LEN);
+	int type;
+	int plan;
+	int present;
+	int screen;
+	int reason;
 
 #ifdef DEBUG 
 	printf("Parsing SETUP Msg\n"); 
 #endif
-	{
-		int type,plan,present, screen;
-		dec_ie_calling_pn(setup->CALLING_PN, qi, &type, &plan, &present, &screen, bc->caller.number, sizeof(bc->caller.number) - 1, nt, bc);
-
-		bc->caller.number_type = type; 
-		switch (present) {
-		default:
-		case 0:
-			bc->caller.presentation = 0;	/* presentation allowed */
-			break;
-		case 1:
-			bc->caller.presentation = 1;	/* presentation restricted */
-			break;
-		case 2:
-			bc->caller.presentation = 2;	/* Number not available */
-			break;
-		}
+
+	dec_ie_calling_pn(setup->CALLING_PN, qi, &type, &plan, &present, &screen, bc->caller.number, sizeof(bc->caller.number) - 1, nt, bc);
+	bc->caller.number_type = type; 
+	bc->caller.number_plan = plan;
+	switch (present) {
+	default:
+	case 0:
+		bc->caller.presentation = 0;	/* presentation allowed */
+		break;
+	case 1:
+		bc->caller.presentation = 1;	/* presentation restricted */
+		break;
+	case 2:
+		bc->caller.presentation = 2;	/* Number not available */
+		break;
+	}
+	if (0 <= screen) {
 		bc->caller.screening = screen;
-	}
-	{
-		int  type, plan;
-		dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *) setup, &type, &plan, bc->dialed.number, sizeof(bc->dialed.number) - 1, nt, bc);
-		bc->dialed.number_type=type; 
-	}
+	} else {
+		bc->caller.screening = 0;	/* Unscreened */
+	}
+
+	dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *) setup, &type, &plan, bc->dialed.number, sizeof(bc->dialed.number) - 1, nt, bc);
+	bc->dialed.number_type = type; 
+	bc->dialed.number_plan = plan;
+
 	dec_ie_keypad(setup->KEYPAD, (Q931_info_t *) setup, bc->keypad, sizeof(bc->keypad) - 1, nt, bc);
 
 	dec_ie_complete(setup->COMPLETE, (Q931_info_t *) setup, &bc->sending_complete, nt, bc);
   
-	{
-		int  type, plan, present, screen, reason;
-		dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *) setup, &type, &plan, &present, &screen, &reason, bc->redirecting.number, sizeof(bc->redirecting.number) - 1, nt, bc);
-    
-		bc->redirecting.number_type = type; 
-		switch (present) {
-		default:
-		case 0:
-			bc->redirecting.presentation = 0;	/* presentation allowed */
-			break;
-		case 1:
-			bc->redirecting.presentation = 1;	/* presentation restricted */
-			break;
-		case 2:
-			bc->redirecting.presentation = 2;	/* Number not available */
-			break;
-		}
-		bc->redirecting.screening = screen;
-	}
+	dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *) setup, &type, &plan, &present, &screen, &reason, bc->redirecting.from.number, sizeof(bc->redirecting.from.number) - 1, nt, bc);
+	bc->redirecting.from.number_type = type; 
+	bc->redirecting.from.number_plan = plan;
+	switch (present) {
+	default:
+	case 0:
+		bc->redirecting.from.presentation = 0;	/* presentation allowed */
+		break;
+	case 1:
+		bc->redirecting.from.presentation = 1;	/* presentation restricted */
+		break;
+	case 2:
+		bc->redirecting.from.presentation = 2;	/* Number not available */
+		break;
+	}
+	if (0 <= screen) {
+		bc->redirecting.from.screening = screen;
+	} else {
+		bc->redirecting.from.screening = 0;	/* Unscreened */
+	}
+	if (0 <= reason) {
+		bc->redirecting.reason = reason;
+	} else {
+		bc->redirecting.reason = REDIRECTING_REASON_UNKNOWN;
+	}
+
 	{
 		int  coding, capability, mode, rate, multi, user, async, urate, stopbits, dbits, parity;
+
 		dec_ie_bearer(setup->BEARER, (Q931_info_t *)setup, &coding, &capability, &mode, &rate, &multi, &user, &async, &urate, &stopbits, &dbits, &parity, nt,bc);
 		switch (capability) {
 		case -1: bc->capability=INFO_CAPABILITY_DIGITAL_UNRESTRICTED; 
@@ -283,23 +298,17 @@
 		enc_ie_channel_id(&setup->CHANNEL_ID, msg, 1, bc->channel, nt,bc);
 	
 	
-	{
-		int plan = 1;
-		enc_ie_calling_pn(&setup->CALLING_PN, msg, bc->caller.number_type, plan,
-			bc->caller.presentation, bc->caller.screening, bc->caller.number, nt, bc);
-	}
+	enc_ie_calling_pn(&setup->CALLING_PN, msg, bc->caller.number_type, bc->caller.number_plan,
+		bc->caller.presentation, bc->caller.screening, bc->caller.number, nt, bc);
   
 	if (bc->dialed.number[0]) {
-		enc_ie_called_pn(&setup->CALLED_PN, msg, bc->dialed.number_type, 1, bc->dialed.number, nt,bc);
-	}
-
-	if (bc->redirecting.number[0]) {
-		int plan = 1;
-		int reason = 0;	/* Unknown redirect reason */
-
-		enc_ie_redir_nr(&setup->REDIR_NR, msg, bc->redirecting.number_type, plan,
-			bc->redirecting.presentation, bc->redirecting.screening, reason,
-			bc->redirecting.number, nt, bc);
+		enc_ie_called_pn(&setup->CALLED_PN, msg, bc->dialed.number_type, bc->dialed.number_plan, bc->dialed.number, nt, bc);
+	}
+
+	if (bc->redirecting.from.number[0]) {
+		enc_ie_redir_nr(&setup->REDIR_NR, msg, bc->redirecting.from.number_type, bc->redirecting.from.number_plan,
+			bc->redirecting.from.presentation, bc->redirecting.from.screening, bc->redirecting.reason,
+			bc->redirecting.from.number, nt, bc);
 	}
 
 	if (bc->keypad[0]) {
@@ -341,9 +350,7 @@
 		default:
 			capability=bc->capability; 
 		}
-		
-		
-    
+
 		enc_ie_bearer(&setup->BEARER, msg, coding, capability, mode, rate, -1, user, nt,bc);
 	}
 
@@ -378,8 +385,8 @@
 
 	dec_ie_connected_pn(connect->CONNECT_PN, (Q931_info_t *) connect, &type, &plan,
 		&pres, &screen, bc->connected.number, sizeof(bc->connected.number) - 1, nt, bc);
-
 	bc->connected.number_type = type;
+	bc->connected.number_plan = plan;
 	switch (pres) {
 	default:
 	case 0:
@@ -392,7 +399,11 @@
 		bc->connected.presentation = 2;	/* Number not available */
 		break;
 	}
-	bc->connected.screening = screen;
+	if (0 <= screen) {
+		bc->connected.screening = screen;
+	} else {
+		bc->connected.screening = 0;	/* Unscreened */
+	}
 
 	/*
 		cb_log(1,bc->port,"CONNETED PN: %s cpn_dialplan:%d\n", connected_pn, type);
@@ -419,12 +430,8 @@
 		enc_ie_date(&connect->DATE, msg, now, nt,bc);
 	}
   
-	{
-		int plan = 1;
-
-		enc_ie_connected_pn(&connect->CONNECT_PN, msg, bc->connected.number_type, plan,
-			bc->connected.presentation, bc->connected.screening, bc->connected.number, nt, bc);
-	}
+	enc_ie_connected_pn(&connect->CONNECT_PN, msg, bc->connected.number_type, bc->connected.number_plan,
+		bc->connected.presentation, bc->connected.screening, bc->connected.number, nt, bc);
 
 #ifdef DEBUG 
 	printf("Building CONNECT Msg\n"); 
@@ -1103,9 +1110,7 @@
  
 	information=(INFORMATION_t*)((msg->data+HEADER_LEN)); 
   
-	{
-		enc_ie_called_pn(&information->CALLED_PN, msg, 0, 1, bc->info_dad, nt,bc);
-	}
+	enc_ie_called_pn(&information->CALLED_PN, msg, 0, 1, bc->info_dad, nt,bc);
 
 	{
 		if (*bc->display) {

Modified: team/group/issue8824/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/funcs/func_callerid.c?view=diff&rev=142574&r1=142573&r2=142574
==============================================================================
--- team/group/issue8824/funcs/func_callerid.c (original)
+++ team/group/issue8824/funcs/func_callerid.c Thu Sep 11 17:53:28 2008
@@ -52,6 +52,9 @@
 			 char *buf, size_t len)
 {
 	char *opt = data;
+
+	/* Ensure that the buffer is empty */
+	*buf = 0;
 
 	if (!chan)
 		return -1;
@@ -120,62 +123,58 @@
 	if (!value || !chan)
 		return -1;
 
+	value = ast_skip_blanks(value);
+
 	if (!strncasecmp("all", data, 3)) {
 		char name[256];
 		char num[256];
 
-		if (!ast_callerid_split(value, name, sizeof(name), num, sizeof(num)))
-			ast_set_callerid(chan, num, name, num);
+		ast_callerid_split(value, name, sizeof(name), num, sizeof(num));
+		ast_set_callerid(chan, num, name, num);
 	} else if (!strncasecmp("name", data, 4)) {
 		ast_set_callerid(chan, NULL, value, NULL);
 	} else if (!strncasecmp("num", data, 3)) { 
 		ast_set_callerid(chan, value, NULL, NULL);
 	} else if (!strncasecmp("ani", data, 3)) {
 		if (!strncasecmp(data + 3, "2", 1)) {
-			int i = atoi(value);
-			chan->cid.cid_ani2 = i;
-		} else
+			chan->cid.cid_ani2 = atoi(value);
+		} else {
 			ast_set_callerid(chan, NULL, NULL, value);
+		}
 	} else if (!strncasecmp("dnid", data, 4)) {
 		ast_channel_lock(chan);
-		if (chan->cid.cid_dnid)
+		if (chan->cid.cid_dnid) {
 			ast_free(chan->cid.cid_dnid);
+		}
 		chan->cid.cid_dnid = ast_strdup(value);
 		ast_channel_unlock(chan);
 	} else if (!strncasecmp("rdnis", data, 5)) {
 		ast_channel_lock(chan);
-		if (chan->cid.cid_rdnis)
+		if (chan->cid.cid_rdnis) {
 			ast_free(chan->cid.cid_rdnis);
+		}
 		chan->cid.cid_rdnis = ast_strdup(value);
 		ast_channel_unlock(chan);
 	} else if (!strncasecmp("pres", data, 4)) {
 		int i;
-		char *s, *val;
-
-		/* Strip leading spaces */
-		while ((value[0] == '\t') || (value[0] == ' '))
-			++value;
+		char *val;
 
 		val = ast_strdupa(value);
-
-		/* Strip trailing spaces */
-		s = val + strlen(val);
-		while ((s != val) && ((s[-1] == '\t') || (s[-1] == ' ')))
-			--s;
-		*s = '\0';
-
-		if ((val[0] >= '0') && (val[0] <= '9'))
+		ast_trim_blanks(val);
+
+		if ((val[0] >= '0') && (val[0] <= '9')) {
 			i = atoi(val);
-		else
+		} else {
 			i = ast_parse_caller_presentation(val);
-
-		if (i < 0)
+		}
+
+		if (i < 0) {
 			ast_log(LOG_ERROR, "Unknown calling number presentation '%s', value unchanged\n", val);
-		else
+		} else {
 			chan->cid.cid_pres = i;
+		}
 	} else if (!strncasecmp("ton", data, 3)) {
-		int i = atoi(value);
-		chan->cid.cid_ton = i;
+		chan->cid.cid_ton = atoi(value);
 	} else {
 		ast_log(LOG_ERROR, "Unknown callerid data type '%s'.\n", data);
 	}

Modified: team/group/issue8824/funcs/func_connectedline.c
URL: http://svn.digium.com/view/asterisk/team/group/issue8824/funcs/func_connectedline.c?view=diff&rev=142574&r1=142573&r2=142574
==============================================================================
--- team/group/issue8824/funcs/func_connectedline.c (original)
+++ team/group/issue8824/funcs/func_connectedline.c Thu Sep 11 17:53:28 2008
@@ -44,6 +44,9 @@
 static int connectedline_read(struct ast_channel *chan, const char *cmd, char *data,
 			      char *buf, size_t len)
 {
+	/* Ensure that the buffer is empty */
+	*buf = 0;
+
 	if (!chan)
 		return -1;
 
@@ -81,7 +84,7 @@
 {
 	struct ast_party_id line_id;
 	int source;
-	char *tmp;
+	char *val;
 
 	if (!value || !chan) {
 		return -1;
@@ -92,15 +95,16 @@
 	source = chan->connected.source;
 	ast_channel_unlock(chan);
 
+	value = ast_skip_blanks(value);
+
 	if (!strncasecmp("all", data, 3)) {
 		char name[256];
 		char num[256];
 
-		if (!ast_callerid_split(value, name, sizeof(name), num, sizeof(num))) {
-			line_id.name = name;
-			line_id.number = num;
-			ast_connected_line_update(chan, &line_id, source);
-		}
+		ast_callerid_split(value, name, sizeof(name), num, sizeof(num));
+		line_id.name = name;
+		line_id.number = num;
+		ast_connected_line_update(chan, &line_id, source);
 	} else if (!strncasecmp("name", data, 4)) {
 		line_id.name = ast_strdupa(value);
 		ast_trim_blanks(line_id.name);
@@ -110,42 +114,42 @@
 		ast_trim_blanks(line_id.number);
 		ast_connected_line_update(chan, &line_id, source);
 	} else if (!strncasecmp("ton", data, 3)) {
-		tmp = ast_strdupa(value);
-		ast_trim_blanks(tmp);
+		val = ast_strdupa(value);
+		ast_trim_blanks(val);
 
-		if (('0' <= tmp[0]) && (tmp[0] <= '9')) {
-			line_id.number_type = atoi(tmp);
+		if (('0' <= val[0]) && (val[0] <= '9')) {
+			line_id.number_type = atoi(val);
 			ast_connected_line_update(chan, &line_id, source);
 		} else {
-			ast_log(LOG_ERROR, "Unknown called type of number '%s', value unchanged\n", tmp);
+			ast_log(LOG_ERROR, "Unknown connectedline type of number '%s', value unchanged\n", val);
 		}
 	} else if (!strncasecmp("pres", data, 4)) {
 		int pres;
 
-		tmp = ast_strdupa(value);
-		ast_trim_blanks(tmp);
+		val = ast_strdupa(value);
+		ast_trim_blanks(val);
 
-		if (('0' <= tmp[0]) && (tmp[0] <= '9')) {
-			pres = atoi(tmp);
+		if (('0' <= val[0]) && (val[0] <= '9')) {
+			pres = atoi(val);
 		} else {
-			pres = ast_parse_caller_presentation(tmp);
+			pres = ast_parse_caller_presentation(val);
 		}
 
 		if (pres < 0) {
-			ast_log(LOG_ERROR, "Unknown called number presentation '%s', value unchanged\n", tmp);
+			ast_log(LOG_ERROR, "Unknown connectedline number presentation '%s', value unchanged\n", val);
 		} else {
 			line_id.number_presentation = pres;
 			ast_connected_line_update(chan, &line_id, source);
 		}
 	} else if (!strncasecmp("source", data, 6)) {
-		tmp = ast_strdupa(value);
-		ast_trim_blanks(tmp);
+		val = ast_strdupa(value);
+		ast_trim_blanks(val);
 
-		if (('0' <= tmp[0]) && (tmp[0] <= '9')) {
-			source = atoi(tmp);
+		if (('0' <= val[0]) && (val[0] <= '9')) {
+			source = atoi(val);
 			ast_connected_line_update(chan, &line_id, source);
 		} else {
-			ast_log(LOG_ERROR, "Unknown called source '%s', value unchanged\n", tmp);
+			ast_log(LOG_ERROR, "Unknown connectedline source '%s', value unchanged\n", val);
 		}
 	} else {

[... 454 lines stripped ...]



More information about the asterisk-commits mailing list