[asterisk-commits] pcadach: branch pcadach/chan_h323-live r42584 -
in /team/pcadach/chan_h323-li...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sat Sep 9 12:15:31 MST 2006
Author: pcadach
Date: Sat Sep 9 14:15:31 2006
New Revision: 42584
URL: http://svn.digium.com/view/asterisk?rev=3D42584&view=3Drev
Log:
Yay! Gatekeeper re-registration segfault fixed!!! That's very nice!
1) H323TransportUDP cloned to be sure GatekeeperDiscovery() is called from a
thread owned by OpenH323 (otherwise it causes fault because
PThread::Current() returns NULL and nobody, including PSocket::Select()
checks it - FIX PWLIB!!!);
2) "h.323 gk cycle" CLI command restored, because it works well;
3) Updated documentation to reflect OpenH323/PWLib versions used for
development and testing. Probably other versions (IMHO OpenH323 1.17.3+
and PWLib 1.9.2+) will work fine too, but this is not verified.
Modified:
team/pcadach/chan_h323-live/channels/chan_h323.c
team/pcadach/chan_h323-live/channels/h323/README
team/pcadach/chan_h323-live/channels/h323/TODO
team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp
team/pcadach/chan_h323-live/channels/h323/compat_h323.cpp
team/pcadach/chan_h323-live/channels/h323/compat_h323.h
Modified: team/pcadach/chan_h323-live/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channe=
ls/chan_h323.c?rev=3D42584&r1=3D42583&r2=3D42584&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- team/pcadach/chan_h323-live/channels/chan_h323.c (original)
+++ team/pcadach/chan_h323-live/channels/chan_h323.c Sat Sep 9 14:15:31 20=
06
@@ -2421,7 +2421,6 @@
=
static int h323_gk_cycle(int fd, int argc, char *argv[])
{
-#if 0
if (argc !=3D 3) {
return RESULT_SHOWUSAGE;
} =
@@ -2433,7 +2432,6 @@
ast_log(LOG_ERROR, "Gatekeeper registration failed.\n");
}
}
-#endif
return RESULT_SUCCESS;
}
=
Modified: team/pcadach/chan_h323-live/channels/h323/README
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channe=
ls/h323/README?rev=3D42584&r1=3D42583&r2=3D42584&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- team/pcadach/chan_h323-live/channels/h323/README (original)
+++ team/pcadach/chan_h323-live/channels/h323/README Sat Sep 9 14:15:31 20=
06
@@ -9,8 +9,8 @@
expat-1.95+
expat-dev-1.95+
=
-Tested with Open H.323 version v1.17.1, PWLib v1.9.0 and GCC v3.2.2. Usage=
of any
-other versions is not supported. =
+Tested with Open H.323 version v1.18.0, PWLib v1.10.0 and GCC v3.2.2. Usag=
e of any
+other (especially prior) versions is not tested/supported.
=
NOTICE: Whatever you do, DO NOT USE distrubution specific installs
of Open H.323 and PWLib. In fact, you should check to make sure =
Modified: team/pcadach/chan_h323-live/channels/h323/TODO
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channe=
ls/h323/TODO?rev=3D42584&r1=3D42583&r2=3D42584&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- team/pcadach/chan_h323-live/channels/h323/TODO (original)
+++ team/pcadach/chan_h323-live/channels/h323/TODO Sat Sep 9 14:15:31 2006
@@ -1,8 +1,6 @@
The NuFone Network's Open H.323 Channel Driver for Asterisk =
=
TODO:
-
- - Fix Gatekeeper re-registration seg (HELP)
=
- Track down why calls to invalid extensions always
get sent to 's' in context 'default'
Modified: team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channe=
ls/h323/ast_h323.cpp?rev=3D42584&r1=3D42583&r2=3D42584&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp (original)
+++ team/pcadach/chan_h323-live/channels/h323/ast_h323.cpp Sat Sep 9 14:15=
:31 2006
@@ -1605,14 +1605,14 @@
}
if (gatekeeper_discover) {
/* discover the gk using multicast */
- if (endPoint->DiscoverGatekeeper(new H323TransportUDP(*endPoint))) {
+ if (endPoint->DiscoverGatekeeper(new MyH323TransportUDP(*endPoint))) {
cout << "=3D=3D Using " << (endPoint->GetGatekeeper())->GetName() << " =
as our Gatekeeper." << endl;
} else {
cout << "Warning: Could not find a gatekeeper." << endl;
return 1;
} =
} else {
- rasChannel =3D new H323TransportUDP(*endPoint);
+ rasChannel =3D new MyH323TransportUDP(*endPoint);
=
if (!rasChannel) {
cout << "Error: No RAS Channel, this is bad" << endl;
Modified: team/pcadach/chan_h323-live/channels/h323/compat_h323.cpp
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channe=
ls/h323/compat_h323.cpp?rev=3D42584&r1=3D42583&r2=3D42584&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- team/pcadach/chan_h323-live/channels/h323/compat_h323.cpp (original)
+++ team/pcadach/chan_h323-live/channels/h323/compat_h323.cpp Sat Sep 9 14=
:15:31 2006
@@ -30,6 +30,7 @@
*/
#include <ptlib.h>
#include <h323.h>
+#include <transports.h>
=
#include "ast_h323.h"
=
@@ -89,3 +90,49 @@
return OnOpen();
}
#endif
+
+BOOL MyH323TransportUDP::DiscoverGatekeeper(H323Gatekeeper &gk, H323RasPDU=
&pdu, const H323TransportAddress &address)
+{
+ PThread *thd =3D PThread::Current();
+
+ /* If we run in OpenH323's thread use it instead of creating new one */
+ if (thd)
+ return H323TransportUDP::DiscoverGatekeeper(gk, pdu, address);
+
+ /* Make copy of arguments to pass them into thread */
+ discoverGatekeeper =3D &gk;
+ discoverPDU =3D &pdu;
+ discoverAddress =3D &address;
+
+ /* Assume discovery thread isn't finished */
+ discoverReady =3D FALSE;
+
+ /* Create discovery thread */
+ thd =3D PThread::Create(PCREATE_NOTIFIER(DiscoverMain), 0,
+ PThread::NoAutoDeleteThread,
+ PThread::NormalPriority,
+ "GkDiscovery:%x");
+
+ /* Wait until discovery thread signal us its finished */ =
+ for(;;) {
+ discoverMutex.Wait();
+ if (discoverReady) /* Thread has been finished */
+ break;
+ discoverMutex.Signal();
+ }
+ discoverMutex.Signal();
+
+ /* Cleanup/delete thread */
+ thd->WaitForTermination();
+ delete thd;
+ =
+ return discoverResult;
+}
+
+void MyH323TransportUDP::DiscoverMain(PThread &thread, INT arg)
+{
+ PWaitAndSignal m(discoverMutex);
+
+ discoverResult =3D H323TransportUDP::DiscoverGatekeeper(*discoverGatekeep=
er, *discoverPDU, *discoverAddress);
+ discoverReady =3D TRUE;
+}
Modified: team/pcadach/chan_h323-live/channels/h323/compat_h323.h
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channe=
ls/h323/compat_h323.h?rev=3D42584&r1=3D42583&r2=3D42584&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- team/pcadach/chan_h323-live/channels/h323/compat_h323.h (original)
+++ team/pcadach/chan_h323-live/channels/h323/compat_h323.h Sat Sep 9 14:1=
5:31 2006
@@ -23,6 +23,30 @@
#else
#define MyH323TransportTCP H323TransportTCP
#endif /* <VERSION(1,17,3) */
+
+class MyH323TransportUDP: public H323TransportUDP
+{
+ PCLASSINFO(MyH323TransportUDP, H323TransportUDP);
+
+public:
+ MyH323TransportUDP(H323EndPoint &endpoint,
+ PIPSocket::Address binding =3D PIPSocket::GetDefaultIpAny(),
+ WORD localPort =3D 0,
+ WORD remotePort =3D 0): H323TransportUDP(endpoint, binding, localPort, r=
emotePort)
+ {
+ }
+ virtual BOOL DiscoverGatekeeper(H323Gatekeeper &,
+ H323RasPDU &,
+ const H323TransportAddress &);
+protected:
+ PDECLARE_NOTIFIER(PThread, MyH323TransportUDP, DiscoverMain);
+ H323Gatekeeper *discoverGatekeeper;
+ H323RasPDU *discoverPDU;
+ const H323TransportAddress *discoverAddress;
+ BOOL discoverResult;
+ BOOL discoverReady;
+ PMutex discoverMutex;
+};
=
template <class _Abstract_T, typename _Key_T =3D PString>
class MyPFactory: public PFactory<_Abstract_T, _Key_T>
More information about the asterisk-commits
mailing list