public WebRtcSession(string dtlsCertFilePath, string dtlsKeyFilePath, string callID, bool isEncryptionDisabled, MediaSourceEnum mediaSource) { _dtlsCertFilePath = dtlsCertFilePath; _dtlsKeyFilePath = dtlsKeyFilePath; IsEncryptionDisabled = isEncryptionDisabled; MediaSource = mediaSource; Peer = new WebRtcPeer() { CallID = callID }; }
/// <summary> /// Initializes a new instance of the <see cref="Media" /> class. /// </summary> /// <param name="contentLength">Length, in bytes, of the file.</param> /// <param name="contentType">Used to override the automatic upload type.</param> /// <param name="description">A brief description of the media update, usually the original file name.</param> /// <param name="language">The language of the media file or text (default to "en-us").</param> /// <param name="mediaSource">Defines the source of the media (required) (default to MediaSourceEnum.Upload).</param> /// <param name="name">A friendly name for the media (required).</param> /// <param name="promptId">The prompt this media file represents.</param> /// <param name="sourceId">If the media was generated from a callflow module, this is ID of the properties.</param> /// <param name="sourceType">If the media was generated from a callflow module, this is the module name.</param> /// <param name="streamable">Determines if the media can be streamed (default to true).</param> /// <param name="tts">tts.</param> public Media(int?contentLength = default(int?), ContentTypeEnum?contentType = default(ContentTypeEnum?), string description = default(string), string language = "en-us", MediaSourceEnum mediaSource = MediaSourceEnum.Upload, string name = default(string), string promptId = default(string), string sourceId = default(string), string sourceType = default(string), bool?streamable = true, MediaTts tts = default(MediaTts)) { // to ensure "mediaSource" is required (not null) if (mediaSource == null) { throw new InvalidDataException("mediaSource is a required property for Media and cannot be null"); } else { this.MediaSource = mediaSource; } // to ensure "name" is required (not null) if (name == null) { throw new InvalidDataException("name is a required property for Media and cannot be null"); } else { this.Name = name; } this.ContentLength = contentLength; this.ContentType = contentType; this.Description = description; // use default value if no "language" provided if (language == null) { this.Language = "en-us"; } else { this.Language = language; } this.PromptId = promptId; this.SourceId = sourceId; this.SourceType = sourceType; // use default value if no "streamable" provided if (streamable == null) { this.Streamable = true; } else { this.Streamable = streamable; } this.Tts = tts; }
protected void Page_Load(object sender, EventArgs e) { // Validate query string if (!QueryHelper.ValidateHash("hash")) { // Do nothing } else { String identifier = QueryHelper.GetString("identifier", null); if (String.IsNullOrEmpty(identifier)) { return; } properties = WindowHelper.GetItem(identifier) as Hashtable; if (properties == null) { return; } CurrentMaster.DevelopmentMode = false; // Get information on current source type string sourceType = ValidationHelper.GetString(GetProp("source"), "attachments"); SourceType = CMSDialogHelper.GetMediaSource(sourceType); // Ensure additional styles CurrentMaster.HeadElements.Visible = true; CurrentMaster.HeadElements.Text += CSSHelper.GetStyle("*{direction:ltr !important;}body{background:transparent !important;}input,input:focus,input:hover,input:active{border:none;border-color:transparent;outline:none;}"); // Get uploader control based on the current source type string uploaderPath = ""; if (SourceType == MediaSourceEnum.MediaLibraries) { // If media library module is running if (ModuleManager.IsModuleLoaded(ModuleName.MEDIALIBRARY)) { uploaderPath = "~/CMSModules/MediaLibrary/Controls/Dialogs/DirectFileUploader/DirectMediaFileUploaderControl.ascx"; } } else { uploaderPath = "~/CMSModules/Content/Controls/Attachments/DirectFileUploader/DirectFileUploaderControl.ascx"; } // Load direct file uploader if (uploaderPath != "") { DirectFileUploader fileUploaderElem = this.LoadUserControl(uploaderPath) as DirectFileUploader; if (fileUploaderElem != null) { // Insert uploader to parent container pnlUploaderElem.Controls.Add(fileUploaderElem); // Initialize uploader control properties by query string values fileUploaderElem.AttachmentGUID = ValidationHelper.GetGuid(GetProp("attachmentguid"), Guid.Empty); fileUploaderElem.AttachmentGroupGUID = ValidationHelper.GetGuid(GetProp("attachmentgroupguid"), Guid.Empty); fileUploaderElem.AttachmentGUIDColumnName = ValidationHelper.GetString(GetProp("attachmentguidcolumnname"), null); fileUploaderElem.FormGUID = ValidationHelper.GetGuid(GetProp("formguid"), Guid.Empty); fileUploaderElem.DocumentID = ValidationHelper.GetInteger(GetProp("documentid"), 0); fileUploaderElem.NodeParentNodeID = ValidationHelper.GetInteger(GetProp("parentid"), 0); fileUploaderElem.NodeClassName = ValidationHelper.GetString(GetProp("classname"), ""); fileUploaderElem.InsertMode = ValidationHelper.GetBoolean(GetProp("insertmode"), false); fileUploaderElem.OnlyImages = ValidationHelper.GetBoolean(GetProp("onlyimages"), false); fileUploaderElem.ParentElemID = QueryHelper.GetString("parentelemid", String.Empty); fileUploaderElem.CheckPermissions = ValidationHelper.GetBoolean(GetProp("checkperm"), true); fileUploaderElem.IsLiveSite = ValidationHelper.GetBoolean(GetProp("islive"), true); fileUploaderElem.RaiseOnClick = ValidationHelper.GetBoolean(GetProp("click"), false); fileUploaderElem.NodeSiteName = ValidationHelper.GetString(GetProp("sitename"), null); fileUploaderElem.SourceType = SourceType; fileUploaderElem.NodeGroupID = ValidationHelper.GetInteger(GetProp("nodegroupid"), 0); // Metafile upload fileUploaderElem.SiteID = ValidationHelper.GetInteger(GetProp("siteid"), 0); fileUploaderElem.Category = ValidationHelper.GetString(GetProp("category"), String.Empty); fileUploaderElem.ObjectID = ValidationHelper.GetInteger(GetProp("objectid"), 0); fileUploaderElem.ObjectType = ValidationHelper.GetString(GetProp("objecttype"), String.Empty); fileUploaderElem.MetaFileID = ValidationHelper.GetInteger(GetProp("metafileid"), 0); // Library info initialization; fileUploaderElem.LibraryID = ValidationHelper.GetInteger(GetProp("libraryid"), 0); fileUploaderElem.MediaFileID = ValidationHelper.GetInteger(GetProp("mediafileid"), 0); fileUploaderElem.MediaFileName = ValidationHelper.GetString(GetProp("filename"), null); fileUploaderElem.IsMediaThumbnail = ValidationHelper.GetBoolean(GetProp("ismediathumbnail"), false); fileUploaderElem.LibraryFolderPath = ValidationHelper.GetString(GetProp("path"), ""); fileUploaderElem.IncludeNewItemInfo = ValidationHelper.GetBoolean(GetProp("includeinfo"), false); string siteName = SiteContext.CurrentSiteName; string allowed = ValidationHelper.GetString(GetProp("allowedextensions"), null); if (allowed == null) { if (fileUploaderElem.SourceType == MediaSourceEnum.MediaLibraries) { allowed = SettingsKeyInfoProvider.GetStringValue(siteName + ".CMSMediaFileAllowedExtensions"); } else { allowed = SettingsKeyInfoProvider.GetStringValue(siteName + ".CMSUploadExtensions"); } } fileUploaderElem.AllowedExtensions = allowed; // Auto resize width int autoResizeWidth = ValidationHelper.GetInteger(GetProp("autoresize_width"), -1); if (autoResizeWidth == -1) { autoResizeWidth = SettingsKeyInfoProvider.GetIntValue(siteName + ".CMSAutoResizeImageWidth"); } fileUploaderElem.ResizeToWidth = autoResizeWidth; // Auto resize height int autoResizeHeight = ValidationHelper.GetInteger(GetProp("autoresize_height"), -1); if (autoResizeHeight == -1) { autoResizeHeight = SettingsKeyInfoProvider.GetIntValue(siteName + ".CMSAutoResizeImageHeight"); } fileUploaderElem.ResizeToHeight = autoResizeHeight; // Auto resize max side size int autoResizeMaxSideSize = ValidationHelper.GetInteger(GetProp("autoresize_maxsidesize"), -1); if (autoResizeMaxSideSize == -1) { autoResizeMaxSideSize = SettingsKeyInfoProvider.GetIntValue(siteName + ".CMSAutoResizeImageMaxSideSize"); } fileUploaderElem.ResizeToMaxSideSize = autoResizeMaxSideSize; fileUploaderElem.AfterSaveJavascript = ValidationHelper.GetString(GetProp("aftersave"), String.Empty); fileUploaderElem.TargetFolderPath = ValidationHelper.GetString(GetProp("targetfolder"), String.Empty); fileUploaderElem.TargetFileName = ValidationHelper.GetString(GetProp("targetfilename"), String.Empty); } } } }
protected void Page_Load(object sender, EventArgs e) { // Validate query string if (!QueryHelper.ValidateHash("hash")) { // Do nothing } else { String identifier = QueryHelper.GetString("identifier", null); if (String.IsNullOrEmpty(identifier)) { return; } properties = WindowHelper.GetItem(identifier) as Hashtable; if (properties == null) { return; } // Get information on current source type string sourceType = ValidationHelper.GetString(GetProp("source"), "attachments"); SourceType = CMSDialogHelper.GetMediaSource(sourceType); // Ensure additional styles CurrentMaster.HeadElements.Visible = true; CurrentMaster.HeadElements.Text += CssHelper.GetStyle("*{direction:ltr !important;}body{background:transparent !important;}input,input:focus,input:hover,input:active{border:none;border-color:transparent;outline:none;}"); // Get uploader control based on the current source type string uploaderPath = ""; if (SourceType == MediaSourceEnum.MediaLibraries) { // If media library module is running if (ModuleManager.IsModuleLoaded(ModuleName.MEDIALIBRARY)) { uploaderPath = "~/CMSModules/MediaLibrary/Controls/Dialogs/DirectFileUploader/DirectMediaFileUploaderControl.ascx"; } } else { uploaderPath = "~/CMSModules/Content/Controls/Attachments/DirectFileUploader/DirectFileUploaderControl.ascx"; } // Load direct file uploader if (uploaderPath != "") { DirectFileUploader fileUploaderElem = this.LoadUserControl(uploaderPath) as DirectFileUploader; if (fileUploaderElem != null) { // Insert uploader to parent container pnlUploaderElem.Controls.Add(fileUploaderElem); // Initialize uploader control properties by query string values fileUploaderElem.AttachmentGUID = ValidationHelper.GetGuid(GetProp("attachmentguid"), Guid.Empty); fileUploaderElem.AttachmentGroupGUID = ValidationHelper.GetGuid(GetProp("attachmentgroupguid"), Guid.Empty); fileUploaderElem.AttachmentGUIDColumnName = ValidationHelper.GetString(GetProp("attachmentguidcolumnname"), null); fileUploaderElem.FormGUID = ValidationHelper.GetGuid(GetProp("formguid"), Guid.Empty); fileUploaderElem.DocumentID = ValidationHelper.GetInteger(GetProp("documentid"), 0); fileUploaderElem.NodeParentNodeID = ValidationHelper.GetInteger(GetProp("parentid"), 0); fileUploaderElem.NodeClassName = ValidationHelper.GetString(GetProp("classname"), ""); fileUploaderElem.InsertMode = ValidationHelper.GetBoolean(GetProp("insertmode"), false); fileUploaderElem.OnlyImages = ValidationHelper.GetBoolean(GetProp("onlyimages"), false); fileUploaderElem.ParentElemID = QueryHelper.GetString("parentelemid", String.Empty); fileUploaderElem.CheckPermissions = ValidationHelper.GetBoolean(GetProp("checkperm"), true); fileUploaderElem.IsLiveSite = false; fileUploaderElem.RaiseOnClick = ValidationHelper.GetBoolean(GetProp("click"), false); fileUploaderElem.NodeSiteName = ValidationHelper.GetString(GetProp("sitename"), null); fileUploaderElem.SourceType = SourceType; // Metafile upload fileUploaderElem.SiteID = ValidationHelper.GetInteger(GetProp("siteid"), 0); fileUploaderElem.Category = ValidationHelper.GetString(GetProp("category"), String.Empty); fileUploaderElem.ObjectID = ValidationHelper.GetInteger(GetProp("objectid"), 0); fileUploaderElem.ObjectType = ValidationHelper.GetString(GetProp("objecttype"), String.Empty); fileUploaderElem.MetaFileID = ValidationHelper.GetInteger(GetProp("metafileid"), 0); // Library info initialization; fileUploaderElem.LibraryID = ValidationHelper.GetInteger(GetProp("libraryid"), 0); fileUploaderElem.MediaFileID = ValidationHelper.GetInteger(GetProp("mediafileid"), 0); fileUploaderElem.MediaFileName = ValidationHelper.GetString(GetProp("filename"), null); fileUploaderElem.IsMediaThumbnail = ValidationHelper.GetBoolean(GetProp("ismediathumbnail"), false); fileUploaderElem.LibraryFolderPath = ValidationHelper.GetString(GetProp("path"), ""); fileUploaderElem.IncludeNewItemInfo = ValidationHelper.GetBoolean(GetProp("includeinfo"), false); string siteName = SiteContext.CurrentSiteName; string allowed = ValidationHelper.GetString(GetProp("allowedextensions"), null); if (allowed == null) { if (fileUploaderElem.SourceType == MediaSourceEnum.MediaLibraries) { allowed = SettingsKeyInfoProvider.GetValue(siteName + ".CMSMediaFileAllowedExtensions"); } else { allowed = SettingsKeyInfoProvider.GetValue(siteName + ".CMSUploadExtensions"); } } fileUploaderElem.AllowedExtensions = allowed; // Auto resize width int autoResizeWidth = ValidationHelper.GetInteger(GetProp("autoresize_width"), -1); if (autoResizeWidth == -1) { autoResizeWidth = SettingsKeyInfoProvider.GetIntValue(siteName + ".CMSAutoResizeImageWidth"); } fileUploaderElem.ResizeToWidth = autoResizeWidth; // Auto resize height int autoResizeHeight = ValidationHelper.GetInteger(GetProp("autoresize_height"), -1); if (autoResizeHeight == -1) { autoResizeHeight = SettingsKeyInfoProvider.GetIntValue(siteName + ".CMSAutoResizeImageHeight"); } fileUploaderElem.ResizeToHeight = autoResizeHeight; // Auto resize max side size int autoResizeMaxSideSize = ValidationHelper.GetInteger(GetProp("autoresize_maxsidesize"), -1); if (autoResizeMaxSideSize == -1) { autoResizeMaxSideSize = SettingsKeyInfoProvider.GetIntValue(siteName + ".CMSAutoResizeImageMaxSideSize"); } fileUploaderElem.ResizeToMaxSideSize = autoResizeMaxSideSize; fileUploaderElem.AfterSaveJavascript = ValidationHelper.GetString(GetProp("aftersave"), String.Empty); fileUploaderElem.TargetFolderPath = ValidationHelper.GetString(GetProp("targetfolder"), String.Empty); fileUploaderElem.TargetFileName = ValidationHelper.GetString(GetProp("targetfilename"), String.Empty); } } } }
private async void WebRtcStartCall(WebSocketSharp.Net.WebSockets.WebSocketContext context, string webSocketID, MediaSourceEnum mediaSource) { logger.LogDebug($"New WebRTC client added for web socket connection {webSocketID}."); if (!_webRtcConnections.Any(x => x.Key == webSocketID)) { var webRtcSession = new WebRtcSession(AddressFamily.InterNetwork, _dtlsCertificateThumbprint, null, null); webRtcSession.addTrack(SDPMediaTypesEnum.video, new List <SDPMediaFormat> { new SDPMediaFormat(SDPMediaFormatsEnum.VP8) }); // Don't need an audio track for the test pattern feed. if (mediaSource == MediaSourceEnum.Max) { webRtcSession.addTrack(SDPMediaTypesEnum.audio, new List <SDPMediaFormat> { new SDPMediaFormat(SDPMediaFormatsEnum.PCMU) }); } WebRtcConnection conn = new WebRtcConnection(webRtcSession); if (_webRtcConnections.TryAdd(webSocketID, conn)) { webRtcSession.OnClose += (reason) => PeerClosed(webSocketID, reason); webRtcSession.RtpSession.OnRtcpBye += (reason) => PeerClosed(webSocketID, reason); var offerSdp = await webRtcSession.createOffer(); webRtcSession.setLocalDescription(offerSdp); logger.LogDebug($"Sending SDP offer to client {context.UserEndPoint}."); context.WebSocket.Send(webRtcSession.SDP.ToString()); if (DoDtlsHandshake(webRtcSession)) { if (mediaSource == MediaSourceEnum.Max) { OnMp4MediaSampleReady += conn.SendMedia; if (!_isMp4Sampling) { _ = Task.Run(SampleMp4Media); } } else if (mediaSource == MediaSourceEnum.TestPattern) { OnTestPatternSampleReady += conn.SendMedia; if (!_isTestPatternSampling) { _ = Task.Run(SampleTestPattern); } } } else { PeerClosed(webSocketID, "dtls handshake failed"); } } else { logger.LogError("Failed to add new WebRTC client."); } } }
protected void Page_Load(object sender, EventArgs e) { string source = QueryHelper.GetString("source", ""); MediaSourceEnum src = CMSDialogHelper.GetMediaSource(source); if (src == MediaSourceEnum.Content) { // Check site availability if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Content", SiteContext.CurrentSiteName)) { RedirectToResourceNotAvailableOnSite("CMS.Content"); } } // Check UIProfile string output = QueryHelper.GetString("output", ""); bool checkUI = ValidationHelper.GetBoolean(SettingsHelper.AppSettings["CKEditor:PersonalizeToolbarOnLiveSite"], false); if ((output == "copy") || (output == "move") || (output == "link") || (output == "linkdoc") || (output == "relationship") || (output == "selectpath")) { checkUI = false; } if (checkUI) { string errorMessage = ""; OutputFormatEnum outputFormat = CMSDialogHelper.GetOutputFormat(output, QueryHelper.GetBoolean("link", false)); if ((outputFormat == OutputFormatEnum.HTMLLink) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink")) { errorMessage = "InsertLink"; } else if ((outputFormat == OutputFormatEnum.HTMLMedia) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertImageOrMedia")) { errorMessage = "InsertImageOrMedia"; } if (errorMessage != "") { RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", errorMessage); return; } switch (src) { case MediaSourceEnum.DocumentAttachments: case MediaSourceEnum.Attachment: if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "AttachmentsTab")) { errorMessage = "AttachmentsTab"; } break; case MediaSourceEnum.Content: if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "ContentTab")) { errorMessage = "ContentTab"; } break; } if (errorMessage != "") { RedirectToUIElementAccessDenied("CMS.MediaDialog", errorMessage); return; } } if (QueryHelper.ValidateHash("hash")) { ScriptHelper.RegisterJQuery(Page); CMSDialogHelper.RegisterDialogHelper(Page); ScriptHelper.RegisterStartupScript(Page, typeof(Page), "InitResizers", ScriptHelper.GetScript("InitResizers();")); linkMedia.InitFromQueryString(); } else { linkMedia.StopProcessing = true; linkMedia.Visible = false; string url = ResolveUrl(UIHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext", true)); ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }"); } }
/// <summary> /// Gets the resource type based on the media source /// </summary> /// <param name="sourceType">Media source type</param> private FileTypeEnum GetFileType(MediaSourceEnum sourceType) { switch (sourceType) { case MediaSourceEnum.Attachment: case MediaSourceEnum.Content: case MediaSourceEnum.DocumentAttachments: return FileTypeEnum.Attachment; case MediaSourceEnum.MediaLibraries: return FileTypeEnum.MediaFile; case MediaSourceEnum.MetaFile: return FileTypeEnum.MetaFile; } return FileTypeEnum.Unknown; }
protected void Page_Load(object sender, EventArgs e) { Page.Title = GetString("attach.uploadfile"); CurrentMaster.Title.TitleText = Page.Title; CurrentMaster.Title.TitleImage = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); // Validate query string if (!QueryHelper.ValidateHash("hash")) { // Do nothing } else { // Get information on current source type string sourceType = QueryHelper.GetString("source", "attachments"); SourceType = CMSDialogHelper.GetMediaSource(sourceType); // Get uploader control based on the current source type string uploaderPath = ""; if (SourceType == MediaSourceEnum.MediaLibraries) { // If media library module is running if (ModuleEntry.IsModuleRegistered(ModuleEntry.MEDIALIBRARY) && ModuleEntry.IsModuleLoaded(ModuleEntry.MEDIALIBRARY)) { uploaderPath = "~/CMSModules/MediaLibrary/Controls/Dialogs/DirectFileUploader/FileUpload.ascx"; } } else { uploaderPath = "~/CMSModules/Content/Controls/Attachments/FileUpload.ascx"; } // Load direct file uploader if (uploaderPath != "") { FileUpload fileUploaderElem = LoadControl(uploaderPath) as FileUpload; if (fileUploaderElem != null) { // Initialize uploader control properties by query string values fileUploaderElem.ID = "uploader"; fileUploaderElem.ImageWidth = QueryHelper.GetInteger("imagewidth", 24); fileUploaderElem.ImageHeight = QueryHelper.GetInteger("imageheight", 24); fileUploaderElem.ImageUrl = QueryHelper.GetString("imageurl", GetImageUrl("Design/Controls/DirectUploader/upload.png")); fileUploaderElem.ImageUrlOver = QueryHelper.GetString("imageurlover", String.Empty); fileUploaderElem.InnerDivHtml = QueryHelper.GetString("innerdivhtml", String.Empty); fileUploaderElem.InnerDivClass = QueryHelper.GetString("innerdivclass", String.Empty); fileUploaderElem.InnerLoadingDivHtml = QueryHelper.GetString("innerloadingdivhtml", String.Empty); fileUploaderElem.InnerLoadingDivClass = QueryHelper.GetString("innerloadingdivclass", String.Empty); fileUploaderElem.LoadingImageUrl = QueryHelper.GetString("loadingimageurl", GetImageUrl("Design/Preloaders/preload16.gif")); fileUploaderElem.AttachmentGUID = QueryHelper.GetGuid("attachmentguid", Guid.Empty); fileUploaderElem.AttachmentGroupGUID = QueryHelper.GetGuid("attachmentgroupguid", Guid.Empty); fileUploaderElem.AttachmentGUIDColumnName = QueryHelper.GetString("attachmentguidcolumnname", null); fileUploaderElem.FormGUID = QueryHelper.GetGuid("formguid", Guid.Empty); fileUploaderElem.DocumentID = QueryHelper.GetInteger("documentid", 0); fileUploaderElem.NodeParentNodeID = QueryHelper.GetInteger("parentid", 0); fileUploaderElem.NodeClassName = QueryHelper.GetString("classname", ""); fileUploaderElem.InsertMode = QueryHelper.GetBoolean("insertmode", false); fileUploaderElem.OnlyImages = QueryHelper.GetBoolean("onlyimages", false); fileUploaderElem.ParentElemID = QueryHelper.GetString("parentelemid", String.Empty); fileUploaderElem.CheckPermissions = QueryHelper.GetBoolean("checkperm", true); fileUploaderElem.IsLiveSite = QueryHelper.GetBoolean("islive", true); fileUploaderElem.SourceType = SourceType; // Library info initialization fileUploaderElem.LibraryID = QueryHelper.GetInteger("libraryid", 0); fileUploaderElem.LibraryFolderPath = QueryHelper.GetString("path", ""); fileUploaderElem.IncludeNewItemInfo = QueryHelper.GetBoolean("includeinfo", false); string siteName = CMSContext.CurrentSiteName; string allowed = QueryHelper.GetString("allowedextensions", ""); if (allowed == "") { if (fileUploaderElem.SourceType == MediaSourceEnum.MediaLibraries) { allowed = SettingsKeyProvider.GetStringValue(siteName + ".CMSMediaFileAllowedExtensions"); } else { allowed = SettingsKeyProvider.GetStringValue(siteName + ".CMSUploadExtensions"); } } fileUploaderElem.AllowedExtensions = allowed; fileUploaderElem.ResizeToWidth = QueryHelper.GetInteger("autoresize_width", 0); fileUploaderElem.ResizeToHeight = QueryHelper.GetInteger("autoresize_height", 0); fileUploaderElem.ResizeToMaxSideSize = QueryHelper.GetInteger("autoresize_maxsidesize", 0); fileUploaderElem.AfterSaveJavascript = QueryHelper.GetString("aftersave", String.Empty); // Insert uploader to parent container pnlUploaderElem.Controls.Add(fileUploaderElem); } } } }
protected void Page_Load(object sender, EventArgs e) { string source = QueryHelper.GetString("source", ""); MediaSourceEnum src = CMSDialogHelper.GetMediaSource(source); if (src == MediaSourceEnum.Content) { // Check site availability if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Content", SiteContext.CurrentSiteName)) { RedirectToResourceNotAvailableOnSite("CMS.Content"); } } // Check UIProfile string output = QueryHelper.GetString("output", ""); bool checkUI = (output != "copy") && (output != "move") && (output != "link") && (output != "linkdoc") && (output != "relationship") && (output != "selectpath"); if (checkUI) { string errorMessage = ""; OutputFormatEnum outputFormat = CMSDialogHelper.GetOutputFormat(output, QueryHelper.GetBoolean("link", false)); if ((outputFormat == OutputFormatEnum.HTMLLink) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink")) { errorMessage = "InsertLink"; } else if ((outputFormat == OutputFormatEnum.HTMLMedia) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertImageOrMedia")) { errorMessage = "InsertImageOrMedia"; } if (errorMessage != "") { RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", errorMessage); return; } switch (src) { case MediaSourceEnum.DocumentAttachments: case MediaSourceEnum.Attachment: if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "AttachmentsTab")) { errorMessage = "AttachmentsTab"; } break; case MediaSourceEnum.Content: if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "ContentTab")) { errorMessage = "ContentTab"; } break; case MediaSourceEnum.MetaFile: if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "MetafilesTab")) { errorMessage = "MetafilesTab"; } break; } if (errorMessage != "") { RedirectToUIElementAccessDenied("CMS.MediaDialog", errorMessage); return; } } // CKEditor's plugin filebrowser add custom params to url. // This ensures that custom params aren't validated if (QueryHelper.ValidateHash("hash", "CKEditor;CKEditorFuncNum;langCode", validateWithoutExcludedParameters: true)) { CMSDialogHelper.RegisterDialogHelper(Page); ScriptHelper.RegisterStartupScript(Page, typeof(Page), "InitResizers", ScriptHelper.GetScript("InitResizers();")); linkMedia.InitFromQueryString(); } else { linkMedia.StopProcessing = true; linkMedia.Visible = false; string url = ResolveUrl(AdministrationUrlHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext", true)); ltlScript.Text = ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }"); } }
private void WebRtcStartCall(WebSocketSharp.Net.WebSockets.WebSocketContext context, string webSocketID, IPAddress defaultIPAddress, bool isEncryptionDisabled, MediaSourceEnum mediaSource) { logger.Debug($"New WebRTC client added for web socket connection {webSocketID} and local IP address {defaultIPAddress}, encryption disabled {isEncryptionDisabled}."); var mediaTypes = new List <RtpMediaTypesEnum> { RtpMediaTypesEnum.Video, RtpMediaTypesEnum.Audio }; _mfSampleGrabber.Start(); // Does nothing if media session is not paused. lock (_webRtcSessions) { if (!_webRtcSessions.Any(x => x.Key == webSocketID)) { var webRtcSession = new WebRtcSession(_dtlsCertificatePath, _dtlsKeyPath, webSocketID, isEncryptionDisabled, mediaSource); string dtlsThumbrpint = (isEncryptionDisabled == false) ? _dtlsCertificateThumbprint : null; if (_webRtcSessions.TryAdd(webSocketID, webRtcSession)) { webRtcSession.Peer.OnSdpOfferReady += (sdp) => { logger.Debug("Offer SDP: " + sdp); context.WebSocket.Send(sdp); }; webRtcSession.Peer.OnMediaPacket += webRtcSession.MediaPacketReceived; webRtcSession.Peer.Initialise(dtlsThumbrpint, null, mediaTypes, defaultIPAddress, isEncryptionDisabled); webRtcSession.Peer.OnClose += () => { PeerClosed(webSocketID); }; if (isEncryptionDisabled == false) { webRtcSession.Peer.OnDtlsPacket += webRtcSession.DtlsPacketReceived; } else { webRtcSession.Peer.OnIceConnected += webRtcSession.InitEncryptionDisabledSession; } } else { logger.Error("Failed to add new WebRTC client."); } } } }
public SDPExchange(MediaSourceEnum mediaSource, bool isEncryptionDisabled, IPAddress rtpIPAddress) { MediaSource = mediaSource; IsEncryptionDisabled = isEncryptionDisabled; RtpIPAddress = rtpIPAddress; }