I am having difficulty disconnecting an interaction. I am simply calling the `.Disconnect()` method on the Interaction object but nothing is happening. It could be how I am obtaining the interaction object giving an Id.
Here is my code
public JsonpResult Disconnect(long interactionId)
{
var resource = new BaseResource();
try
{
var interaction = GetInteraction(interactionId);
interaction.Disconnect();
resource.IsSuccess = true;
resource.HttpCode = 200;
}
catch (Exception ex)
{
resource.Error = ex.Message;
resource.InnerError = (ex.InnerException == null) ? "" : ex.InnerException.ToString();
resource.HttpCode = (int)System.Net.HttpStatusCode.SeeOther;
}
return new JsonpResult(resource);
}
When the call in in "Proceeding" state, the request hangs on the `interaction.Disconnect()` until the other party picks up. But even then, the code proceed but it does not hang up the call.
Here is how I fetch for the interaction giving the interactionId.
private Interaction GetInteraction(long interactionId)
{
var id = new InteractionId(interactionId);
var interaction = GetInteractionManager().CreateInteraction(id);
if (interaction == null)
{
throw new Exception("Unable to find the interaction");
}
return interaction;
}
What am I doing wrong here? How can I Disconnect() the call?