admin管理员组文章数量:1389777
I'm building an application where I want the call recordings URL and duration of the call captured upon completion of the call.
My recordingStatusCallback
handler requests keep returning with a status 400 and I don't know why it is doing that or how I could debug this further.
Here is my Recordings
handler:
[HttpPost]
public void Recordings([FromForm] VoiceRequest request)
{
// TODO: Get the recording URL and log it to the database for the call
Console.WriteLine($"CallSID: {request.CallSid}");
Console.WriteLine($"RecordingUrl: {request.RecordingUrl}");
Console.WriteLine($"RecordingDuration: {request.RecordingDuration}");
// Not sure what happens here... testing it out if transcriptions are available...
Console.WriteLine($"TranscriptionUrl: {request.TranscriptionUrl}");
}
For reference, I have a similar handler for statusCallbackEvent
- see this snippet:
[HttpPost]
public void Events([FromForm] VoiceRequest request)
{
Console.WriteLine($"CallSID: {request.CallSid}");
Console.WriteLine($"CallStatus: {request.CallStatus}");
Console.WriteLine($"DialCallDuration: {request.DialCallDuration}");
}
And this Events
function is being called correctly without issues.
I'd appreciate your help!
I'm building an application where I want the call recordings URL and duration of the call captured upon completion of the call.
My recordingStatusCallback
handler requests keep returning with a status 400 and I don't know why it is doing that or how I could debug this further.
Here is my Recordings
handler:
[HttpPost]
public void Recordings([FromForm] VoiceRequest request)
{
// TODO: Get the recording URL and log it to the database for the call
Console.WriteLine($"CallSID: {request.CallSid}");
Console.WriteLine($"RecordingUrl: {request.RecordingUrl}");
Console.WriteLine($"RecordingDuration: {request.RecordingDuration}");
// Not sure what happens here... testing it out if transcriptions are available...
Console.WriteLine($"TranscriptionUrl: {request.TranscriptionUrl}");
}
For reference, I have a similar handler for statusCallbackEvent
- see this snippet:
[HttpPost]
public void Events([FromForm] VoiceRequest request)
{
Console.WriteLine($"CallSID: {request.CallSid}");
Console.WriteLine($"CallStatus: {request.CallStatus}");
Console.WriteLine($"DialCallDuration: {request.DialCallDuration}");
}
And this Events
function is being called correctly without issues.
I'd appreciate your help!
Share Improve this question edited Mar 12 at 21:15 marc_s 756k184 gold badges1.4k silver badges1.5k bronze badges asked Mar 12 at 21:01 punsandgunspunsandguns 693 bronze badges1 Answer
Reset to default 0After lots of trial and error, I stumbled upon the solution to my problem. For whatever reason, the statusCallback
and the recordingStatusCallback
are not treated the same. The handler that eventually does work for me is as below
public async System.Threading.Tasks.Task RecordingsAsync()
{
// TODO: Get the recording URL and log it to the database for the call
var form = await Request.ReadFormAsync();
Console.WriteLine($"CallSid: {form["CallSid"]}");
Console.WriteLine($"RecordingUrl: {form["RecordingUrl"]}");
Console.WriteLine($"RecordingDuration: {form["RecordingDuration"]}");
}
I'm only accessing 3 values here but there are more parameters you can access - read about them here https://www.twilio/docs/voice/api/call-resource#parameters-sent-to-your-recordingstatuscallback-url
I would still like a Twilio expert to comment on whether my solution is the right way to do this or if there is a better-prescribed approach that should be considered.
本文标签:
版权声明:本文标题:Twilio C# ASP.NET Core Web API project recordingStatusCallback keeps returning a status 400. What am I doing wrong? - Stack Over 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744730664a2622029.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论