Page MenuHomePhabricator

No OneTemporary

diff --git a/call-control b/call-control
index 406a8d1..bc33d4b 100755
--- a/call-control
+++ b/call-control
@@ -1,82 +1,82 @@
#!/usr/bin/env python
"""Call control engine for OpenSIPS"""
if __name__ == '__main__':
import callcontrol
import sys
from application import log
from application.process import process, ProcessError
from argparse import ArgumentParser
name = 'call-control'
fullname = 'SIP call-control engine'
description = 'Implementation of a call-control engine for SIP'
process.configuration.user_directory = None
process.configuration.subdirectory = 'callcontrol'
process.runtime.subdirectory = 'callcontrol'
parser = ArgumentParser(usage='%(prog)s [options]')
parser.add_argument('--version', action='version', version='%(prog)s {}'.format(callcontrol.__version__))
parser.add_argument('--systemd', action='store_true', help='run as a systemd simple service and log to journal')
parser.add_argument('--no-fork', action='store_false', dest='fork', help='run in the foreground and log to the terminal')
parser.add_argument('--config-dir', dest='config_directory', default=None, help='the configuration directory ({})'.format(process.configuration.system_directory), metavar='PATH')
parser.add_argument('--runtime-dir', dest='runtime_directory', default=None, help='the runtime directory ({})'.format(process.runtime.directory), metavar='PATH')
parser.add_argument('--debug', action='store_true', help='enable verbose logging')
parser.add_argument('--debug-memory', action='store_true', help='enable memory debugging')
options = parser.parse_args()
log.Formatter.prefix_format = '{record.levelname:<8s} '
if options.config_directory is not None:
process.configuration.local_directory = options.config_directory
if options.runtime_directory is not None:
process.runtime.directory = options.runtime_directory
try:
process.runtime.create_directory()
except ProcessError as e:
log.critical('Cannot start %s: %s', fullname, e)
sys.exit(1)
if options.systemd:
from systemd.journal import JournalHandler
log.set_handler(JournalHandler(SYSLOG_IDENTIFIER=name))
log.capture_output()
elif options.fork:
try:
process.daemonize(options.pid_file)
except ProcessError, e:
log.critical('Cannot start %s: %s', fullname, e)
sys.exit(1)
log.use_syslog(name)
log.info('Starting %s %s', fullname, callcontrol.__version__)
from callcontrol.controller import CallControlServer
if options.debug:
log.level.current = log.level.DEBUG
if options.debug_memory:
from application.debug.memory import memory_dump
try:
- cserver = CallControlServer()
+ server = CallControlServer()
except Exception, e:
log.critical('Could not create %s: %s', fullname, e)
if type(e) is not RuntimeError:
log.exception()
sys.exit(1)
try:
- cserver.run()
+ server.run()
except Exception, e:
log.critical('Could not run %s: %s', fullname, e)
if type(e) is not RuntimeError:
log.exception()
if options.debug_memory:
memory_dump()

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 6:27 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3408929
Default Alt Text
(3 KB)

Event Timeline