Exemplo n.º 1
0
        private void OnCallHappend(object sender, Call args)
        {
            CallInfo call = new CallInfo()
            {
                ATSCall = args,
                To      = abonentsService.GetAbonentByNumber(args.To),
                From    = abonentsService.GetAbonentByNumber(args.From)
            };

            if (args.Duration > TimeSpan.Zero)
            {
                call.Cost = args.Duration.TotalSeconds * Tariff.CostPerMinute;
                callsService.PayForCall(call);
            }
            callsService.AddCall(call);
        }