summaryrefslogtreecommitdiff
path: root/misc/mon_ami/helper.py
blob: bf286de7aa81119765d481705785e67e3152d51e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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