public IActionResult VideoCallPatient()
 {
     ViewBag.HeaderName = "VideoCall";
     //if (string.IsNullOrEmpty(HttpContext.Session.GetString("SessionId")))
     //{
     //    int ApiKey = 46201082;
     //    string ApiSecret = "fbef52398143449c9b269e1357d797c64ae945be";
     //    var OpenTok = new OpenTok(ApiKey, ApiSecret);
     //    var session = OpenTok.CreateSession();
     //    // Store this sessionId in the database for later use:
     //    string sessionId = session.Id;
     //    //string token = OpenTok.GenerateToken(sessionId);
     //    double inOneMonth = (DateTime.UtcNow.Add(TimeSpan.FromDays(30)).Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
     //    string token = session.GenerateToken(role: Role.MODERATOR, expireTime: inOneMonth, data: "name=Prabhu");
     //    HttpContext.Session.SetString("OpenTokSessionId", sessionId);
     //    HttpContext.Session.SetString("Token", token);
     //}
     //ViewBag.PatientName = HttpContext.Session.GetString("UserName");
     if (!string.IsNullOrEmpty(HttpContext.Session.GetString("UserId")))
     {
         Models.Patient lpatient = lIPatient.GetPatientByPatientLoginId(HttpContext.Session.GetString("UserId"));
         if (lpatient != null)
         {
             HttpContext.Session.SetString("PatientId", lpatient.PatientLoginId);
             HttpContext.Session.SetString("PatientName", lpatient.PatientName);
             HttpContext.Session.SetString("TherapistId", lpatient.Therapistid);
         }
     }
     return(View());
 }
示例#2
0
 public JsonResult GetSessionIDAndToken(string therapistId, string patientId)
 {
     try
     {
         if (!string.IsNullOrEmpty(therapistId) && !string.IsNullOrEmpty(patientId))
         {
             Patient lpatient = IPatient.GetPatientByPatientLoginId(patientId);
             if (lpatient != null)
             {
                 Vtransact _result = lVTransactRepository.getVTransactbyTherapistAndPatientId(therapistId, patientId);
                 return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", VTransact = _result, PatientName = lpatient.PatientName.Replace(' ', '_'), TimeZone = DateTime.UtcNow.ToString("s") }));
             }
             else
             {
                 return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "failed", TimeZone = DateTime.UtcNow.ToString("s") }));
             }
         }
         else
         {
             return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", TimeZone = DateTime.UtcNow.ToString("s") }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "failed", TimeZone = DateTime.UtcNow.ToString("s") }));
     }
 }