Skip to content
Snippets Groups Projects
Commit e501754a authored by Alexander Cherniuk's avatar Alexander Cherniuk
Browse files

Improved sending a DTMF batch

parent 62275846
No related branches found
No related tags found
No related merge requests found
......@@ -121,16 +121,17 @@ class JingleRTPContent(JingleContent):
Send several DTMF tones
"""
if self._dtmf_running:
raise Exception # TODO: Proper exception
raise Exception("There is a DTMF batch already running")
events = list(events)
self._dtmf_running = True
self._start_dtmf(events[-1])
gobject.timeout_add(500, self._next_dtmf, events[:-1])
self._start_dtmf(events.pop(0))
gobject.timeout_add(500, self._next_dtmf, events)
def _next_dtmf(self, events):
self._stop_dtmf()
if events:
self._start_dtmf(events[-1])
gobject.timeout_add(500, self._next_dtmf, events[:-1])
self._start_dtmf(events.pop(0))
gobject.timeout_add(500, self._next_dtmf, events)
else:
self._dtmf_running = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment