diff options
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 |