AzuraCast / AzuraCast

A self-hosted web radio management suite, including turnkey installer tools for the full radio software stack and a modern, easy-to-use web app to manage your stations.
https://www.azuracast.com/
GNU Affero General Public License v3.0
3.08k stars 569 forks source link

Live Stream issues #412

Closed replayfactory closed 6 years ago

replayfactory commented 6 years ago

Hi there, I'm currently testing live stream connection and it looks like there is some issues :

Blank Fallback Radio does not falling back to autoDJ if blank live stream is detected. Falling back works only if client disconnect.

[dummy:3] Source failed (no more tracks) stopping output... [fallback_5953:3] Switch to audio_to_stereo_5949 with transition. [fallback_5953:3] Switch to blank_5952 with forgetful transition. [dummy:3] Source failed (no more tracks) stopping output... [fallback_5953:3] Switch to audio_to_stereo_5949 with transition. [fallback_5953:3] Switch to blank_5952 with forgetful transition.

Connection issue Some software (in particular Traktor) have problems connecting to the icecast server due to their credential format. Traktor has no "username" field and as a workaround I used username and password separated by a semicolon (username;password) in the "password" field. This worked on my previous radio setup (only icecast2 and liquidsoap without azuracast) but I'm not sure if it is an azuracast or liquidsoap issue.

Logs returns : AzuraCast DJ Auth Response: {"type":"App\\Exception\\PermissionDenied","code":0,"message":""}

API now_playing / is_live flag could be long to be updated after live stream is disconnected. This is mostly because I'm playing electronic music and track could be 10' long, but this is really a minor issue.

Many thanks for your great work ! Cheers

BusterNeece commented 6 years ago

@replayfactory For the first issue, I'll have to look into that, but that might just be a design side-effect from the way we have to handle live broadcasters in order for the "is_live" feature to work correctly.

For the connection issue...try doing a station rebuild/reboot (Utilities > Restart Broadcasting) and see if the logs still return that. Usually it means that, for whatever reason, the internal API authentication key used by LiquidSoap has gone out of sync with the one expected by AzuraCast.

Also, if you only have one credentials field, separating the two by a colon should work, a-la Shoutcast authentication.

replayfactory commented 6 years ago

I tried to restart broadcasting services and reboot server without luck. I noticed that logs always return 'source' as username

Test with colon (usertest:password) on Traktor software returns : Authenticating DJ: source AzuraCast DJ Auth Response: false

Test with semicolon (usertest;password) on Traktor software returns : Authenticating DJ: source AzuraCast DJ Auth Response: {"type":"App\\Exception\\PermissionDenied","code":0,"message":""}

Test with Mixxx software works just fine

BusterNeece commented 6 years ago

@replayfactory I think the semicolon may be failing on account of it thinking it's the beginning of a new query string parameter, so I wouldn't recommend using that in general.

I've expanded the way that the DJ authentication accepts the joined user:pass login format, so Traktor should be working fine.

replayfactory commented 6 years ago

I've just updated azuracast and checked that your commit has been correctly installed. The logs still returns the same error. If you dont have traktor, maybe I could help debugging (I'm a web developer). Just tell me wich function you use to print logs

BusterNeece commented 6 years ago

@replayfactory If you want to take a crack at it and see what's up, the relevant code is:

https://github.com/AzuraCast/AzuraCast/blob/049df758268f3eef1e0edf87401ec62c1b19256a/app/src/Controller/Api/InternalController.php#L56

Whatever that returns is what will display in "AzuraCast raw response" in the logs.

replayfactory commented 6 years ago

After some tests, $pass variable seems to be altered by a previous function. Some characters ( : ; ) cannot be used in passwords and others ( | ) needs to be escaped

Assuming the folowing code for debug :

public function authAction(Request $request, Response $response): Response {
    ...
    $user = $request->getParam('dj_user');
    $pass = $request->getParam('dj_password');
    error_log("Output : ".$pass."\n", 3, DEBUG_LOG_FILE);
    ...
}

if $dj_password = "user:pass" -> Output : user if $dj_password = "user;pass" -> Output : if $dj_password = "user|pass" -> Output : if $dj_password = "user\|pass" -> Output : user|pass if $dj_password = "user,pass" -> Output : user,pass

Using a comma as separator seems to be a good alternative.

if (strpos($pass, ',') !== false) {
    list($user, $pass) = explode(',', $pass);
}
BusterNeece commented 6 years ago

@replayfactory Finally had a chance to get back to testing this out locally, and sure enough, there's something about the Icecast DJ authentication that's stripping out parts of passwords separated with some delimiters.

Since I have no idea what part of the process is triggering that, and since Shoutcast appears to automatically split the username:password before the authentication ever reaches the web app, adding support for comma separation of credentials should have no unexpected side effects.

The latest commit adds the comma support exactly as you listed above. Local tests show it works just fine. Let me know if it works so we can get this issue closed out.

replayfactory commented 6 years ago

@SlvrEagle23 I've tested with different softwares and it's just work fine. Thanks !

martynjsimpson commented 3 years ago

I know this has been a long time closed but having spent the best part of 3 hours working on this I thought it good to share.

If using Traktor with AzureCast, separating the credentials with a ":" character just doesn't work. Something internal to Traktor is messing up the Authorization header value. You instead need to use the "," character to separate the username and password.

@SlvrEagle23 would it be a good idea to add a comment to the Streamer/ DJ "Connection information" pane that the separator can be either a ":" or a "," for the password field?

BusterNeece commented 3 years ago

@martynjsimpson Noted; in the latest rolling release I've added the comma-separated option to the sidebar.