I'm attempting to use CallResource.Update() in C# to provide dynamic twiml instructions to a call in progress. I'd rather use CallResource.Create(), but it only accepts a twiml url.
I've not been able to find any documentation or examples on how to do this, and the only documentation I can find that even hints at this capability is in the API reference for the Call resource Update method here: https://www.twilio.com/docs/voice/api/call#update-a-call-resource
Where it states: TwiML instructions for the call Twilio will use without fetching Twiml from url. Twiml and url parameters are mutually exclusive
Essentially what I want to accomplish is the appointment reminder tutorial but with outbound voice calls as opposed to sms messages.
I need the call to say "Hello {Name}, This is {Company}. We have you scheduled for a {Typeof} appointment on {date} at {time}, if you need to reschedule, please call {Number}" All of the above data is in our database.
I've tried a mish-mash of syntax trying to hopefully luck into the correct way of doing this, but haven't yet managed to find a solution outside of twimlets.
I'd rather not have to stage a public webserver or setup free hosting to do this even though it wouldn't contain any propretary info or PII, it's beyond the scope of my knowledge and time-frame to develop this solution.
I can do this via SMS all day long with twilio so I'm developing a decent knowledge and appreciation for the API, but we have clients that arent sms friendly and require voice calls so I need a solution for them.
var from = new PhoneNumber("Insert Valid Twilio nyumber");
var call = CallResource.Create(to,from, url:new uri("http://demo.twilio.com/docs/voice.xml"));
CallResource.update(
method: twilio.http.httpmethod.post,
url: new uri("http://twimlets.com/message?Message%5B0%5D=Testing&")
pathSid: call.Sid);
In testing this, I'm expecting the message to play the demo, and then switch to say the word testing (which I would later like to implement dynamic twiml instead of using twimlets).
What is actually happening though is that I get an exception stating that the call is not in progress when it gets to the call update statement.
So two problems, one, how do I update the call to the new twiml url, and then how do I substitute the url for twiml instructions like the API documentation states that I can.
Any help would be greatly appreciated.