Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(example): add handling of incoming call event #56

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions examples/WebApi/Controllers/HandleIncomingIceEventController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Mvc;
using Sinch;
using Sinch.Voice.Calls.Actions;
using Sinch.Voice.Calls.Instructions;
using Sinch.Voice.Hooks;

namespace WebApiExamples.Controllers
{
[ApiController]
[Route("voice")]
public class HandleIncomingIceEventController : ControllerBase
{
private readonly ISinchClient _sinchClient;

public HandleIncomingIceEventController(ISinchClient sinchClient)
{
_sinchClient = sinchClient;
}

[HttpPost]
[Route("ice-event")]
asein-sinch marked this conversation as resolved.
Show resolved Hide resolved
public IActionResult HandleEvent([FromBody] IncomingCallEvent incomingCallEvent)
{
var response = new CallEventResponse()
{
Action = new Hangup(),
Instructions = new List<IInstruction>()
{
new Say()
{
Text = "Thank you for calling Sinch! This call will now end.",
Locale = "en-US"
}
}
};
return Ok(response);
}
}
}
Loading