mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 16:21:01 +00:00
Fix it so we can be unloaded/loaded at will
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2003 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1270,7 +1270,7 @@ static int restart_monitor(void)
|
|||||||
ast_log(LOG_WARNING, "Cannot kill myself\n");
|
ast_log(LOG_WARNING, "Cannot kill myself\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (monitor_thread) {
|
if (monitor_thread && (monitor_thread != -2)) {
|
||||||
/* Wake up the thread */
|
/* Wake up the thread */
|
||||||
pthread_kill(monitor_thread, SIGURG);
|
pthread_kill(monitor_thread, SIGURG);
|
||||||
} else {
|
} else {
|
||||||
@@ -1786,11 +1786,12 @@ int load_module()
|
|||||||
|
|
||||||
/* Register our callback functions */
|
/* Register our callback functions */
|
||||||
h323_callback_register(setup_incoming_call,
|
h323_callback_register(setup_incoming_call,
|
||||||
setup_outgoing_call,
|
setup_outgoing_call,
|
||||||
create_connection,
|
create_connection,
|
||||||
setup_rtp_connection,
|
setup_rtp_connection,
|
||||||
cleanup_connection,
|
cleanup_connection,
|
||||||
connection_made, send_digit);
|
connection_made,
|
||||||
|
send_digit);
|
||||||
|
|
||||||
|
|
||||||
/* start the h.323 listener */
|
/* start the h.323 listener */
|
||||||
@@ -1833,6 +1834,19 @@ int unload_module()
|
|||||||
ast_log(LOG_WARNING, "Unable to lock the interface list\n");
|
ast_log(LOG_WARNING, "Unable to lock the interface list\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ast_mutex_lock(&monlock)) {
|
||||||
|
if (monitor_thread && (monitor_thread != -2)) {
|
||||||
|
pthread_cancel(monitor_thread);
|
||||||
|
pthread_kill(monitor_thread, SIGURG);
|
||||||
|
pthread_join(monitor_thread, NULL);
|
||||||
|
}
|
||||||
|
monitor_thread = (pthread_t) -2;
|
||||||
|
ast_mutex_unlock(&monlock);
|
||||||
|
} else {
|
||||||
|
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ast_mutex_lock(&iflock)) {
|
if (!ast_mutex_lock(&iflock)) {
|
||||||
/* destroy all the interfaces and free their memory */
|
/* destroy all the interfaces and free their memory */
|
||||||
@@ -1856,13 +1870,15 @@ int unload_module()
|
|||||||
ast_rtp_proto_unregister(&oh323_rtp);
|
ast_rtp_proto_unregister(&oh323_rtp);
|
||||||
|
|
||||||
/* unregister commands */
|
/* unregister commands */
|
||||||
ast_cli_unregister(&cli_debug);
|
ast_cli_unregister(&cli_debug);
|
||||||
ast_cli_unregister(&cli_no_debug);
|
ast_cli_unregister(&cli_no_debug);
|
||||||
ast_cli_unregister(&cli_trace);
|
ast_cli_unregister(&cli_trace);
|
||||||
ast_cli_unregister(&cli_no_trace);
|
ast_cli_unregister(&cli_no_trace);
|
||||||
ast_cli_unregister(&cli_show_codecs);
|
ast_cli_unregister(&cli_show_codecs);
|
||||||
ast_cli_unregister(&cli_gk_cycle);
|
// ast_cli_unregister(&cli_gk_cycle);
|
||||||
|
ast_cli_unregister(&cli_hangup_call);
|
||||||
|
ast_cli_unregister(&cli_show_tokens);
|
||||||
|
|
||||||
/* unregister channel type */
|
/* unregister channel type */
|
||||||
ast_channel_unregister(type);
|
ast_channel_unregister(type);
|
||||||
|
|
||||||
|
@@ -25,8 +25,10 @@
|
|||||||
*
|
*
|
||||||
* Version Info: $Id$
|
* Version Info: $Id$
|
||||||
*/
|
*/
|
||||||
|
#include <asterisk/logger.h>
|
||||||
#include "ast_h323.h"
|
#include "ast_h323.h"
|
||||||
|
|
||||||
|
|
||||||
/* PWlib Required Components */
|
/* PWlib Required Components */
|
||||||
#define MAJOR_VERSION 1
|
#define MAJOR_VERSION 1
|
||||||
#define MINOR_VERSION 0
|
#define MINOR_VERSION 0
|
||||||
@@ -63,7 +65,7 @@ MyProcess::MyProcess(): PProcess("The NuFone Network's", "H.323 Channel Driver f
|
|||||||
|
|
||||||
void MyProcess::Main()
|
void MyProcess::Main()
|
||||||
{
|
{
|
||||||
cout << " == Creating H.323 Endpoint" << endl;
|
ast_verbose(" == Creating H.323 Endpoint\n");
|
||||||
endPoint = new MyH323EndPoint();
|
endPoint = new MyH323EndPoint();
|
||||||
PTrace::Initialise(0, NULL, PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine);
|
PTrace::Initialise(0, NULL, PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine);
|
||||||
}
|
}
|
||||||
@@ -492,7 +494,7 @@ BOOL MyH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (h323debug) {
|
if (h323debug) {
|
||||||
cout << " -- Received SETUP message..." << endl;
|
ast_verbose(" -- Received SETUP message\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
call_details_t cd;
|
call_details_t cd;
|
||||||
@@ -948,6 +950,7 @@ int h323_set_gk(int gatekeeper_discover, char *gatekeeper, char *secret)
|
|||||||
{
|
{
|
||||||
PString gkName = PString(gatekeeper);
|
PString gkName = PString(gatekeeper);
|
||||||
PString pass = PString(secret);
|
PString pass = PString(secret);
|
||||||
|
H323TransportUDP *rasChannel;
|
||||||
|
|
||||||
if (!h323_end_point_exist()) {
|
if (!h323_end_point_exist()) {
|
||||||
cout << "ERROR: [h323_set_gk] No Endpoint, this is bad!" << endl;
|
cout << "ERROR: [h323_set_gk] No Endpoint, this is bad!" << endl;
|
||||||
@@ -972,17 +975,13 @@ int h323_set_gk(int gatekeeper_discover, char *gatekeeper, char *secret)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Gatekeeper operations */
|
rasChannel = new H323TransportUDP(*endPoint);
|
||||||
if (endPoint->rasChannel) {
|
|
||||||
delete endPoint->rasChannel;
|
|
||||||
}
|
|
||||||
endPoint->rasChannel = new H323TransportUDP(*endPoint);
|
|
||||||
|
|
||||||
if (!endPoint->rasChannel) {
|
if (!rasChannel) {
|
||||||
cout << " *** No RAS Channel, this is bad" << endl;
|
cout << " *** No RAS Channel, this is bad" << endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (endPoint->SetGatekeeper(gkName, endPoint->rasChannel)) {
|
if (endPoint->SetGatekeeper(gkName, rasChannel)) {
|
||||||
cout << " == Using " << (endPoint->GetGatekeeper())->GetName() << " as our Gatekeeper." << endl;
|
cout << " == Using " << (endPoint->GetGatekeeper())->GetName() << " as our Gatekeeper." << endl;
|
||||||
} else {
|
} else {
|
||||||
cout << " *** Error registering with gatekeeper \"" << gkName << "\". " << endl;
|
cout << " *** Error registering with gatekeeper \"" << gkName << "\". " << endl;
|
||||||
|
@@ -215,9 +215,6 @@ class MyH323EndPoint : public H323EndPoint {
|
|||||||
|
|
||||||
void SetEndpointTypeInfo( H225_EndpointType & info ) const;
|
void SetEndpointTypeInfo( H225_EndpointType & info ) const;
|
||||||
void SetGateway(void);
|
void SetGateway(void);
|
||||||
|
|
||||||
H323TransportUDP *rasChannel;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MyH323Connection : public H323Connection {
|
class MyH323Connection : public H323Connection {
|
||||||
|
Reference in New Issue
Block a user