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)); }
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)); }
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)); }
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); }
internal PlayTTSAction(PlayMediaAction action) { mAction = action; }
internal PlayAudioAction(PlayMediaAction action) { mAction = action; }
internal PlaySilenceAction(PlayMediaAction action) { mAction = action; }