Twilio TwilioRestClient SendSmsMessage returns null

I have everything that works locally, but when I test Twilio on an Amazon EC2 Debian 6.0.6 server running Mono 2.10.9, I find that sending SMS messages no longer works. I believe the problem lies somewhere in the server configuration, as I use the latest Twilio (3.5.6), RestSharp (104.1) and JSON.NET (4.5.11) libraries, and I can guarantee that the variables used in the following method call is not running at run time.

var client = new Twilio.TwilioRestClient("{my account number}", "{my account token}");
var smsMessage = client.SendSmsMessage("{my account phone number}", "{my mobile phone number}", "Hello World!");

Using ntop, I saw that there are bytes that send / receive / form this reqeuest, but the result of smsMessage is still zero. The SendSMSMessage function uses the RestSharp library, in particular, the Execute RestClient function, which calls the Deserialize method and returns an IRestResponse, in which the Data field is null in this case.

I saw some evidence on the Internet that the problem might be with the deserialization process, but since I guaranteed that I was using the latest version of JSON.NET, I'm not sure what else needs to be done here.

Do you have any suggestions for solving the problem, and you suspect that this is a problem with the code or server? Also do you have any tips using Debian, how can I debug this interaction, perhaps even to get a complete byte response from outside from within the application?

+5
source share
1 answer

When debugging the RestSharp library, I found that this exception was due to SSL and Mono certificates. The exception message I received looks like this:

Error getting response stream (Write: The authentication or decryption has failed.): SendFailure

Following the instructions in the link below, I helped solve the problem, especially doing the following and restarting mono.

certmgr -ssl https://api.twilio.com

http://www.mono-project.com/FAQ:_Security

+3
source

All Articles