From 8bd83e2a362d4121a38afe083c918b8e15d0bfd2 Mon Sep 17 00:00:00 2001 From: Nick Date: Sun, 21 Jun 2020 18:43:43 +1000 Subject: [PATCH 1/3] Update esl.py Added new function (get_channel_variable) to get channel variable based on argument passed. --- greenswitch/esl.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/greenswitch/esl.py b/greenswitch/esl.py index 1e9cebd..a86770b 100644 --- a/greenswitch/esl.py +++ b/greenswitch/esl.py @@ -287,6 +287,10 @@ def call_uuid(self): @property def caller_id_number(self): return self.session_data.get('Caller-Caller-ID-Number') + + @property + def get_channel_variable(self, variable_name): + return self.session_data.get(str(variable_name)) def on_disconnect(self, event): if self._lingering: From 7de494d8cc9943e4c1afb5f1c17a9fba07b48ddc Mon Sep 17 00:00:00 2001 From: nickvsnetworking Date: Sun, 21 Jun 2020 18:59:16 +1000 Subject: [PATCH 2/3] Updated function to list channel variables --- greenswitch/esl.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/greenswitch/esl.py b/greenswitch/esl.py index a86770b..7f29dc0 100644 --- a/greenswitch/esl.py +++ b/greenswitch/esl.py @@ -288,10 +288,13 @@ def call_uuid(self): def caller_id_number(self): return self.session_data.get('Caller-Caller-ID-Number') - @property def get_channel_variable(self, variable_name): return self.session_data.get(str(variable_name)) + @property + def caller_destination_number(self): + return self.session_data.get('Caller-Destination-Number') + def on_disconnect(self, event): if self._lingering: logging.debug('Socket lingering..') From 170aa763d84dbbd920c45868c710b960d8e9bba9 Mon Sep 17 00:00:00 2001 From: nickvsnetworking Date: Sun, 21 Jun 2020 19:00:30 +1000 Subject: [PATCH 3/3] Updated README --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 4afc9f0..7d5a008 100644 --- a/README.rst +++ b/README.rst @@ -44,6 +44,7 @@ Basic functions are implemented already: - uuid_kill - answer - sleep + - return channel variable With current api, it's easy to mix sync and async actions, for example: play_and_get_digits method will return the pressed DTMF digits in a block mode,