public new bool Update() { bool ret = _isValid; if (ret) { try { base.Update(); List <NameValuePair> pars = new List <NameValuePair>( new NameValuePair[] { new NameValuePair("context", RouteContext.Name), new NameValuePair("name", Name), new NameValuePair("originalName", _originalName), new NameValuePair("condition", DestinationCondition.Value), new NameValuePair("performOnFail", PerformOnFail), new NameValuePair("start", Start), new NameValuePair("end", End) }); switch (Type) { case VacationRouteRedirectTypes.PhoneExtension: pars.Add(new NameValuePair("extensionNumber", new sDomainExtensionPair(BridgeExtension.Number, BridgeExtension.Domain.Name))); break; case VacationRouteRedirectTypes.PlayFile: pars.Add(new NameValuePair("audioFile", AudioFile.ToString())); break; case VacationRouteRedirectTypes.TransferToExtension: pars.Add(new NameValuePair("callExtension", ExtensionReference)); break; case VacationRouteRedirectTypes.OutGateway: pars.Add(new NameValuePair("gateway", new sGatewayNumberPair(GatewayNumber, OutGateway.Name))); break; } ConfigurationController.RegisterChangeCall( typeof(TimedRoute), new ADialPlan.sUpdateConfigurationsCall( "UpdateTimedRoute", pars.ToArray()), new IEvent[] { new GenericEvent("TimedRouteUpdated", new NameValuePair[] { new NameValuePair("DomainName", Domain.Current.Name), new NameValuePair("Name", Name) }) }); } catch (Exception e) { Log.Error(e); EventController.TriggerEvent(new ErrorOccuredEvent(e)); ret = false; } } return(ret); }
public void PlaySound(AudioFile file) { var obj = new GameObject("sound_" + file.ToString()); var obj_audio_source = obj.AddComponent <AudioSource>(); obj_audio_source.PlayOneShot(GetAudioFile(file)); Destroy(obj, 1f); }
public async Task <bool> StoreAudioFile(AudioFile audioFile) { var result = await _audioService.AddAudioFile(audioFile); if (!result) { _logger.LogError($"Error: Could not store audio file with ID: { audioFile.ToString() }"); } return(result); }