[asterisk-commits] pcadach: branch pcadach/chan_h323-live r43095 - in /team/pcadach/chan_h323-li...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Sep 17 10:55:48 MST 2006


Author: pcadach
Date: Sun Sep 17 12:55:48 2006
New Revision: 43095

URL: http://svn.digium.com/view/asterisk?rev=43095&view=rev
Log:
Make tunneling of signalling information configurable

Modified:
    team/pcadach/chan_h323-live/channels/chan_h323.c
    team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp
    team/pcadach/chan_h323-live/channels/h323/ast_h323.h
    team/pcadach/chan_h323-live/channels/h323/chan_h323.h
    team/pcadach/chan_h323-live/configs/h323.conf.sample

Modified: team/pcadach/chan_h323-live/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/chan_h323.c?rev=43095&r1=43094&r2=43095&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/chan_h323.c (original)
+++ team/pcadach/chan_h323-live/channels/chan_h323.c Sun Sep 17 12:55:48 2006
@@ -1320,6 +1320,15 @@
 		ast_copy_string(options->cid_name, v->value, sizeof(options->cid_name));
 	} else if (!strcasecmp(v->name, "cid_number")) {
 		ast_copy_string(options->cid_num, v->value, sizeof(options->cid_num));
+	} else if (!strcasecmp(v->name, "tunneling")) {
+		if (!strcasecmp(v->value, "none"))
+			options->tunnelOptions = 0;
+		else if (!strcasecmp(v->value, "cisco"))
+			options->tunnelOptions |= H323_TUNNEL_CISCO;
+		else if (!strcasecmp(v->value, "qsig"))
+			options->tunnelOptions |= H323_TUNNEL_QSIG;
+		else
+			ast_log(LOG_WARNING, "Invalid value %s for %s at line %d\n", v->value, v->name, v->lineno);
 	} else
 		return 1;
 

Modified: team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp?rev=43095&r1=43094&r2=43095&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp (original)
+++ team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp Sun Sep 17 12:55:48 2006
@@ -697,10 +697,6 @@
 #endif
 	conn = new MyH323Connection(*this, callReference, options);
 	if (conn) {
-#ifdef TUNNELLING
-		conn->tunnelQSIG = FALSE;
-		conn->remoteTunnelQSIG = FALSE;
-#endif
 		if (opts)
 			conn->SetCallOptions(opts, (setupPDU ? TRUE : FALSE));
 	}
@@ -719,6 +715,9 @@
 	dtmfMode = 0;
 	dtmfCodec = (RTP_DataFrame::PayloadTypes)0;
 	redirect_reason = -1;
+#ifdef TUNNELLING
+	tunnelOptions = remoteTunnelOptions = 0;
+#endif
 	if (h323debug) {
 		cout << "	== New H.323 Connection created." << endl;
 	}
@@ -859,6 +858,7 @@
 			redirect_reason = opts->redirect_reason;
 		}
 	}
+	tunnelOptions = opts->tunnelOptions;
 }
 
 void MyH323Connection::SetCallDetails(void *callDetails, const H323SignalPDU &setupPDU, BOOL isIncoming)
@@ -984,7 +984,9 @@
 
 static BOOL FetchCiscoTunneledInfo(Q931 &q931, const H323SignalPDU &pdu)
 {
+	BOOL res = FALSE;
 	const H225_H323_UU_PDU &uuPDU = pdu.m_h323_uu_pdu;
+
 	if(uuPDU.HasOptionalField(H225_H323_UU_PDU::e_nonStandardControl)) {
 		for(int i = 0; i < uuPDU.m_nonStandardControl.GetSize(); ++i) {
 			const H225_NonStandardParameter &np = uuPDU.m_nonStandardControl[i];
@@ -1012,6 +1014,7 @@
 						}
 						if (haveIEs && h323debug)
 							cout << setprecision(0) << "Information elements collected:" << q931 << endl;
+						res = TRUE;
 					} else {
 						cout << "ERROR while decoding non-standard Cisco extension" << endl;
 						return FALSE;
@@ -1020,7 +1023,7 @@
 			}
 		}
 	}
-	return TRUE;
+	return res;
 }
 
 static BOOL EmbedCiscoTunneledInfo(H323SignalPDU &pdu)
@@ -1214,11 +1217,10 @@
 
 BOOL MyH323Connection::EmbedTunneledInfo(H323SignalPDU &pdu)
 {
-	if (tunnelQSIG || remoteTunnelQSIG) {
-		cout << "Embedding Q.SIG message, tunnelQSIG=" << tunnelQSIG << ", remoteTunnelQSIG=" << remoteTunnelQSIG << endl;
+	if ((tunnelOptions & H323_TUNNEL_QSIG) || (remoteTunnelOptions & H323_TUNNEL_QSIG))
 		EmbedQSIGTunneledInfo(pdu);
-	}
-	EmbedCiscoTunneledInfo(pdu);
+	if ((tunnelOptions & H323_TUNNEL_CISCO) || (remoteTunnelOptions & H323_TUNNEL_CISCO))
+		EmbedCiscoTunneledInfo(pdu);
 
 	return TRUE;
 }
@@ -1231,18 +1233,16 @@
 		const Q931 *q931Info;
 
 		q931Info = NULL;
-		if (FetchCiscoTunneledInfo(tunneledInfo, pdu))
+		if (FetchCiscoTunneledInfo(tunneledInfo, pdu)) {
 			q931Info = &tunneledInfo;
+			remoteTunnelOptions |= H323_TUNNEL_CISCO;
+		}
 		if (FetchQSIGTunneledInfo(tunneledInfo, pdu)) {
 			q931Info = &tunneledInfo;
-			if (!remoteTunnelQSIG) {
-				cout << "Got Q.SIG tunnelled message, enabling tunnelling" << endl;
-				remoteTunnelQSIG = TRUE;
-			}
-		}
-		if (!remoteTunnelQSIG && QSIGTunnelRequested(pdu)) {
-			cout << "Q.SIG tunnelling requested by remote, enable tunnelling" << endl;
-			remoteTunnelQSIG = TRUE;
+			remoteTunnelOptions |= H323_TUNNEL_QSIG;
+		}
+		if (!(remoteTunnelOptions & H323_TUNNEL_QSIG) && QSIGTunnelRequested(pdu)) {
+			remoteTunnelOptions |= H323_TUNNEL_QSIG;
 		}
 		if (q931Info) {
 			if (q931Info->HasIE(Q931::RedirectingNumberIE)) {

Modified: team/pcadach/chan_h323-live/channels/h323/ast_h323.h
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/h323/ast_h323.h?rev=43095&r1=43094&r2=43095&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/ast_h323.h (original)
+++ team/pcadach/chan_h323-live/channels/h323/ast_h323.h Sun Sep 17 12:55:48 2006
@@ -234,8 +234,8 @@
 	WORD sessionId;
 	BOOL bridging;
 #ifdef TUNNELLING
-	BOOL remoteTunnelQSIG;
-	BOOL tunnelQSIG;
+	int remoteTunnelOptions;
+	int tunnelOptions;
 #endif
 
 	unsigned progressSetup;

Modified: team/pcadach/chan_h323-live/channels/h323/chan_h323.h
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/h323/chan_h323.h?rev=43095&r1=43094&r2=43095&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/h323/chan_h323.h (original)
+++ team/pcadach/chan_h323-live/channels/h323/chan_h323.h Sun Sep 17 12:55:48 2006
@@ -35,6 +35,9 @@
  *
  */
 #define TUNNELLING
+
+#define H323_TUNNEL_CISCO	(1 << 0)
+#define H323_TUNNEL_QSIG	(1 << 1)
 
 /** call_option struct holds various bits
  *         of information for each call */
@@ -54,6 +57,7 @@
 	int				capability;
 	int				bridge;
 	int				nat;
+	int				tunnelOptions;
 	struct ast_codec_pref	prefs;
 } call_options_t;
 

Modified: team/pcadach/chan_h323-live/configs/h323.conf.sample
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/configs/h323.conf.sample?rev=43095&r1=43094&r2=43095&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/configs/h323.conf.sample (original)
+++ team/pcadach/chan_h323-live/configs/h323.conf.sample Sun Sep 17 12:55:48 2006
@@ -94,6 +94,17 @@
 ; backward audio path at other end of a call.
 ;progress_audio = yes
 ;
+; Specify how to inject non-standard information into H.323 messages. When
+; the channel receives messages with tunneled information, it automatically
+; enables the same option for all further outgoing messages independedly on
+; options has been set by the configuration. This behavior is required, for
+; example, for Cisco CallManager when Q.SIG tunneling is enabled for a
+; gateway where Asterisk lives.
+; The option can be used multiple times, one option per line.
+;tunneling=none              ; Totally disable tunneling (default)
+;tunneling=cisco             ; Enable Cisco-specific tunneling
+;tunneling=qsig              ; Enable tunneling via Q.SIG messages
+;
 ;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
 ; jbenable = yes              ; Enables the use of a jitterbuffer on the receiving side of a
                               ; H323 channel. Defaults to "no". An enabled jitterbuffer will



More information about the asterisk-commits mailing list