diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
commit | b80bd744ad873f6fc43018bc4bfb90677de167bd (patch) | |
tree | 072c4b0e33d442528555b82c415f5e7a1712b2b0 /misc/mon_ami/helper.py | |
parent | 3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff) |
Start of GS5.
Diffstat (limited to 'misc/mon_ami/helper.py')
-rw-r--r-- | misc/mon_ami/helper.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/misc/mon_ami/helper.py b/misc/mon_ami/helper.py new file mode 100644 index 0000000..bf286de --- /dev/null +++ b/misc/mon_ami/helper.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# MonAMI Asterisk Manger Interface server +# helper functions +# (c) AMOOMA GmbH 2012 + + +def to_hash(message): + message_hash = {} + for line in message: + keyword, delimeter, value = line.partition(": ") + if (keyword): + message_hash[keyword] = value.strip() + + return message_hash + + +def sval(array, key): + try: + return array[key] + except: + return None |