Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscriber Block Not Working For SRT and RTMP publish #5865

Open
lastpeony opened this issue Nov 30, 2023 · 6 comments
Open

Subscriber Block Not Working For SRT and RTMP publish #5865

lastpeony opened this issue Nov 30, 2023 · 6 comments
Assignees

Comments

@lastpeony
Copy link
Contributor

subscriber block feature is not implemented for srt and rtmp publish
make it work same with webrtc publish

@lastpeony lastpeony self-assigned this Nov 30, 2023
@mekya mekya moved this to 🏗 In progress in Ant Media Server Dec 4, 2023
@mekya mekya moved this from 🏗 In progress to After sprint in Ant Media Server Dec 4, 2023
@mekya mekya assigned mekya and yashtandon113 and unassigned mekya Dec 4, 2023
@yashtandon113
Copy link
Contributor

@lastpeony

I tested the implementation, and here are the points.

  1. The secret key should be a multiple of 8 bytes instead of a multiple of 6 bytes; otherwise, the TOTP token API throws an internal server error. Currently, the secret key generated via Dashborad is a multiple of 6 bytes.

  2. After using the secret key multiplier of 8 bytes, it works fine with both WebRTC and RTMP.

  3. For SRT, the pattern is not clear on how to use the subscriberId and subscriberCode parameters in a URL.

@lastpeony
Copy link
Contributor Author

lastpeony commented Dec 11, 2023

@lastpeony

I tested the implementation, and here are the points.

  1. The secret key should be a multiple of 8 bytes instead of a multiple of 6 bytes; otherwise, the TOTP token API throws an internal server error. Currently, the secret key generated via Dashborad is a multiple of 6 bytes.
  2. After using the secret key multiplier of 8 bytes, it works fine with both WebRTC and RTMP.
  3. For SRT, the pattern is not clear on how to use the subscriberId and subscriberCode parameters in a URL.

1,2-) when i create secret from web panel i face with no problem generating totps. needs more info to reproduce this
3-) for ffmpeg:
usr/local/bin/ffmpeg -re -i src/test/resources/test_video_sky_diving_low_latency.flv -codec copy -f flv srt://127.0.0.1:4200?streamid=WebRTCAppEE/stream_3735,subscriberId=subscriber_173,subscriberCode=qwe
for obs check documentation
there was a small problem with srt subsriber code check. i sent commit to enterprise side to fix it.

@burak-58 burak-58 moved this from After sprint to 🏗 In progress in Ant Media Server Dec 11, 2023
@yashtandon113
Copy link
Contributor

  1. The token issue comes when any user wants to add the subscriber in advance before creating a token. The use of adding a subscriber in advance is to restrict the undefined streams so only added subscribers would be able to publish the stream. The reproduce scenario is as follows:
  • Generate a secret key from the web panel by enabling TOTP for publish and play
  • Now use that secret key to add the subscriber using this API
  • After adding a subscriber, generate the TOTP token.

Expected behavior
The token should be generated

Actual behavior
The token is not generating and giving the below error

<!doctype html><html lang="en"><head><title>HTTP Status 500 – Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 – Internal Server Error</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Request failed.</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><p><b>Exception</b></p><pre>jakarta.servlet.ServletException: java.lang.IllegalArgumentException: Input is expected to be encoded in multiple of 8 bytes but found: 6
	org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:409)
	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:357)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:311)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	org.apache.catalina.filters.ExpiresFilter.doFilter(ExpiresFilter.java:1192)
	io.antmedia.filter.IPFilter.doFilter(IPFilter.java:34)
	io.antmedia.filter.ContentSecurityPolicyHeaderFilter.doFilter(ContentSecurityPolicyHeaderFilter.java:32)
	io.antmedia.filter.JWTFilter.doFilter(JWTFilter.java:46)
	org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:331)
	org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:158)
	io.antmedia.filter.RestProxyFilter.doFilter(RestProxyFilter.java:134)
  1. The pattern is clear now and it worked via OBS after launching the server on cloud. I was having some issue in local environment.

@lastpeony
Copy link
Contributor Author

  1. The token issue comes when any user wants to add the subscriber in advance before creating a token. The use of adding a subscriber in advance is to restrict the undefined streams so only added subscribers would be able to publish the stream. The reproduce scenario is as follows:
  • Generate a secret key from the web panel by enabling TOTP for publish and play
  • Now use that secret key to add the subscriber using this API
  • After adding a subscriber, generate the TOTP token.

Expected behavior The token should be generated

Actual behavior The token is not generating and giving the below error

<!doctype html><html lang="en"><head><title>HTTP Status 500 – Internal Server Error</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 – Internal Server Error</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Request failed.</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><p><b>Exception</b></p><pre>jakarta.servlet.ServletException: java.lang.IllegalArgumentException: Input is expected to be encoded in multiple of 8 bytes but found: 6
	org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:409)
	org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:357)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:311)
	org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	org.apache.catalina.filters.ExpiresFilter.doFilter(ExpiresFilter.java:1192)
	io.antmedia.filter.IPFilter.doFilter(IPFilter.java:34)
	io.antmedia.filter.ContentSecurityPolicyHeaderFilter.doFilter(ContentSecurityPolicyHeaderFilter.java:32)
	io.antmedia.filter.JWTFilter.doFilter(JWTFilter.java:46)
	org.apache.catalina.filters.CorsFilter.handleNonCORS(CorsFilter.java:331)
	org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:158)
	io.antmedia.filter.RestProxyFilter.doFilter(RestProxyFilter.java:134)
  1. The pattern is clear now and it worked via OBS after launching the server on cloud. I was having some issue in local environment.

Please create a new issue on this

@yashtandon113
Copy link
Contributor

Here is the new issue: #5930

@burak-58 burak-58 moved this from 🏗 In progress to After sprint in Ant Media Server Dec 18, 2023
@burak-58 burak-58 assigned mekya and unassigned yashtandon113 Dec 25, 2023
@burak-58 burak-58 moved this from After sprint to 📋 Backlog in Ant Media Server Feb 26, 2024
@mekya
Copy link
Contributor

mekya commented May 6, 2024

Please let me know if any user request this feature and we can increase its priority to merge it faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants