Stopping a call does NOT work using the API explorer or our own code referencing the Sandbox or our code referencing Production. The Response code is 204 ("No content") and and the response headers are correct.
So, the DELETE method syntax and permissions are correct and the response is correct, but it does not hang up.
Anyone else having this problem?
Here is the Response from the Ring Out using API Explorer
{ "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/134133004/extension/134133004/ringout/...;,
"id": 62,
"status": {
"callStatus": "InProgress",
"callerStatus": "InProgress",
"calleeStatus": "InProgress"
}
}
Here is the code for the DELETE method using API Explorer
https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/ringout/62
Here is the Response Headers for the DELETE method
{
"date": "Thu, 07 Apr 2016 19:09:12 GMT", "routingkey": "SJC12P01JWS02, SJC12P01PAS01", "content-language": "en", "content-type": "application/json; charset=UTF-8"
}
String sBody = String.Empty;
byte[] byteBody = null;
try
{
byteBody = new byte[2] { 123, 125 };
SendReceive("DELETE", "/restapi/v1.0/account/~/extension/~/ringout/" + _t.CallId, "Bearer", _t.Access_Token, byteBody);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return String.Empty;
}
private void SendReceive(String method, String uri, String tokenType, String authcode, byte[] byteBody)
{
Stream sResponse = null;
Stream sRequest = null;
StreamReader srResponse = null;
HttpWebResponse HttpWResp = null;
String sBody = String.Empty;
ASCIIEncoding encoding = new ASCIIEncoding();
HttpWebRequest HttpWReq = null;
try
{
HttpWReq = (HttpWebRequest)WebRequest.Create(baseURL + uri);
HttpWReq.Method = method;
HttpWReq.KeepAlive = true;
if (tokenType.Trim().Length > 0 && authcode.Trim().Length > 0)
{
HttpWReq.UserAgent = appName + "/" + appVersion;
HttpWReq.Headers[HttpRequestHeader.Authorization] = string.Format("{0} {1}", tokenType.Trim(), authcode.Trim());
}
if (HttpWReq.Method == "POST")
{
if (HttpWReq.RequestUri.ToString().Contains("oauth/"))
{
HttpWReq.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";
}
else
{
HttpWReq.ContentType = "application/json";
}
HttpWReq.ContentLength = byteBody.Length;
//Add parameters to the Body - Go figure
//Task<sRequest>HttpWReq.GetRequestStreamAsync();
sRequest = HttpWReq.GetRequestStream();
sRequest.Write(byteBody, 0, byteBody.Length);
//Console.WriteLine(sBody);
}
if (HttpWReq.Method == "DELETE")
{
HttpWReq.Accept = "application/json";
HttpWReq.ContentType = "application/json; charset=UTF-8";
HttpWReq.Headers.Add("X-HTTP-Method-Override", "DELETE");
}
//Send Request and Get the Response
HttpWResp = (HttpWebResponse)HttpWReq.GetResponse();
switch (HttpWResp.StatusCode.ToString())
{
case "OK": //== HttpStatusCode.OK)
sResponse = HttpWResp.GetResponseStream();
srResponse = new StreamReader(sResponse);
String s = srResponse.ReadToEnd();
jt = JToken.Parse(s);
break;
case "NoContent":// Output from DELETE
break;
default:
break;
}
}
catch (Exception ex)
{
Console.WriteLine(String.Format("{0} {1}", ex.Message, ex.GetType().FullName));
}
finally
{
if (HttpWResp != null)
{
HttpWResp.Close();
}
else
{
HttpWReq.Abort();
}
}
}
From your previous comment, it seems that I misunderstood the purpose of this method. If DELETE only works to stop a call before it has been answered, how do we hangup a call once it is answered?
1. I see the state of the call is "InProgress", but when you initiate the DELETE request, is that being done before/during/after any leg of the call has been connected, and if yes, at which leg and what is the state (if observing the presence notifications) please?
The reason I ask is because currently, if the state of the call switches to "Ringing" that is considered as connected according to our current implementation and cannot be canceled. It seems this might need some improvement, but I'm trying to gather as much information as possible.
https://developers.ringcentral.com/api-docs/latest/index.html#!#RefRingOut.html
I will take a look at the RingOut and canceling a RingOut and if I am able to recreate your experience will create an issue with our engineering team to inspect/resolve appropriately.
If I am unable to recreate, I may have some additional inquiries.
Thanks for providing the headers and request/response information.
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder