ant-media / Ant-Media-Server

Ant Media Server is a live streaming engine software that provides adaptive, ultra low latency streaming by using WebRTC technology with ~0.5 seconds latency. Ant Media Server is auto-scalable and it can run on-premise or on-cloud.
https://antmedia.io
Other
4.27k stars 628 forks source link

webhookAuthenticateURL does not work #4058

Closed tuliofaria closed 2 years ago

tuliofaria commented 2 years ago

Short description

I´m trying to use webhookAuthenticateURL and following https://github.com/ant-media/Ant-Media-Server/wiki/Webhook-Authentication-for-Publishing-Streams but, even with the URL set, I didnt receive any request on https://webhook.site/.

Checking the logs, it only appears nullpointer exception in line 59 of this file: https://github.com/ant-media/Ant-Media-Server/blob/master/src/main/java/io/antmedia/security/AcceptOnlyStreamsWithWebhook.java#L59

I´m using OBS to test and tried to send everything. Custom query params, such ?test=value but the error is the same.

Environment

mekya commented 2 years ago

Thank you @tuliofaria ,

Let us take a look at your case

yashtandon113 commented 2 years ago

Hi @tuliofaria Thanks for reporting this issue. I have checked in our test environment and able to reproduce the issue, it works fine with WebRTC stream but RTMP stream does not publish with webhookAuthenticateURL.

2022-03-27 20:13:58,425 [RTMPConnectionExecutor-1] ERROR i.a.s.AcceptOnlyStreamsWithWebhook - Couldn't connect Webhook for Stream Authentication java.lang.NullPointerException at io.antmedia.security.AcceptOnlyStreamsWithWebhook.isPublishAllowed(AcceptOnlyStreamsWithWebhook.java:59) at org.red5.server.stream.StreamService.publish(StreamService.java:669) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:189) at org.red5.server.net.rtmp.RTMPHandler.invokeCall(RTMPHandler.java:213) at org.red5.server.net.rtmp.RTMPHandler.onCommand(RTMPHandler.java:309) at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:115) at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:72) at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:38) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

2022-03-27 20:13:58,425 [RTMPConnectionExecutor-1] INFO i.a.e.webrtc.WebRTCApplication - W3C x-category:session x-event:disconnect c-ip:103.87.56.123 c-client-id:0 2022-03-27 20:13:58,426 [RTMPConnectionExecutor-1] INFO o.r.s.net.rtmp.RTMPMinaConnection - Connection is closed: 0M8RUSHDK6WPF 2022-03-27 20:13:58,427 [RTMPConnectionExecutor-1] ERROR o.red5.server.stream.StreamService - You are not allowed to publish the stream stream

tuliofaria commented 2 years ago

Nice @yashtandon113 ! Is there any docs to start contributing to the project? I was trying to set a local environment to investigate this - but it was confusing to me (it´s been a long time I don´t have a local env for java 😓 ).

mekya commented 2 years ago

Hi @tuliofaria ,

Thank you for investigating the contribution. It's very kind of you.

You can just send PR to the master branch. On the other hand, we're preparing contribution guide https://resources.antmedia.io/docs/contribution-how-to?highlight=Contribution

You can build the project with this documentation -> https://resources.antmedia.io/docs/building-ams-from-source

Please let me know if we can help further for your contribution