Esempio n. 1
0
        public async Task <PlaySilenceAndCollectAction> PlaySilenceAndCollectAsync(CallMedia.SilenceParams silence, CallCollect collect)
        {
            CallMedia media = new CallMedia()
            {
                Type = CallMedia.MediaType.silence, Parameters = JObject.FromObject(silence)
            };
            PlayMediaAndCollectAction playMediaAndCollectAction = await PlayMediaAndCollectAsync(new List <CallMedia> {
                media
            }, collect);

            return(new PlaySilenceAndCollectAction(playMediaAndCollectAction));
        }
Esempio n. 2
0
        public async Task <PlayTTSAndCollectAction> PlayTTSAndCollectAsync(CallMedia.TTSParams tts, CallCollect collect)
        {
            CallMedia media = new CallMedia()
            {
                Type = CallMedia.MediaType.tts, Parameters = JObject.FromObject(tts)
            };
            PlayMediaAndCollectAction playMediaAndCollectAction = await PlayMediaAndCollectAsync(new List <CallMedia> {
                media
            }, collect);

            return(new PlayTTSAndCollectAction(playMediaAndCollectAction));
        }
Esempio n. 3
0
        public async Task <PlayAudioAndCollectAction> PlayAudioAndCollectAsync(CallMedia.AudioParams audio, CallCollect collect)
        {
            CallMedia media = new CallMedia()
            {
                Type = CallMedia.MediaType.audio, Parameters = JObject.FromObject(audio)
            };
            PlayMediaAndCollectAction playMediaAndCollectAction = await PlayMediaAndCollectAsync(new List <CallMedia> {
                media
            }, collect);

            return(new PlayAudioAndCollectAction(playMediaAndCollectAction));
        }
Esempio n. 4
0
        public async Task <PlayMediaAndCollectAction> PlayMediaAndCollectAsync(List <CallMedia> media, CallCollect collect)
        {
            // Create the action first so it can hook events and not potentially miss anything
            PlayMediaAndCollectAction action = new PlayMediaAndCollectAction(this, Guid.NewGuid().ToString(), media, collect);

            Task <CallPlayAndCollectResult> taskCallPlayAndCollectResult = mAPI.LL_CallPlayAndCollectAsync(new CallPlayAndCollectParams()
            {
                NodeID    = mNodeID,
                CallID    = mCallID,
                ControlID = action.ControlID,
                Play      = media,
                Collect   = collect,
            });

            // The use of await ensures that exceptions are rethrown, or OperationCancelledException is thrown
            CallPlayAndCollectResult callPlayAndCollectResult = await taskCallPlayAndCollectResult;

            // If there was an internal error of any kind then throw an exception
            mAPI.ThrowIfError(callPlayAndCollectResult.Code, callPlayAndCollectResult.Message);

            return(action);
        }
 internal PlaySilenceAndCollectAction(PlayMediaAndCollectAction action)
 {
     mAction = action;
 }
Esempio n. 6
0
 internal PlayAudioAndCollectAction(PlayMediaAndCollectAction action)
 {
     mAction = action;
 }
Esempio n. 7
0
 internal PlayTTSAndCollectAction(PlayMediaAndCollectAction action)
 {
     mAction = action;
 }