From 080bb6d627cb6753c9dff5225003d260a73a954e Mon Sep 17 00:00:00 2001 From: poing Date: Tue, 6 Sep 2016 18:47:21 +0900 Subject: [PATCH] Updated 'RECORD FILE' syntax, included silence detection value --- asterisk/agi.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/asterisk/agi.py b/asterisk/agi.py index 9e8ce41..3328140 100755 --- a/asterisk/agi.py +++ b/asterisk/agi.py @@ -493,17 +493,20 @@ class AGI: self.set_extension(extension) self.set_priority(priority) - def record_file(self, filename, format='gsm', escape_digits='#', timeout=DEFAULT_RECORD, offset=0, beep='beep'): - """agi.record_file(filename, format, escape_digits, timeout=DEFAULT_TIMEOUT, offset=0, beep='beep') --> None - Record to a file until a given dtmf digit in the sequence is received - The format will specify what kind of file will be recorded. The timeout - is the maximum record time in milliseconds, or -1 for no timeout. Offset - samples is optional, and if provided will seek to the offset without - exceeding the end of the file + def record_file(self, filename, format='gsm', escape_digits='#', timeout=DEFAULT_RECORD, offset=0, beep='beep', silence=0): + """agi.record_file(filename, format, escape_digits, timeout=DEFAULT_TIMEOUT, offset=0, beep='beep', silence=0) --> None + Record to a file until a given dtmf digit in the sequence is received. Returns + '-1' on hangup or error. The format will specify what kind of file will be + recorded. The is the maximum record time in milliseconds, or '-1' + for no . is optional, and, if provided, will seek + to the offset without exceeding the end of the file. is the number + of seconds of silence allowed before the function returns despite the lack + of dtmf digits or reaching . value must be preceded by + 's=' and is also optional. """ escape_digits = self._process_digit_list(escape_digits) res = self.execute('RECORD FILE', self._quote(filename), format, - escape_digits, timeout, offset, beep)['result'][0] + escape_digits, timeout, offset, beep, ('s=%s' % silence))['result'][0] try: return chr(int(res)) except: