public ActionResult P2pCall([FromBody] Rest.ServerRest.P2PUserRest peerUser) { if (LoginStatus.LoggedIn != LoginManager.Instance.CurrentLoginStatus) { return(GetErrInfo(Constants.ErrorCode.NOT_LOGGED_IN)); } if (null == peerUser) { log.Info("Failed to p2pCall for null data"); return(GetErrInfo(Constants.ErrorCode.EMPTY_PEER_USER_INFO)); } string userId = peerUser.userId.ToString(); if (string.IsNullOrEmpty(userId.Trim())) { log.Info("Failed P2P Call for empty userId"); return(GetErrInfo(Constants.ErrorCode.EMPTY_PEER_USER_ID)); } if (LoginManager.Instance.CurrentLoginStatus == LoginStatus.LoggedIn && !LoginManager.Instance.IsRegistered) { return(GetErrInfo(Constants.ErrorCode.NOT_REGISTRATION)); } CallController.Instance.UpdateUserImage(Utils.GetSuspendedVideoBackground(), Utils.GetCurrentAvatarPath()); CallController.Instance.P2pCallPeer(userId, peerUser.imageUrl, peerUser.displayName); return(Content("")); }
public void p2pCall(string peerInfo) { log.InfoFormat("p2pCall: {0}", peerInfo); Rest.ServerRest.P2PUserRest peerUser = JsonConvert.DeserializeObject <Rest.ServerRest.P2PUserRest>(peerInfo); if (null == peerUser) { log.InfoFormat("Failed to parse p2pCall data: {0}", peerInfo); return; } string userId = peerUser.userId.ToString(); if (string.IsNullOrEmpty(userId.Trim())) { log.Info("Failed P2P Call for empty userId"); return; } if (LoginManager.Instance.CurrentLoginStatus == LoginStatus.LoggedIn && !LoginManager.Instance.IsRegistered) { IMasterDisplayWindow ownerWindow = (MainWindow)System.Windows.Application.Current.MainWindow; MessageBoxTip tip = new MessageBoxTip(ownerWindow); tip.SetTitleAndMsg(LanguageUtil.Instance.GetValueByKey("PROMPT"), LanguageUtil.Instance.GetValueByKey("FAIL_TO_CALL_FOR_REGISTER_FAILURE"), LanguageUtil.Instance.GetValueByKey("CONFIRM")); tip.ShowDialog(); return; } CallController.Instance.P2pCallPeer(userId, peerUser.imageUrl, peerUser.displayName); }