예제 #1
0
        public async Task <PlaySilenceAction> PlaySilenceAsync(CallMedia.SilenceParams silence)
        {
            CallMedia media = new CallMedia()
            {
                Type = CallMedia.MediaType.silence, Parameters = JObject.FromObject(silence)
            };
            PlayMediaAction playMediaAction = await PlayMediaAsync(new List <CallMedia> {
                media
            });

            return(new PlaySilenceAction(playMediaAction));
        }
예제 #2
0
        public async Task <PlayTTSAction> PlayTTSAsync(CallMedia.TTSParams tts)
        {
            CallMedia media = new CallMedia()
            {
                Type = CallMedia.MediaType.tts, Parameters = JObject.FromObject(tts)
            };
            PlayMediaAction playMediaAction = await PlayMediaAsync(new List <CallMedia> {
                media
            });

            return(new PlayTTSAction(playMediaAction));
        }
예제 #3
0
        public async Task <PlayAudioAction> PlayAudioAsync(CallMedia.AudioParams audio)
        {
            CallMedia media = new CallMedia()
            {
                Type = CallMedia.MediaType.audio, Parameters = JObject.FromObject(audio)
            };
            PlayMediaAction playMediaAction = await PlayMediaAsync(new List <CallMedia> {
                media
            });

            return(new PlayAudioAction(playMediaAction));
        }
예제 #4
0
        public async Task <PlayMediaAction> PlayMediaAsync(List <CallMedia> media)
        {
            // Create the action first so it can hook events and not potentially miss anything
            PlayMediaAction action = new PlayMediaAction(this, Guid.NewGuid().ToString(), media);

            Task <CallPlayResult> taskCallPlayResult = mAPI.LL_CallPlayAsync(new CallPlayParams()
            {
                NodeID    = mNodeID,
                CallID    = mCallID,
                ControlID = action.ControlID,
                Play      = media,
            });

            // The use of await ensures that exceptions are rethrown, or OperationCancelledException is thrown
            CallPlayResult callPlayResult = await taskCallPlayResult;

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

            return(action);
        }
예제 #5
0
 internal PlayTTSAction(PlayMediaAction action)
 {
     mAction = action;
 }
예제 #6
0
 internal PlayAudioAction(PlayMediaAction action)
 {
     mAction = action;
 }
예제 #7
0
 internal PlaySilenceAction(PlayMediaAction action)
 {
     mAction = action;
 }