I'm following the example here: https://www.twilio.com/docs/quickstart/csharp/twiml/greet-caller-by-name
Although I've set it up slightly differently. Rather than code it directly in the cshtml I have a controller action reading from my database to retrieve the name of the person with the mobile number passed in. Anyway....
When I phone my Twilio number, I've set it up (the automated voicemail) to POST to a webpage I've specified (https://www.XXX.co.uk/Twilio/Voicemail) and say "Hi [user name]" as opposed to "Hi there" (if it can't find a user). However it currently doesn't find the user because the parameter ("FROM") doesn't get POSTed successfully.
If I manually post using Fiddler and specify: Content-Type: application/x-www-form-urlencoded
in the request, it works. If I take this out, it doesn't work (so i assume Twilio doesn't include this when POSTing?). My action signature looks like this:
[HttpPost] public ActionResult Voicemail(FormCollection collection) {
And I'm tracing 'collection'.
Any advice?
Thanks.
UPDATE
I've also tried with: public ActionResult Voicemail(VoiceRequest request) { string mobileNumber = request.From;
but I still don't get the POSTed values.