Re: Failover routing support by Radius

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Aivis,

Lucas posted a patch to add this feature. Please test the patch and let
me know if we should add it. So far nobody responded to his post.

Unfortunately the list archive on SF is down, so I'll have to attach his
path here.

Regards,
Jan

Aivis Olsteins wrote:
> Hi
> 
> We guessed from the code that it works for h323-redirect-ip only. If its
> true, it limits the use of this feature quite significantly
> 
> regards
> Aivis
> 
> M.Emran wrote:
> > I have used it for same prefix.so donot have idea.
> > 
> > u can try by
> > h323-redirect-number=123455;56789.but i m not sure tat ths wil work.
> > 
> > 
> > 
> > On 4/20/07, Aivis Olsteins <aivis@xxxxxxxxxxxxxxxx> wrote:
> >> Hi Emran,
> >>
> >> thanks a lot, as far as i understand it does not apply to
> >> h323-redirect-number ? i.e., 2nd preference gateway may require
> >> different prefix than 1st
> >>
> >> regards
> >> Aivis
> >>
> >>
> >> M.Emran wrote:
> >>> Pls send attribute like h323-redirect-ip=123.123.123.123;123.123.123.124
> >>>
> >>> On 4/19/07, Aivis Olsteins <aivis@xxxxxxxxxxxxxxxx> wrote:
> >>>
> >>>> Hello
> >>>>
> >>>> I was looking for some information about failover routing using Radius,
> >>>> but could not find if it is supported or not. I see some comments in
> >>>> radauth.cxx files, but could not figure the format how Radius is
> >>>> supposed to supply routing info.
> >>>>
> >>>> Should we supply a list like this ?
> >>>> 	h323-redirect-ip=10.1.1.1,10.1.1.2
> >>>> 	h323-redirect-number=111222333,444555666
> >>>>
> >>>> Or should we supply a list of attributes like this ?
> >>>> 	h323-redirect-ip=10.1.1.1
> >>>> 	h323-redirect-ip=10.1.1.2
> >>>> 	h323-redirect-number=111222333
> >>>> 	h323-redirect-number=444555666
> >>>>
> >>>> I would appreciate any information about it.
> >>>>
> >>>> regards
> >>>> Aivis
> >>>>
> >>>> -------------------------------------------------------------------------
> >>>> This SF.net email is sponsored by DB2 Express
> >>>> Download DB2 Express C - the FREE version of DB2 express and take
> >>>> control of your XML. No limits. Just data. Click to get it now.
> >>>> http://sourceforge.net/powerbar/db2/
> >>>> _______________________________________________________
> >>>>
> >>>> Posting: mailto:Openh323gk-users@xxxxxxxxxxxxxxxxxxxxx
> >>>> Archive: http://sourceforge.net/mailarchive/forum.php?forum_id=8549
> >>>> Unsubscribe: http://lists.sourceforge.net/lists/listinfo/openh323gk-users
> >>>> Homepage: http://www.gnugk.org/
> >>>>
> >>>
> >>>
> >> -------------------------------------------------------------------------
> >> This SF.net email is sponsored by DB2 Express
> >> Download DB2 Express C - the FREE version of DB2 express and take
> >> control of your XML. No limits. Just data. Click to get it now.
> >> http://sourceforge.net/powerbar/db2/
> >> _______________________________________________________
> >>
> >> Posting: mailto:Openh323gk-users@xxxxxxxxxxxxxxxxxxxxx
> >> Archive: http://sourceforge.net/mailarchive/forum.php?forum_id=8549
> >> Unsubscribe: http://lists.sourceforge.net/lists/listinfo/openh323gk-users
> >> Homepage: http://www.gnugk.org/
> >>
> > 
> > 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________________
> 
> Posting: mailto:Openh323gk-users@xxxxxxxxxxxxxxxxxxxxx
> Archive: http://sourceforge.net/mailarchive/forum.php?forum_id=8549
> Unsubscribe: http://lists.sourceforge.net/lists/listinfo/openh323gk-users
> Homepage: http://www.gnugk.org/
> 


-- 
Jan Willamowius, jan@xxxxxxxxxxxxxx, http://www.gnugk.org/
diff -uN /usr/src/cvs/openh323gk/ProxyChannel.cxx /usr/src/openh323gk.gtt/ProxyChannel.cxx
--- /usr/src/cvs/openh323gk/ProxyChannel.cxx	2007-02-19 14:14:16.000000000 -0300
+++ /usr/src/openh323gk.gtt/ProxyChannel.cxx	2007-02-21 16:26:28.000000000 -0300
@@ -2339,28 +2339,39 @@
 		callingSocket->buffer = callingSocket->m_rawSetup;
 		callingSocket->buffer.MakeUnique();
 	}
-	
+
 	const Route &newRoute = newCall->GetNewRoutes().front();
 	PTRACE(1, "MZ\tNew route: " << 	newRoute.AsString());
 	if (newRoute.m_destEndpoint)
 		newCall->SetCalled(newRoute.m_destEndpoint);
 	else
 		newCall->SetDestSignalAddr(newRoute.m_destAddr);
-				
+
 	if (newRoute.m_flags & Route::e_toParent)
 		newCall->SetToParent(true);
+
+	if(!newRoute.m_destNumber.IsEmpty()) {
+		H225_AliasAddress *destAlias = new H225_AliasAddress();
+		try {
+		H323SetAliasAddress(newRoute.m_destNumber, *destAlias);
+		newCall->SetRouteToAlias(*destAlias);
+		} catch(...) {
+			PTRACE(0, "MZ\tRoute Error: " << newRoute.AsString());
+		}
+		delete destAlias;
+	}
+
 				
 	CallTable::Instance()->Insert(newCall);
-	
+
 	remote = NULL;
-	
 	TCPProxySocket::EndSession();
 	GetHandler()->Remove(this);
-	
+
 	PTRACE(5, GetName() << "\tDispatching new call leg to " << newRoute.AsString());
 	CreateJob(callingSocket, &CallSignalSocket::DispatchNextRoute, "Failover");
 
-	m_result = NoData;				
+	m_result = NoData;
 }
 
 void CallSignalSocket::OnFacility(
@@ -2652,21 +2663,33 @@
 
 				const Route &newRoute = m_call->GetNewRoutes().front();
 				PTRACE(1, "MZ\tNew route: " << 	newRoute.AsString());
-				
+
 				CallRec *newCall = new CallRec(m_call.operator ->());
 				CallTable::Instance()->RemoveFailedLeg(m_call);
 				m_call = callptr(newCall);
-				
+
 				if (newRoute.m_destEndpoint)
 					m_call->SetCalled(newRoute.m_destEndpoint);
 				else
 					m_call->SetDestSignalAddr(newRoute.m_destAddr);
-				
+
 				if (newRoute.m_flags & Route::e_toParent)
 					m_call->SetToParent(true);
+
+				if(!newRoute.m_destNumber.IsEmpty()) {
+					H225_AliasAddress *destAlias = new H225_AliasAddress();
+					try {
+					H323SetAliasAddress(newRoute.m_destNumber, *destAlias);
+					newCall->SetRouteToAlias(*destAlias);
+					} catch(...) {
+						PTRACE(0, "MZ\tRoute Error: " << newRoute.AsString());
+					}
+					delete destAlias;
+				}
+
 				
 				CallTable::Instance()->Insert(newCall);
-				
+
 				if (remote != NULL) {
 					remote->RemoveRemoteSocket();
 					delete remote;
@@ -2858,18 +2881,29 @@
 				m_call->SetCalled(newRoute.m_destEndpoint);
 			else
 				m_call->SetDestSignalAddr(newRoute.m_destAddr);
-				
+
 			if (newRoute.m_flags & Route::e_toParent)
 				m_call->SetToParent(true);
-				
+
+			if(!newRoute.m_destNumber.IsEmpty()) {
+				H225_AliasAddress *destAlias = new H225_AliasAddress();
+				try {
+				H323SetAliasAddress(newRoute.m_destNumber, *destAlias);
+				newCall->SetRouteToAlias(*destAlias);
+				} catch(...) {
+					PTRACE(0, "MZ\tRoute Error: " << newRoute.AsString());
+				}
+				delete destAlias;
+			}
+
 			CallTable::Instance()->Insert(newCall);
-				
+
 			if (remote != NULL) {
 				remote->RemoveRemoteSocket();
 				delete remote;
 				remote = NULL;
 			}
-				
+
 			buffer = m_rawSetup;
 			buffer.MakeUnique();
 				
diff -uN /usr/src/cvs/openh323gk/radauth.cxx /usr/src/openh323gk.gtt/radauth.cxx
--- /usr/src/cvs/openh323gk/radauth.cxx	2007-02-19 14:14:38.000000000 -0300
+++ /usr/src/openh323gk.gtt/radauth.cxx	2007-02-21 16:27:52.000000000 -0300
@@ -790,7 +790,7 @@
 			}
 		}
 	}
-
+	PStringArray numbersToDial;
 	// check for h323-redirect-number
 	if (result) {
 		attr = response->FindVsaAttr(RadiusAttr::CiscoVendorId, 
@@ -799,7 +799,8 @@
 		if (attr != NULL) {
 			value = attr->AsCiscoString();
 			if (!value) {
-				authData.SetRouteToAlias(value);
+				numbersToDial = value.Tokenise("; \t", FALSE);
+				authData.SetRouteToAlias(numbersToDial[0]);
 				PTRACE(5, "RADAUTH\t" << GetName() << " ARQ check redirect "
 					"to the number " << value
 					);
@@ -826,6 +827,7 @@
 						route.m_destEndpoint = RegistrationTable::Instance()->FindBySignalAdr(
 							SocketToH225TransportAddr(addr, port)
 							);
+						route.m_destNumber = (i < numbersToDial.GetSize()) ? numbersToDial[i] : numbersToDial[numbersToDial.GetSize() - 1];
 						authData.m_destinationRoutes.push_back(route);
 						PTRACE(5, "RADAUTH\t" << GetName() << " ARQ check redirect "
 							"to the address " << route.AsString()
@@ -1045,6 +1047,7 @@
 		}
 	}
 
+	PStringArray numbersToDial;
 	// check for h323-redirect-number
 	if (result) {
 		attr = response->FindVsaAttr(RadiusAttr::CiscoVendorId, 
@@ -1053,7 +1056,8 @@
 		if (attr != NULL) {
 			value = attr->AsCiscoString();
 			if (!value) {
-				authData.SetRouteToAlias(value);
+				numbersToDial = value.Tokenise("; \t", FALSE);
+				authData.SetRouteToAlias(numbersToDial[0]);
 				PTRACE(5, "RADAUTH\t" << GetName() << " ARQ check redirect "
 					"to the number " << value
 					);
@@ -1080,6 +1084,7 @@
 						route.m_destEndpoint = RegistrationTable::Instance()->FindBySignalAdr(
 							SocketToH225TransportAddr(addr, port)
 							);
+						route.m_destNumber = (i < numbersToDial.GetSize()) ? numbersToDial[i] : numbersToDial[numbersToDial.GetSize() - 1];
 						authData.m_destinationRoutes.push_back(route);
 						PTRACE(5, "RADAUTH\t" << GetName() << " Setup check redirect "
 							"to the address " << route.AsString()
@@ -1089,7 +1094,7 @@
 			}
 		}
 	}
-			
+
 	if (result)
 		result = OnReceivedPDU(*response, setup, authData);
 	else
diff -uN /usr/src/cvs/openh323gk/Routing.cxx /usr/src/openh323gk.gtt/Routing.cxx
--- /usr/src/cvs/openh323gk/Routing.cxx	2007-02-19 14:14:37.000000000 -0300
+++ /usr/src/openh323gk.gtt/Routing.cxx	2007-02-21 16:30:26.000000000 -0300
@@ -61,7 +61,7 @@
 Route::Route(
 	const endptr &destEndpoint
 	) : m_destAddr(destEndpoint->GetCallSignalAddress()), m_destEndpoint(destEndpoint),
-	m_proxyMode(CallRec::ProxyDetect), m_flags(0)
+	m_proxyMode(CallRec::ProxyDetect), m_flags(0), m_destNumber("")
 {
 	Toolkit::Instance()->SetRerouteCauses(m_rerouteCauses);
 }
@@ -69,7 +69,7 @@
 Route::Route(
 	const PString &policyName,
 	const H225_TransportAddress &destAddr
-	) : m_destAddr(destAddr), m_policy(policyName), m_proxyMode(CallRec::ProxyDetect), m_flags(0)
+	) : m_destAddr(destAddr), m_policy(policyName), m_proxyMode(CallRec::ProxyDetect), m_flags(0), m_destNumber("")
 {
 	Toolkit::Instance()->SetRerouteCauses(m_rerouteCauses);
 }
@@ -79,7 +79,7 @@
 	const PIPSocket::Address &destIpAddr,
 	WORD destPort
 	) : m_destAddr(SocketToH225TransportAddr(destIpAddr, destPort)),
-	m_policy(policyName), m_proxyMode(CallRec::ProxyDetect), m_flags(0)
+	m_policy(policyName), m_proxyMode(CallRec::ProxyDetect), m_flags(0), m_destNumber("")
 {
 	Toolkit::Instance()->SetRerouteCauses(m_rerouteCauses);
 }
@@ -87,7 +87,7 @@
 PString Route::AsString() const
 {
 	return AsDotString(m_destAddr) + " (policy: " + m_policy + ", proxy: "
-		+ PString(m_proxyMode) + ", flags: " + PString(m_flags) + ")";
+		+ PString(m_proxyMode) + ", flags: " + PString(m_flags) + ", DialNumber: " + m_destNumber + ")";
 }
 
 bool Route::IsFailoverActive(
diff -uN /usr/src/cvs/openh323gk/Routing.h /usr/src/openh323gk.gtt/Routing.h
--- /usr/src/cvs/openh323gk/Routing.h	2007-02-19 14:14:37.000000000 -0300
+++ /usr/src/openh323gk.gtt/Routing.h	2007-02-21 16:32:48.000000000 -0300
@@ -78,6 +78,7 @@
 	int m_proxyMode; /// per-route proxy mode flag
 	unsigned m_flags; /// additional route specific flags
 	unsigned char m_rerouteCauses[16]; /// bit flags to trigger rerouting on particular Q931 causes
+	PString m_destNumber;
 };
 
 class RoutingRequest {
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________________

Posting: mailto:Openh323gk-users@xxxxxxxxxxxxxxxxxxxxx
Archive: http://sourceforge.net/mailarchive/forum.php?forum_id=8549
Unsubscribe: http://lists.sourceforge.net/lists/listinfo/openh323gk-users
Homepage: http://www.gnugk.org/

[Index of Archives]     [SIP]     [Open H.323]     [Gnu Gatekeeper]     [Asterisk PBX]     [ISDN Cause Codes]     [Yosemite News]

  Powered by Linux