//create a call object from a twilio request and save the call to the database public static Call CreateFromTwilioRequest(MongoDatabase mongoDb, TwilioComm.TwilioRequestVoice twilioRequest, Client client, bool saveCall) { if (twilioRequest == null) return null; if (mongoDb == null || mongoDb.Server == null) { mongoDb = Helper.MongoDb.GetDatabase(); } Call call = Call.CreateFromTwilioRequest(twilioRequest); if (client != null) call.ClientToId = client._id; if (call.CallDateCreate == null) call.CallDateCreate = DateTime.Now; call.CallDateUpdate = DateTime.Now; if (saveCall) call.Save(); if (log.IsDebugEnabled) { log.Debug("CreateFromTwilioRequest.call." + (call == null ? "null" : call.ToJsonString())); } return call; }
//create a call object from a twilio request public static CallBase CreateFromTwilioRequest(TwilioComm.TwilioRequestVoice twilioRequest) { if (twilioRequest == null) return null; CallBase call = new CallBase(); call.FromNumber = twilioRequest.From; call.FromName = twilioRequest.From; call.CallTwilioId = twilioRequest.CallSid; if (log.IsDebugEnabled) { log.Debug("CreateFromTwilioRequest.call." + (call == null ? "null" : call.ToJsonString())); } return call; }
//create a call object from a twilio request and save the call to the database public static Call CreateFromTwilioRequest(TwilioComm.TwilioRequestVoice twilioRequest, Client client, bool saveCall) { if (twilioRequest == null) return null; return CreateFromTwilioRequest(null, twilioRequest, client, saveCall); }