diff --git a/tests/unit/twiml/test_voice_response.py b/tests/unit/twiml/test_voice_response.py
index 0ebd27ae25..ea80f4dda7 100644
--- a/tests/unit/twiml/test_voice_response.py
+++ b/tests/unit/twiml/test_voice_response.py
@@ -2,7 +2,7 @@
from nose.tools import assert_equal
from six import u
from tests.unit.twiml import TwilioTest
-from twilio.twiml.voice_response import VoiceResponse, Dial, Gather
+from twilio.twiml.voice_response import VoiceResponse, Dial, Enqueue, Gather
class TestResponse(TwilioTest):
@@ -349,6 +349,18 @@ def test_queue(self):
)
+class TestEcho(TwilioTest):
+
+ def test_echo(self):
+ r = VoiceResponse()
+ r.echo()
+
+ assert_equal(
+ self.strip(r),
+ ''
+ )
+
+
class TestEnqueue(TwilioTest):
def test_enqueue(self):
@@ -366,6 +378,30 @@ def test_enqueue(self):
'TestEnqueueAttribute'
)
+ def test_task_string(self):
+ e = Enqueue(None, workflowSid='123123123')
+ e.task('{"account_sid": "AC123123123"}')
+
+ r = VoiceResponse()
+ r.append(e)
+
+ assert_equal(
+ self.strip(r),
+ '{"account_sid": "AC123123123"}'
+ )
+
+ def test_task_dict(self):
+ e = Enqueue(None, workflowSid='123123123')
+ e.task({"account_sid": "AC123123123"})
+
+ r = VoiceResponse()
+ r.append(e)
+
+ assert_equal(
+ self.strip(r),
+ '{"account_sid": "AC123123123"}'
+ )
+
class TestDial(TwilioTest):
@@ -379,6 +415,18 @@ def test_dial(self):
'1231231234'
)
+ def test_sim(self):
+ d = Dial()
+ d.sim('123123123')
+
+ r = VoiceResponse()
+ r.append(d)
+
+ assert_equal(
+ self.strip(r),
+ '123123123'
+ )
+
def test_sip(self):
""" should redirect the call """
d = Dial()
diff --git a/twilio/twiml/voice_response.py b/twilio/twiml/voice_response.py
index 363920fe1f..41718e96ea 100644
--- a/twilio/twiml/voice_response.py
+++ b/twilio/twiml/voice_response.py
@@ -1,3 +1,5 @@
+import json
+
from twilio.twiml import TwiML
@@ -57,6 +59,15 @@ def dial(self,
**kwargs
))
+ def echo(self,
+ **kwargs):
+ """
+ Add a new element
+ """
+ return self.append(Echo(
+ **kwargs
+ ))
+
def enqueue(self,
name,
action=None,
@@ -444,6 +455,19 @@ def queue(self,
**kwargs
))
+ def sim(self,
+ sid,
+ **kwargs):
+ """
+ Add a element
+
+ :param sid: sim sid
+ """
+ return self.append(Sim(
+ sid,
+ **kwargs
+ ))
+
def sip(self,
uri,
username=None,
@@ -541,6 +565,20 @@ def __init__(self, queue_name, **kwargs):
self.value = queue_name
+class Sim(TwiML):
+ """
+ element
+ """
+ def __init__(self, sid, **kwargs):
+ """
+ Create a new element
+
+ :param sid: sim sid
+ """
+ super(Sim, self).__init__(**kwargs)
+ self.value = sid
+
+
class Sip(TwiML):
"""
element
@@ -556,6 +594,17 @@ def __init__(self, uri, **kwargs):
self.value = uri
+class Echo(TwiML):
+ """
+ element
+ """
+ def __init__(self, **kwargs):
+ """
+ Create a new element
+ """
+ super(Echo, self).__init__(**kwargs)
+
+
class Enqueue(TwiML):
"""
element
@@ -570,6 +619,32 @@ def __init__(self, name, **kwargs):
super(Enqueue, self).__init__(**kwargs)
self.value = name
+ def task(self, attributes, **kwargs):
+ """
+ Add a element
+
+ :param attributes: Attributes for a task
+ :return: element
+ """
+ return self.append(Task(attributes, **kwargs))
+
+
+class Task(TwiML):
+ """
+ element
+ """
+ def __init__(self, attributes, **kwargs):
+ """
+ Create a new element
+
+ :param attributes: Attributes for a task
+ """
+ super(Task, self).__init__(**kwargs)
+ if isinstance(attributes, basestring):
+ self.value = attributes
+ else:
+ self.value = json.dumps(attributes)
+
class Gather(TwiML):
"""