[asterisk-commits] pcadach: branch 1.4 r44009 - in /branches/1.4/channels: ./ h323/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Sep 29 11:30:35 MST 2006


Author: pcadach
Date: Fri Sep 29 13:30:34 2006
New Revision: 44009

URL: http://svn.digium.com/view/asterisk?rev=44009&view=rev
Log:
Pass TON/PRESENTATION information too

Modified:
    branches/1.4/channels/chan_h323.c
    branches/1.4/channels/h323/ast_h323.cxx
    branches/1.4/channels/h323/ast_h323.h
    branches/1.4/channels/h323/chan_h323.h

Modified: branches/1.4/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_h323.c?rev=44009&r1=44008&r2=44009&view=diff
==============================================================================
--- branches/1.4/channels/chan_h323.c (original)
+++ branches/1.4/channels/chan_h323.c Fri Sep 29 13:30:34 2006
@@ -626,6 +626,9 @@
 		strncpy(pvt->options.cid_rdnis, c->cid.cid_rdnis, sizeof(pvt->options.cid_rdnis));
 	}
 
+	pvt->options.presentation = c->cid.cid_pres;
+	pvt->options.type_of_number = c->cid.cid_ton;
+
 	if ((addr = pbx_builtin_getvar_helper(c, "PRIREDIRECTREASON"))) {
 		if (!strcasecmp(addr, "UNKNOWN"))
 			pvt->options.redirect_reason = 0;
@@ -1076,6 +1079,8 @@
 			ch->cid.cid_rdnis = ast_strdup(pvt->cd.redirect_number);
 			pbx_builtin_setvar_helper(ch, "PRIREDIRECTREASON", redirectingreason2str(pvt->cd.redirect_reason));
 		}
+		ch->cid.cid_pres = pvt->cd.presentation;
+		ch->cid.cid_ton = pvt->cd.type_of_number;
 
 		if (!ast_strlen_zero(pvt->exten) && strcmp(pvt->exten, "s")) {
 			ch->cid.cid_dnid = strdup(pvt->exten);

Modified: branches/1.4/channels/h323/ast_h323.cxx
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/h323/ast_h323.cxx?rev=44009&r1=44008&r2=44009&view=diff
==============================================================================
--- branches/1.4/channels/h323/ast_h323.cxx (original)
+++ branches/1.4/channels/h323/ast_h323.cxx Fri Sep 29 13:30:34 2006
@@ -715,6 +715,8 @@
 			rdnis = PString(opts->cid_rdnis);
 			redirect_reason = opts->redirect_reason;
 		}
+		cid_presentation = opts->presentation;
+		cid_ton = opts->type_of_number;
 	}
 	tunnelOptions = opts->tunnelOptions;
 }
@@ -747,6 +749,17 @@
 		WORD sourcePort;
 		PString redirect_number;
 		unsigned redirect_reason;
+		unsigned plan, type, screening, presentation;
+
+		/* Fetch presentation and type information about calling party's number */
+		if (setupPDU.GetQ931().GetCallingPartyNumber(sourceName, &plan, &type, &presentation, &screening, 2, 3)) {
+			/* Construct fields back */
+			cd->type_of_number = (type << 4) | screening;
+			cd->presentation = (presentation << 5) | screening;
+		} else {
+			cd->type_of_number = 0;		/* UNKNOWN */
+			cd->presentation = 0x43;	/* NUMBER NOT AVAILABLE */
+		}
 
 		sourceName = setupPDU.GetQ931().GetDisplayName();
 		cd->call_source_name = strdup((const char *)sourceName);
@@ -886,8 +899,14 @@
 
 static BOOL EmbedCiscoTunneledInfo(H323SignalPDU &pdu)
 {
-	const static Q931::InformationElementCodes codes[] =
-	{ Q931::RedirectingNumberIE, Q931::FacilityIE };
+	const static struct {
+		Q931::InformationElementCodes ie;
+		BOOL dontDelete;
+	} codes[] = {
+		{ Q931::RedirectingNumberIE, },
+		{ Q931::FacilityIE, },
+		{ Q931::CallingPartyNumberIE, TRUE },
+	};
 
 	BOOL res = FALSE;
 	BOOL notRedirOnly = FALSE;
@@ -895,10 +914,11 @@
 	Q931 &q931 = pdu.GetQ931();
 
 	for(unsigned i = 0; i < (sizeof(codes) / sizeof(codes[0])); ++i) {
-		if (q931.HasIE(codes[i])) {
-			tmpQ931.SetIE(codes[i], q931.GetIE(codes[i]));
-			q931.RemoveIE(codes[i]);
-			if (codes[i] != Q931::RedirectingNumberIE)
+		if (q931.HasIE(codes[i].ie)) {
+			tmpQ931.SetIE(codes[i].ie, q931.GetIE(codes[i].ie));
+			if (!codes[i].dontDelete)
+				q931.RemoveIE(codes[i].ie);
+			if (codes[i].ie != Q931::RedirectingNumberIE)
 				notRedirOnly = TRUE;
 			res = TRUE;
 		}
@@ -1187,6 +1207,12 @@
 		}
 		return FALSE;
 	}
+
+	/* OpenH323 will build calling party information with default
+	   type and presentation information, so build it to be recorded
+	   by embedding routines */
+	setupPDU.GetQ931().SetCallingPartyNumber(GetLocalPartyName(), (cid_ton >> 4) & 0x07,
+			cid_ton & 0x0f, (cid_presentation >> 5) & 0x03, cid_presentation & 0x1f);
 
 #ifdef TUNNELLING
 	EmbedTunneledInfo(setupPDU);

Modified: branches/1.4/channels/h323/ast_h323.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/h323/ast_h323.h?rev=44009&r1=44008&r2=44009&view=diff
==============================================================================
--- branches/1.4/channels/h323/ast_h323.h (original)
+++ branches/1.4/channels/h323/ast_h323.h Fri Sep 29 13:30:34 2006
@@ -99,6 +99,8 @@
 	PString destAliases;
 	PString sourceE164;
 	PString destE164;
+	int cid_presentation;
+	int cid_ton;
 	PString rdnis;
 	int redirect_reason;
 

Modified: branches/1.4/channels/h323/chan_h323.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/h323/chan_h323.h?rev=44009&r1=44008&r2=44009&view=diff
==============================================================================
--- branches/1.4/channels/h323/chan_h323.h (original)
+++ branches/1.4/channels/h323/chan_h323.h Fri Sep 29 13:30:34 2006
@@ -46,6 +46,8 @@
 	char			cid_name[80];
 	char			cid_rdnis[80];
 	int				redirect_reason;
+	int				presentation;
+	int				type_of_number;
 	int				fastStart;
 	int				h245Tunneling;
 	int				silenceSuppression;
@@ -110,7 +112,7 @@
 	char *redirect_number;
 	int redirect_reason;
 	int presentation;
-	int screening;
+	int type_of_number;
 	char *sourceIp;
 } call_details_t;
 



More information about the asterisk-commits mailing list