-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.py
60 lines (47 loc) · 2.05 KB
/
constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import syslog
import configparser
API_ROOT = os.path.dirname(os.path.realpath(__file__)) + "/"
URL_ROOT = "/mmsgw/v1/"
USER_AGENT = URL_ROOT[1:]
ENABLE_TESTS = True
REPO_SPLIT_PREFIX = 2
LOG_IDENT = "mmsgw"
LOG_FACILITY = syslog.LOG_LOCAL4
ACCEPTED_MESSAGE_PRIORITIES = ("low", "normal", "high")
ACCEPTED_MESSAGE_CLASSES = ("personal", "advertisement", "informational", "auto")
ACCEPTED_CONTENT_CLASSES = ("text", "image-basic", "image-rich", "video-basic", "video-rich", "megapixel", "content-basic", "content-rich")
ACCEPTED_CHARGED_PARTY = ( "sender", "recipient", "both", "neither" )
ACCEPTED_CONTENT_TYPES = {
'application/smil': ".smil",
'text/plain': ".txt", 'text/html': ".html",
'image/bmp': ".bmp", 'image/gif': ".gif", 'image/jpeg': ".jpg", 'image/jpg': ".jpg", 'image/tiff': ".tif", 'image/png': ".png",
'audio/basic': ".au", 'audio/mid': ".mid", 'audio/mpeg': ".mpg", 'audio/mp4': ".mp4", 'audio/wav': ".wav",
}
MM7_VERSION = {
'mm7': "6.8.0",
'xmlns_suffix': "REL-6-MM7-1-4",
}
MM7_NAMESPACE = {
'env': "http://schemas.xmlsoap.org/soap/envelope/",
'mm7': "http://www.3gpp.org/ftp/Specs/archive/23_series/23.140/schema/" + MM7_VERSION['xmlns_suffix'],
}
MM7_ROOT_NS = "soapenv"
CFG_ROOT = "/etc/mmsgw/"
cfg = configparser.ConfigParser()
cfg.read(CFG_ROOT + "mmsgw.conf")
API_URL = cfg['general']['api_url']
API_DEV_PORT = int(cfg['general'].get('api_dev_port', 8080))
TMP_MMS_DIR = cfg['general'].get("tmp_dir", "/tmp/mms/")
if not TMP_MMS_DIR.endswith("/"):
TMP_MMS_DIR += "/"
if not os.path.isdir(TMP_MMS_DIR):
os.mkdir(TMP_MMS_DIR)
MMS_TTL = int(cfg['general'].get('mms_ttl', 4 * 3600))
MMS_TEMPLATE_TTL = int(cfg['general'].get('mms_template_ttl', 24 * 3600))
DEFAULT_GATEWAY = cfg['general'].get('default_gateway', "provider")
GW_HEARTBEAT_TIMER = int(cfg['general'].get('gateway_heartbeat_interval', 30))
GW_HEARTBEATS = int(cfg['general'].get('gateway_max_missed_heartbeats', 10))
MAX_GW_RETRIES = int(cfg['general'].get('max_gateway_retries', 5))
STORAGE_CONN = cfg['message_storage']
QUEUE_CONN = cfg['queue_storage']