Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Intraweb returning code 6 on Twilio xml requests (Priority support)
#1
I am using C++ Builder 10.2.3 with Intraweb 15.5.5
I am trying to make a Twilio automatic phone call using TwilioClient
Below is a summary of the code:

  TTwilioClient *Client;
  std::auto_ptr<TStringList> allParams(new TStringList);
  TTwilioClientResponse response;
  UnicodeString fromPhoneNumber, toPhoneNumber;


   allParams->Add("From=" + fromPhoneNumber);
   allParams->Add("To=" + toPhoneNumber);
   allParams->Add("Url=https://www.mywebsite/twilio.xml");


   response = Client->Post("Calls", allParams.get());

   twilio.xml is saved in wwwroot directory and it contains the text which is supposed to be spoken during the automatic call. Unfortunately this is how Twilio works for automatic outbound calls.

The call is performed on the destination number. But an error message is spoken by instead of the text in the xml file.
When I contacted Twilio support, this is what they responded (see attached PDF file).

The application is returning code 6 instead of text/xml or application/xml. I have an Apache server where the xml file is stored. But the Intraweb application I am running is not behind an Apache server!
And code 6 does not correspond to any Apache server response.
So, I think it is Intraweb application which is sending the wrong response.

When I check in IWMimeTypes.hpp, I see this:
enum DECLSPEC_DENUM TMimeType : unsigned char { mtUnknown, mtBinary, mtJPG, mtGIF, mtPNG, mtRSS, mtXML, mtTXT, mtICO, mtHTML, mtJavaScript, mtPDF, mtZIP, mtCSS, mtMP3, mtOGG, mtWAV, mtEXE, mtFlash, mtWMV, mtMOV, mtAVI, mtMPEG, mtXSL, mtGZIP, mtWOFF, mtTTF, mtOTF, mtSVG, mtJSON, mtDOCX, mtXLSX, mtPPTX, mtMP4 };

Code 6 corresponds to mtXML in the enum declaration.
So, is it Intraweb which is sending the wrong response as it seems?


Attached Files
.pdf   TwilioResponse.pdf (Size: 282.76 KB / Downloads: 6)
Reply
#2
What is the request that comes to the IW application?
Reply
#3
The request is the response Url:
https://www.mywebsite/twilio.xml
But this time coming from the server as a response

It took me some time because I was investigating the logs with Twilio support team.
I finally found the problem.
As I was explaining, I am testing the Twilio automatic call building an Intraweb application on my laptop.
But the xml file automatically spoken by Twilio call is hosted on a web server were Apache is installed. This is because Twilio requires a web link which cannot be local!
And it happens that on that web server, there is another Intraweb application running. And unfortunately, even if the call is not issued by that one, because the xml file is hosted in its wwwroot and the Url used is its. It is the one which was generating the error code 6.
It happens that the MIME type on that Intraweb application on the server was not setup correctly:
TIWMimeTypes::RegisterType(".xml", mtXML, true);
I corrected it to:
TIWMimeTypes::RegisterType(".xml", MIME_XML, true);

And issue resolved, everything is working fine now!
Reply
#4
Great. Thanks for the feedback
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)