From 0f57960740dc4fe7925f324d87a36f602040c060 Mon Sep 17 00:00:00 2001 From: DarkS Date: Tue, 3 May 2016 18:06:59 +0200 Subject: [PATCH] Make that channel variables will be stored in a dictionary --- asterisk/manager.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/asterisk/manager.py b/asterisk/manager.py index 2f84f68..46a4c5b 100644 --- a/asterisk/manager.py +++ b/asterisk/manager.py @@ -108,7 +108,15 @@ class ManagerMsg(object): break try: k, v = (x.strip() for x in line.split(':', 1)) - self.headers[k] = v + # if header is ChanVariable it can have more that one value + # we store the variable in a dictionary parsed + if 'ChanVariable' in k: + if not self.headers.has_key('ChanVariable'): + self.headers['ChanVariable']={} + name, value = (x.strip() for x in v.split('=',1)) + self.headers['ChanVariable'][name]=value + else: + self.headers[k] = v except ValueError: # invalid header, start of multi-line data response data.extend(response[n:])