Beispiel #1
0
    def test_sim(self):
        d = Dial()
        d.sim('123123123')

        r = VoiceResponse()
        r.append(d)

        assert_equal(
            self.strip(r),
            '<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Sim>123123123</Sim></Dial></Response>'
        )
Beispiel #2
0
 def make_dialout_response(self,
                           *,
                           sim: str = None,
                           to: str = None,
                           from_: str = None) -> TwiML:
     """Dial a number."""
     response = VoiceResponse()
     if from_:
         dial = Dial(caller_id=f'+{from_}')
     else:
         dial = Dial()
     if sim:
         dial.sim(sim)
     elif to:
         dial.number(to)
     else:
         raise Exception("dialout response did not get anything to dial")
     response.append(dial)
     return str(response)
Beispiel #3
0
from twilio.twiml.voice_response import Dial, VoiceResponse, Sim

response = VoiceResponse()
dial = Dial(record='record-from-ringing')
dial.sim('DE8caa2afb9d5279926619c458dc7098a8')
response.append(dial)

print(response)