Re: [GnomeMeeting-list] Connection to servers



On Tue, 2003-12-09 at 12:47, Malcolm Caldwell wrote:
> > Unfortunately H.323 gatekeepers do not allow to list connected
> > endpoints. If it was permitted we would have replaced ILS servers by
> > gatekeepers a long time ago, because ILS is not that great.
> 
> I think the best solution for the whole ILS mess is to use an open
> source gatekeeper and get it to output a list of users registered.
> 
> opengk already has a html admin interface - with it you can see who is
> registered (and unregister them etc) It could easily modified to:
>      1. output a new html page with h323:// links (and no unregister
>         links)
>      2. outout a xml page that gnomemeeting could use to do its
>         addressbook

OK - I have hacked an implementation of 1 into opengk.  All in all it
took me 45 minutes (someone who know pwlib could have done it quicker!)

Apply the patch below, run
 opengk -x -l log.txt 
and point galeon at http://hostname:1719/who

You will see a page with links to the users who are registered.

This took me next to no time to implement - I think extending a
gatekeeper is a much better solution than using ils.

> Another approach which I started to work on hacked the ndk and pretended
> to be an ils server but really just returned current people on the
> gatekeeper.  It was a bit ugly.
> 
> ils is bad - it is time to drop it and go to more standard approaches.
> 
> > 
? whopagediffs
Index: main.cxx
===================================================================
RCS file: /cvsroot/openh323/contrib/opengk/main.cxx,v
retrieving revision 1.32
diff -u -r1.32 main.cxx
--- main.cxx	2 Apr 2003 07:06:17 -0000	1.32
+++ main.cxx	9 Dec 2003 08:06:06 -0000
@@ -286,6 +286,7 @@
 
   // Create the status page
   httpNameSpace.AddResource(new MainStatusPage(*this, authority),
PHTTPSpace::Overwrite);
+  httpNameSpace.AddResource(new WhoStatusPage(*this, authority),
PHTTPSpace::Overwrite);
 
 
   // Add log file links
@@ -558,6 +559,134 @@
 }
 
 
+WhoStatusPage::WhoStatusPage(OpenGk & _app, PHTTPAuthority & auth)
+  : PServiceHTTPString("who", "", "text/html; charset=UTF-8"),
+    app(_app)
+{
+  PHTML html;
+
+  html << PHTML::Title("OpenH323 Gatekeeper Registrations")
+       << "<meta http-equiv=\"Refresh\" content=\"30\">\n"
+       << PHTML::Body()
+       << app.GetPageGraphic()
+       << PHTML::Paragraph() << "<center>"
+
+    //       << PHTML::Form("POST")
+
+       << PHTML::TableStart("border=1")
+       << PHTML::TableRow()
+    // << PHTML::TableHeader()
+    // << "&nbsp;End&nbsp;Point&nbsp;Identifier&nbsp;"
+       << PHTML::TableHeader()
+       << "&nbsp;Call&nbsp;Signal&nbsp;Addresses&nbsp;"
+       << PHTML::TableHeader()
+       << "&nbsp;Aliases&nbsp;"
+       << PHTML::TableHeader()
+       << "&nbsp;Application&nbsp;"
+       << PHTML::TableHeader()
+       << "&nbsp;Active&nbsp;Calls&nbsp;"
+       << "<!--#macrostart WhoEndPointStatus-->"
+         << PHTML::TableRow()
+    //   << PHTML::TableData()
+    //   << "<!--#status EndPointIdentifier-->"
+         << PHTML::TableData()
+         << "<!--#status CallSignalAddresses-->"
+         << PHTML::TableData("NOWRAP")
+         << "<!--#status EndPointAliases-->"
+         << PHTML::TableData("NOWRAP")
+         << "<!--#status Application-->"
+         << PHTML::TableData("align=center")
+         << "<!--#status ActiveCalls-->"
+         << PHTML::TableData()
+    //   << PHTML::SubmitButton("Unregister", "!--#status
EndPointIdentifier--")
+       << "<!--#macroend WhoEndPointStatus-->"
+       << PHTML::TableEnd()
+
+       << PHTML::Paragraph()
+
+    // << PHTML::TableStart("border=1")
+    // << PHTML::TableRow()
+    // << PHTML::TableHeader()
+    // << "&nbsp;Call&nbsp;Identifier&nbsp;"
+    // << PHTML::TableHeader()
+    // << "&nbsp;End&nbsp;Point&nbsp;"
+    // << PHTML::TableHeader()
+    // << "&nbsp;Source/Destination" << PHTML::BreakLine() <<
"Signalling&nbsp;Addresse&nbsp;"
+    // << PHTML::TableHeader()
+    // << "&nbsp;Last&nbsp;IRR&nbsp;"
+    // << PHTML::TableHeader()
+    // << "&nbsp;Connected&nbsp;"
+    // << "<!--#macrostart CallStatus-->"
+    //   << PHTML::TableRow()
+    //   << PHTML::TableData("NOWRAP")
+    //   << "<!--#status CallIdentifier-->"
+    //   << PHTML::TableData("NOWRAP")
+    //   << "<!--#status EndPointIdentifier-->"
+    //   << PHTML::TableData("NOWRAP")
+    //   << "<!--#status SourceAddress-->"
+    //   << PHTML::BreakLine()
+    //   << "<!--#status DestinationAddress-->"
+    //   << PHTML::TableData()
+    //   << "<!--#status LastIRR-->"
+    //   << PHTML::TableData()
+    //   << "<!--#status ConnectedTime-->"
+    //   << PHTML::TableData()
+    //   << PHTML::SubmitButton("Clear", "!--#status CallIdentifier--")
+    // << "<!--#macroend CallStatus-->"
+    // << PHTML::TableEnd()
+
+    // << PHTML::Form()
+       << PHTML::HRule()
+
+       << app.GetCopyrightText()
+       << PHTML::Body();
+
+  string = html;
+}
+
+PString MyEndPoint::OnWhoLoadEndPointStatus(const PString & htmlBlock)
+{
+  PINDEX i;
+  PString substitution;
+
+  for (PSafePtr<H323RegisteredEndPoint> ep =
gatekeeperServer.GetFirstEndPoint(PSafeReadOnly); ep != NULL; ep++) {
+    // make a copy of the repeating html chunk
+    PString insert = htmlBlock;
+
+    SpliceMacro(insert, "EndPointIdentifier", ep->GetIdentifier());
+
+    PStringStream addresses;
+    for (i = 0; i < ep->GetSignalAddressCount(); i++) {
+      if (i > 0)
+        addresses << "<br>";
+      addresses << ep->GetSignalAddress(i);
+    }
+    SpliceMacro(insert, "CallSignalAddresses", addresses);
+
+    PStringStream aliases;
+    for (i = 0; i < ep->GetAliasCount(); i++) {
+      if (i > 0)
+        aliases << "<br>";
+      aliases << "<A HREF=\"h323://" << ep->GetAlias(i) << "\">";
+      aliases << ep->GetAlias(i) << "</A>";
+    }
+    SpliceMacro(insert, "EndPointAliases", aliases);
+
+    PString str = "<i>Name:</i> " + ep->GetApplicationInfo();
+    str.Replace("\t", "<BR><i>Version:</i> ");
+    str.Replace("\t", " <i>Vendor:</i> ");
+    SpliceMacro(insert, "Application", str);
+
+    SpliceMacro(insert, "ActiveCalls", ep->GetCallCount());
+
+    // Then put it into the page, moving insertion point along after
it.
+    substitution += insert;
+  }
+
+  return substitution;
+}
+
+
 PCREATE_SERVICE_MACRO_BLOCK(EndPointStatus,P_EMPTY,P_EMPTY,block)
 {
   return OpenGk::Current().GetEndPoint().OnLoadEndPointStatus(block);
@@ -567,6 +696,11 @@
 PCREATE_SERVICE_MACRO_BLOCK(CallStatus,P_EMPTY,P_EMPTY,block)
 {
   return OpenGk::Current().GetEndPoint().OnLoadCallStatus(block);
+}
+
+PCREATE_SERVICE_MACRO_BLOCK(WhoEndPointStatus,P_EMPTY,P_EMPTY,block)
+{
+  return
OpenGk::Current().GetEndPoint().OnWhoLoadEndPointStatus(block);
 }
 
 
Index: main.h
===================================================================
RCS file: /cvsroot/openh323/contrib/opengk/main.h,v
retrieving revision 1.10
diff -u -r1.10 main.h
--- main.h	2 Apr 2003 06:13:02 -0000	1.10
+++ main.h	9 Dec 2003 08:06:06 -0000
@@ -144,6 +144,7 @@
     BOOL Initialise(PConfig & cfg, PConfigPage * rsrc);
     PString OnLoadEndPointStatus(const PString & htmlBlock);
     PString OnLoadCallStatus(const PString & htmlBlock);
+    PString OnWhoLoadEndPointStatus(const PString & htmlBlock);
     BOOL OnPostControl(const PStringToString & data, PHTML & msg);
 
   protected:
@@ -186,6 +187,16 @@
       PHTML & msg
     );
   
+  private:
+    OpenGk & app;
+};
+class WhoStatusPage : public PServiceHTTPString
+{
+  PCLASSINFO(WhoStatusPage, PServiceHTTPString);
+
+  public:
+    WhoStatusPage(OpenGk & app, PHTTPAuthority & auth);
+    
   private:
     OpenGk & app;
 };





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