public async Task <ActionResult> Guest(string uri) { var userAgent = HttpContext.Request.UserAgent; var isMobileDevice = MeetingHelper.IsMobileDevice(userAgent) || HttpContext.Request.Browser.IsMobileDevice; // For mobile requests, redirect to lamna application. if (isMobileDevice) { return(await MobileIndex(uri)); } return(View((object)uri)); }
public async Task <IHttpActionResult> GetMeetingUri(string encryptedData) { var skypeMeeting = new SkypeMeeting(); var userAgent = HttpContext.Current.Request.UserAgent; var isMobileDevice = MeetingHelper.IsMobileDevice(userAgent) || HttpContext.Current.Request.Browser.IsMobileDevice; encryptedData = encryptedData.Replace(" ", "+"); var values = EncryptionHelper.Decrypt(encryptedData.Trim()); var queryParams = values.Split('&'); foreach (string param in queryParams) { string[] paramValue = param.Split('='); switch (paramValue[0].ToUpper()) { case "CUSTOMID": skypeMeeting.CustomId = paramValue[1]; break; case "DISPLAYNAME": skypeMeeting.DisplayName = string.IsNullOrEmpty(paramValue[1]) ? "Guest" : paramValue[1]; break; case "EMRID": skypeMeeting.EmrId = paramValue[1]; break; case "STARTTIME": skypeMeeting.StartTime = !string.IsNullOrEmpty(paramValue[1]) ? Convert.ToDateTime(paramValue[1], CultureInfo.InvariantCulture) : DateTime.Now; break; case "PATIENT": bool isPatient; Boolean.TryParse(paramValue[1], out isPatient); skypeMeeting.IsPatient = isPatient; break; case "MEETINGID": skypeMeeting.ItemId = paramValue[1]; break; case "USERTYPE": skypeMeeting.UserType = paramValue[1]; skypeMeeting.IsPatient = skypeMeeting.UserType.Equals("Doctor", StringComparison.InvariantCultureIgnoreCase) ? false : true; break; case "JOINSKYPECLIENT": bool isSkypeClient; Boolean.TryParse(paramValue[1], out isSkypeClient); skypeMeeting.IsSkypeClient = isSkypeClient; break; } } skypeMeeting.MeetingId = skypeMeeting.CustomId + skypeMeeting.EmrId; if (string.IsNullOrEmpty(skypeMeeting.UserType)) { skypeMeeting.UserType = skypeMeeting.IsPatient ? "Patient" : "Doctor"; } if (string.IsNullOrEmpty(skypeMeeting.ItemId)) { skypeMeeting.ItemId = SharePointRepository.CheckMeetingExists(skypeMeeting.MeetingId); } dynamic jsonResponse = null; if (string.IsNullOrEmpty(skypeMeeting.ItemId)) { if (isMobileDevice) { string response = await MeetingHelper.GetAnonMeeting(string.Empty, string.Empty, SharePointRepository.GetDoctorsByDepartment("HealthCare")); jsonResponse = JsonConvert.DeserializeObject(response); skypeMeeting.ItemId = SharePointRepository.InsertMeetingData(jsonResponse, skypeMeeting.StartTime, skypeMeeting.StartTime.AddHours(1), string.Empty, skypeMeeting.DisplayName, string.Empty, skypeMeeting.MeetingId); } else { //TODO: SQL Changes skypeMeeting.ItemId = InsertBlankMeetingDetails(skypeMeeting.StartTime, skypeMeeting.StartTime.AddHours(1), string.Empty, string.Empty, skypeMeeting.DisplayName, string.Empty, skypeMeeting.MeetingId); } } else { ListItem meetingDetails = SharePointRepository.GetMeetingUriDetails(skypeMeeting.ItemId); skypeMeeting.Url = Convert.ToString(meetingDetails["JoinURL"]); if (string.IsNullOrEmpty(skypeMeeting.Url) && !(skypeMeeting.IsSkypeClient)) { string response = await MeetingHelper.GetAnonMeeting(string.Empty, string.Empty, SharePointRepository.GetDoctorsByDepartment("HealthCare")); jsonResponse = JsonConvert.DeserializeObject(response); string onlineMeetingUri = jsonResponse.OnlineMeetingUri; string onlineMeetingJoinUrl = jsonResponse.JoinUrl; SharePointRepository.UpdateMeetingUri(onlineMeetingUri, onlineMeetingJoinUrl, skypeMeeting.ItemId); ListItem meetingUri = SharePointRepository.GetMeetingUriDetails(skypeMeeting.ItemId); skypeMeeting.Url = Convert.ToString(meetingUri["JoinURL"]); //ListItem meetingUri = SharePointRepository.GetMeetingUriDetails(skypeMeeting.ItemId); //skypeMeeting.Url = Convert.ToString(meetingDetails["JoinURL"]); //skypeMeeting.Url = onlineMeetingJoinUrl; } } if (isMobileDevice) { if (jsonResponse != null) { skypeMeeting.Url = jsonResponse.JoinUrl; } skypeMeeting.Url = $"{ConfigurationManager.AppSettings["MobileSiteUri"]}?uri={skypeMeeting.Url}&id={skypeMeeting.ItemId}&questReq=yes&displayName={skypeMeeting.DisplayName}"; } else { if (skypeMeeting.IsSkypeClient) { skypeMeeting.Url = "conf:sip:" + skypeMeeting.Url; } } return(Ok(skypeMeeting)); }