Search code examples
c#twiliotwilio-apitwilio-twiml

Twilio CallResource.Create Does Not Compile When Specifying A Twiml Parameter - C#


Trying to follow the Call Resource API & code examples listed here.

The code example given to make an outbound call is specifying twiml in the request -

var call = CallResource.Create(
    twiml: new Twilio.Types.Twiml("<Response><Say>Ahoy there!</Say></Response>"),
    to: new Twilio.Types.PhoneNumber("+15558675310"),
    from: new Twilio.Types.PhoneNumber("+15552223214")
);

When I try this, Visual Studio gives an error and doesn't allow me to compile -

The best overload for 'Create' does not contain a parameter named 'twiml'

Am I missing something, or is the API documentation wrong / outdated?


Solution

  • The twiml optional parameter was introduced in version 5.36.0. According to git source history, it should also be in 5.78.0, so not sure why it was missing for you. Maybe it was using an even older version for some reason. Either way, upgrading to the latest version the the Twilio library should solve the problem.