public void LogInboundCall(Call call, Customer customer)
        {
            var existingCall = _callRepository.GetBySid(call.Sid);

            if (existingCall != null)
            {
                try
                {
                    _callRepository.Update(call);
                    _logger.Debug($"Updated call {existingCall.Sid} with status {existingCall.CallStatus}");
                }
                catch (Exception ex)
                {
                    _logger.Error($"There was an error updating call {call.CallId}:  {ex}");
                }
            }
            else
            {
                try
                {
                    _callRepository.CreateInbound(call, customer);
                    _logger.Debug($"Created call {call.CallId}, with Sid {call.Sid}, with status {call.CallStatus}");
                }
                catch (Exception ex)
                {
                    _logger.Error($"There was an error creating call {call.CallId}:  {ex}");
                }
            }
        }
 public Call CreateInbound(Call call, Customer customer)
 {
     using (var db = _dbFactory.GetDatabase())
     {
         try
         {
             if (customer == null)
             {
                 customer = new Customer();
             }
             call.CallId = db.Query(new CreateCallCommand(call, customer));
         }
         catch (Exception ex)
         {
             _logger.Error($"Error occured executing CreateCallCommand - {ex}");
         }
     }
     return call;
 }
 public string Resolve(string telephoneNumber, string callSid, Customer customer, Uri baseUri)
 {
     _logger.Debug($"Resolving endpoint for call {callSid}");
     var endPoint = _directoryService.LookupByTelephoneNumber(telephoneNumber);
     return baseUri + _urlBuilder.BuildUrlFromEndPoint(endPoint, callSid);
 }