X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=main.c;h=9bf22e86b8593e3e371fe02d2d62e6129208390a;hp=12e43b86526a833cb8edfe43ac5ce066ca318b9b;hb=7dc10dcae129d2ef7f40a455aba45179eb68d1d8;hpb=2ed0fee489c37a6e2d4473f6185ebbe3e746ac11 diff --git a/main.c b/main.c index 12e43b8..9bf22e8 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,6 @@ /*****************************************************************************\ ** ** -** PBX4Linux ** +** Linux Call Router ** ** ** **---------------------------------------------------------------------------** ** Copyright: Andreas Eversberg ** @@ -49,39 +49,6 @@ pthread_mutex_t mutexd; // debug output mutex pthread_mutex_t mutexl; // log output mutex pthread_mutex_t mutexe; // error output mutex -#ifdef H323 -PMutex mutex_h323; // mutual exclude threads when using OpenH323 -#endif - -#ifdef VOIP -class PBXMain : public PProcess -{ - PCLASSINFO(PBXMain, PProcess) - public: - PBXMain(void); - ~PBXMain(void); - void Main(); -}; - -PCREATE_PROCESS(PBXMain) - -PBXMain::PBXMain(void) : PProcess("Jolly", "LinuxPBX", 0, 1, AlphaCode, 1) -{ -} - -PBXMain::~PBXMain(void) -{ -} -#endif - -#ifdef H323 -H323_ep *h323_ep = NULL; -#endif -#ifdef OPAL -OpalManager *opal_mgr = NULL; -#endif - - int memuse = 0; int mmemuse = 0; int cmemuse = 0; @@ -138,6 +105,7 @@ static void debug(const char *function, int line, char *prefix, char *buffer) debug_newline = 1; } +muss ins trace void printlog(const char *fmt, ...) { char buffer[4096]; @@ -277,15 +245,7 @@ int main(int argc, char *argv[]) GET_NOW(); /* show version */ -#ifdef OPAL - printf("\n** %s Version %s (with OPAL)\n\n", NAME, VERSION_STRING); -#else - #ifdef H323 - printf("\n** %s Version %s (with H323)\n\n", NAME, VERSION_STRING); - #else printf("\n** %s Version %s\n\n", NAME, VERSION_STRING); - #endif -#endif /* show options */ if (ARGC <= 1) @@ -305,13 +265,6 @@ int main(int argc, char *argv[]) goto free; } - /* check if we have a jitter limit that makes sense */ - if (ISDN_JITTERLIMIT < 256) - { - fprintf(stderr, "The ISDN_JITTERLIMIT must be at least 256 samples.\n"); - goto free; - } - /* init crc */ crc_init(); @@ -485,39 +438,6 @@ int main(int argc, char *argv[]) goto free; } -#ifdef OPAL - /* create OPAL manager */ - opal_mgr = new PBXManager; - if (!opal_mgr) - { - fprintf(stderr, "Unable to create OPAL manager.\n"); - goto free; - } - if (opal_mgr->Initialise()) - { - todo thread kreieren... - opal_mgr->Main(); - } - -#endif - - -#ifdef H323 - // create h323 endpoint and initialize - h323_ep = new H323_ep(); - if (!h323_ep) - { - fprintf(stderr, "Unable to create h323 endpoint.\n"); - goto free; - } - if (h323_ep->Init() == FALSE) - { - fprintf(stderr, "Unable to init h323 endpoint.\n"); - goto free; - } - -#endif - /* read interfaces and open ports */ if (!read_interfaces()) { @@ -591,10 +511,6 @@ int main(int argc, char *argv[]) while(!quit) { /* all loops must be counted from the beginning since nodes might get freed during handler */ -#ifdef H323 - mutex_h323.Wait(); - debug_prefix = 0; -#endif all_idle = 1; /* handle mISDN messages from kernel */ @@ -801,12 +717,6 @@ BUDETECT GET_NOW(); #endif -#ifdef H323 - // NOTE: be carefull with this, don't do anything after unlocking except sleeping and locking! - debug_prefix = "h323"; - mutex_h323.Signal(); -#endif - /* did we do nothing? so we wait to give time to other processes */ if (all_idle) { @@ -822,7 +732,6 @@ free: /* set scheduler & priority - * we must remove realtimeshed, because h323 may lock during exit */ if (options.schedule > 1) { @@ -840,9 +749,6 @@ free: } /* destroy objects */ -#ifdef H323 - mutex_h323.Wait(); -#endif debug_prefix = "free"; while(port_first) @@ -880,37 +786,6 @@ free: PDEBUG(DEBUG_MSG, "freed %d pending messages\n", i); } -#ifdef H323 - mutex_h323.Signal(); -#endif - -#ifdef OPAL - /* destroy manager */ - if (opal_mgr) - { - todo kill an den main-thread von opal und warten... - if (options.deb & DEBUG_OPAL) - printf("->now deleting opal manager\n"); - delete opal_mgr; - if (options.deb & DEBUG_OPAL) - printf("->opal manager deleted\n"); - } - -#endif - -#ifdef H323 - /* destroy endpoint */ - if (h323_ep) - { - if (options.deb & DEBUG_H323) - printf("->now deleting endpoint\n"); - delete h323_ep; - if (options.deb & DEBUG_H323) - printf("->endpoint deleted\n"); - } - -#endif - /* free tones */ if (toneset_first) free_tones();