Sinch CallBack API : Hangup in ICE event

自闭症网瘾萝莉.ら 提交于 2020-04-16 12:45:05

问题


I had place call between two Android devices which is running successfully. Now I want to implement Callback Rest API because of some server side decision before place call. As given in this image, ICE event fire and developer backend respond SVAML response.

Now I want to simply Hangup Call, for this I had done following code :

[System.Web.Http.HttpPost]
    public SvamletModel MakeCall(CallbackEventModel model)
    {
        var sinch = SinchFactory.CreateCallbackResponseFactory(Locale.EnUs);
        var reader = sinch.CreateEventReader();
        var evt = reader.ReadModel(model);

        var builder = sinch.CreateIceSvamletBuilder();

        SvamletModel svaml = builder.Hangup().Model;

        return svaml;
    }

but call still placed. I had also write action class under SvamletModel but same response.

[System.Web.Http.HttpPost]
public SvamletModel MakeCall(CallbackEventModel model)
{
    var sinch = SinchFactory.CreateCallbackResponseFactory(Locale.EnUs);
    var reader = sinch.CreateEventReader();
    var evt = reader.ReadModel(model);

    var builder = sinch.CreateIceSvamletBuilder();



    SvamletModel svaml = builder.Build().Model;


    SvamletActionModel actionModel = new SvamletActionModel();
    actionModel.Name = "Hangup";
    svaml.Action = actionModel;

    return svaml;
}

Note I had followed all steps given in Callback API and https://developers.sinch.com/docs/further-securing-your-sinch-calling-functionality-app-with-rest-api with no success.


回答1:


Hi your code looks correct, can you capture and send here the HTTP response your backend is sending as response of the ICE POST? Also add the callID for call.

Sinch Voice & Video Team




回答2:


Converting return type from SvamletModel to string is working.

So I have changed

[System.Web.Http.HttpPost]
    public SvamletModel MakeCall(CallbackEventModel model)
    {
        var sinch = SinchFactory.CreateCallbackResponseFactory(Locale.EnUs);
        var reader = sinch.CreateEventReader();
        var evt = reader.ReadModel(model);

        var builder = sinch.CreateIceSvamletBuilder();

        SvamletModel svaml = builder.Hangup().Model;

        return svaml;
    }

to

[System.Web.Http.HttpPost]
    public string MakeCall(CallbackEventModel model)
    {
        var sinch = SinchFactory.CreateCallbackResponseFactory(Locale.EnUs);
        var reader = sinch.CreateEventReader();
        var evt = reader.ReadModel(model);

        var builder = sinch.CreateIceSvamletBuilder();

        SvamletModel svaml = builder.Hangup().Model;

        string json = JsonConvert.SerializeObject(svaml, Formatting.Indented);

        return json;
    }


来源:https://stackoverflow.com/questions/60978486/sinch-callback-api-hangup-in-ice-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!