Example #1
0
 /// <summary>
 /// Delays before putting the call on hold.
 /// </summary>
 /// <param name="hold"></param>
 /// <param name="call"></param>
 /// <returns></returns>
 async Task Hold(AcdHoldContext hold, AudioVideoCall call, CancellationToken cancellationToken)
 {
     try
     {
         await Task.Delay(Delay, cancellationToken);
         await hold.HoldAsync(call);
     }
     catch (OperationCanceledException)
     {
         // ignore
     }
 }
Example #2
0
        public override async Task<AcdActionResult> Execute(LocalEndpoint localEndpoint, AudioVideoCall call, CancellationToken cancellationToken)
        {
            using (var hold = new AcdHoldContext(Audio))
            {
                // initiate delayed hold operation
                var s = new CancellationTokenSource();
                var h = Hold(hold, call, s.Token);

                // invoke next action
                var r = await base.Execute(localEndpoint, call, cancellationToken);

                // wait for delayed hold operation to exit
                s.Cancel();
                await h;

                return r;
            }
        }