Skip to content

Commit

Permalink
Add timer to pause
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Ballai committed Jan 24, 2009
1 parent 404233e commit d8c63e9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
8 changes: 7 additions & 1 deletion run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
TWILIO_SRC="/home/minddog/twilio-emulator/"
TWML_EMU="$TWILIO_SRC/twilio-emulator.py"

TESTS="multi_number.xml gather.xml"
TESTS="multi_number.xml gather.xml pause.xml"

echo "Running tests..."

if [ "$1x" != "x" ]; then
$TWML_EMU "file://$TWILIO_SRC/tests/$1";
exit
fi

for test in $TESTS; do
$TWML_EMU "file://$TWILIO_SRC/tests/$test";
done;
5 changes: 5 additions & 0 deletions tests/pause.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://example.com/simple_gather.xml -->
<Response>
<Pause length="20" />
</Response>
11 changes: 9 additions & 2 deletions twilio-emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def getResponse(url, method, digits):

return fd.read()

def end_pause():
print "[End Pause]"
return None

def input_timeout(*args):
print "[Gather timed out]"

Expand Down Expand Up @@ -127,10 +131,13 @@ def Play(node):

def Pause(node):
length = 1
if node.attributes.hasKey('length'):
length = nodes.attributes['length'].value
if node.hasAttributes() and \
node.attributes.has_key('length'):
length = node.attributes['length'].value

print "[Pause length=%s]" % length
t = Timer(float(length), end_pause)
t.start()
return None

def Dial(node):
Expand Down

0 comments on commit d8c63e9

Please sign in to comment.