summaryrefslogtreecommitdiff
path: root/misc/mon_ami/helper.py
blob: 8e665a4db7364faac9d00fbd86eea9291746a50b (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-2013


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