Sinch语音回调REST API-使用PHP作为电话会议的回调URL

时间:2019-02-24 23:56:16

标签: php rest sinch

我正在尝试使用Sinch语音回调REST API创建一个应用程序,以允许人们加入电话会议,从而通过浏览器进行应用程序间的通话。我也想使用PHP后端。

据此(https://www.sinch.com/docs/voice/rest/voice-callback-api.html),我的应用程序的回调URL需要首先响应Sinch的'ICE'事件。这是'ICE'事件的样子,https://www.sinch.com/docs/voice/rest/voice-callback-api.html#incomingcalleventcallback如下。

然后,我需要使用“ connectConf”操作来响应此“ ICE”。 (https://www.sinch.com/docs/voice/rest/voice-callback-api.html#connectconfaction

当'ACE'事件到来时,我只需要用动作“ continue”进行响应即可。像此资源所述(https://www.sinch.com/docs/voice/rest/voice-callback-api.html#answeredcalleventcallback

我对PHP的经验很少,但是我觉得我可能过于简化了Sinch从回调URL中获得的期望,因为我无法正常使用它。任何建议或示例将不胜感激。

这是我到目前为止在“回调URL”文件中所保存的内容。

from IPython.display import display
import ipywidgets as widgets

import gmaps
gmaps.configure(api_key='')


class AcledExplorer(object):
    """
    Jupyter widget for exploring the ACLED dataset.

    The user uses the slider to choose a year. This renders
    a heatmap of civilian victims in that year.
    """

    def __init__(self):
        self.marker_locations = [(None, None)]
        self._slider = None
        self._slider2 = None
        title_widget = widgets.HTML(
            '<h3>MY TEST, my test</h3>'
            '<h4>test1 <a href="https://www.test.com/">ACLED project</a></h4>'
        )

        map_figure = self._render_map(-15.7934036, -47.8823172)
        control = self._render_control()
        self._container = widgets.VBox([title_widget, control, map_figure])

    def render(self):
        display(self._container)

    def on_button_clicked(self, b):
        latitude = self.FloatSlider1.value
        longitude = self.FloatSlider2.value
        print("Button clicked.")
        self.markers = gmaps.marker_layer([(latitude, longitude)])
        return self._container

    def _render_control(self):

        """ Render the widgets """

        self.FloatSlider1 = widgets.FloatSlider(
        value=-15.8,
        min=-34,
        max=4.5,
        step=0.2,
        description='Latitude:',
        disabled=False,
        continuous_update=False,
        orientation='horizontal',
        readout=True,
        readout_format='.1f',
    )
        self.FloatSlider2 = widgets.FloatSlider(
        value=-47.9,
        min=-74,
        max=-33,
        step=0.2,
        description='Longitude:',
        disabled=False,
        continuous_update=False,
        orientation='horizontal',
        readout=True,
        readout_format='.1f',
    )
        self.button = widgets.Button(
            description="Plot!"
        )

        self.button.on_click(self.on_button_clicked)

        controls = widgets.VBox(
        [self.FloatSlider1, self.FloatSlider2, self.button])
        return controls

    def _render_map(self, latitude, longitude):
        """ Render the initial map """
        self.marker_locations = [(latitude, longitude)]
        brasilia_coordinates = (-15.7934036, -47.8823172)

        fig = gmaps.figure(center=brasilia_coordinates, zoom_level=3)
        self.markers = gmaps.marker_layer(self.marker_locations)
        fig.add_layer(self.markers)
        return fig


AcledExplorer().render()

1 个答案:

答案 0 :(得分:0)

在冰上,您需要执行操作:然后将connectConf作为操作

@Before
public void setUp() {
    landingActivity = Robolectric.setupActivity(LandingActivity.class);
}

@Test
public void shouldNotBeNull() {
    assertNotNull(landingActivity);
}