Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Extended listeners logging
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
kai4711



Joined: 21 Nov 2007
Posts: 30

PostPosted: Sat May 24, 2008 8:40 pm    Post subject: Extended listeners logging Reply with quote

Hi guys, hi Karl,

to have a more detailed overview to the listeners i want to create some "session" based listener-logging.

I want to log into a mysql database something like time, client, ip.

I saw on-connect and on-disconnect but i dont think that this would help because it doesnt say something about ip etc....

Do you have ideas?

Thank you in advance,
Kai
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun May 25, 2008 2:25 am    Post subject: Reply with quote

the on-connect type scripts will only apply to the source not listeners, you'll want to use url based auth for that sort of logging.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kai4711



Joined: 21 Nov 2007
Posts: 30

PostPosted: Sun May 25, 2008 10:04 am    Post subject: Reply with quote

cool, looks nice...

But is it possible to use it without asking the listeners for user/password (because i have a really public stream).

Thanks
Kai
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun May 25, 2008 12:05 pm    Post subject: Reply with quote

yes, auth could be based on any number of factors not just user/password.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kaneza



Joined: 09 May 2008
Posts: 31

PostPosted: Tue Jun 03, 2008 8:53 am    Post subject: Reply with quote

i would like to do the same type of loggin too... how to do this type of authentication?
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Tue Jun 03, 2008 1:47 pm    Post subject: Reply with quote

Just look for listener_add, listener_remove in the options for authentication url. Then write the web script to do whatever you want them to do.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kaneza



Joined: 09 May 2008
Posts: 31

PostPosted: Wed Jun 04, 2008 2:54 pm    Post subject: Reply with quote

the problem is that my script seems not to catch the data and do like a database insert...
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Wed Jun 04, 2008 6:16 pm    Post subject: Reply with quote

If you are saying it's not working then you have to report specifics. If you give little information then answers will not be forthcoming. Your last could mean the script is not being run or that the script is broken.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kaneza



Joined: 09 May 2008
Posts: 31

PostPosted: Thu Jun 05, 2008 9:14 am    Post subject: Reply with quote

here is the point, i want to authenticate users without askinh them a login/password in order to have mt statistics using the listener_add listener_remove i dont want a listener to put in any username or password just the script record the users info and then athorise the user to listening by sending back the header info.
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Thu Jun 05, 2008 10:49 am    Post subject: Reply with quote

Who says you need to supply a username and password?

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kaneza



Joined: 09 May 2008
Posts: 31

PostPosted: Thu Jun 05, 2008 12:49 pm    Post subject: Reply with quote

here is my mount point configuration:

<mount>
<mount-name>/live</mount-name>
<authentication type="url">
<option name="listener_add" value="http://mydomain.com/connect.php"/>
<option name="listener_remove" value="http://mydomain.com/disconnect.php"/>
<option name="auth_header" value="icecast-auth-user: 1"/>
</authentication>
</mount>


here is the connect.php file


<?
include("config.php");

$action = $_POST['action'];
$server = $_POST['server'];
$port = $_POST['action'];
$client = $_POST['client'];
$mount = $_POST['mount'];
$ip = $_POST['ip'];
$agent = $_POST['agent'];
$duration = $_REQUEST['duration'];

$sql = mysql_query("insert ...") or die (mysql_error());
header('icecast-auth-user: 1');
header('icecast-auth-message: OK');
?>

what might be wrong?
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Thu Jun 05, 2008 1:36 pm    Post subject: Reply with quote

are sure it's being run?, does icecast report the script being called?, what happens when a user connects on /live. If it is being run then what part of the script is failing, I can see port being wrong and duration won't appear for listener_add

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kaneza



Joined: 09 May 2008
Posts: 31

PostPosted: Thu Jun 05, 2008 1:47 pm    Post subject: Reply with quote

here is what i get in access.log

127.0.0.1 - admin [05/Jun/2008:15:43:11 +0200] "GET /live HTTP/1.0" 401 115 "-" "WinampMPEG/5.53" 1


error.log


[2008-06-05 15:45:49] INFO auth_url/url_add_client client auth (http://mydomain.com/connect.php) failed with ""
[2008-06-05 15:45:49] DBUG fserve/fserve_add_client Adding client to file serving engine
[2008-06-05 15:45:49] DBUG stats/modify_node_event update node clients (1)
[2008-06-05 15:45:51] DBUG stats/modify_node_event update node clients (2)
[2008-06-05 15:45:51] DBUG stats/modify_node_event update node connections (43)
[2008-06-05 15:45:51] INFO auth/add_client adding client for authentication
[2008-06-05 15:45:51] INFO auth_url/url_add_client client auth (http://mydomain.com/connect.php) failed with ""
[2008-06-05 15:45:51] DBUG fserve/fserve_add_client Adding client to file serving engine
[2008-06-05 15:45:51] DBUG stats/modify_node_event update node client_connections (33)
[2008-06-05 15:45:51] DBUG stats/modify_node_event update node clients (1)
[2008-06-05 15:45:53] DBUG stats/modify_node_event update node total_bytes_read (629912)
[2008-06-05 15:45:53] DBUG stats/modify_node_event update node total_bytes_sent (0)
[2008-06-05 15:45:58] DBUG stats/modify_node_event update node total_bytes_read (639800)
[2008-06-05 15:45:58] DBUG stats/modify_node_event update node total_bytes_sent (0)
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Thu Jun 05, 2008 2:07 pm    Post subject: Reply with quote

so the script is being called and you get this on the response

[2008-06-05 15:45:51] INFO auth_url/url_add_client client auth (http://mydomain.com/connect.php) failed with ""

You see "" because you don't send back the icecast-auth-message on failure only on success (which is just waste really but not invalid). So based on the snippet you posted it looks like the call to do the insert query returned a zero or false.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kaneza



Joined: 09 May 2008
Posts: 31

PostPosted: Thu Jun 05, 2008 2:14 pm    Post subject: Reply with quote

so i am being asked to proved username / password because i am not returning the icecast auth header?
this is the php header

header("icecast-auth-user: 1");

it is supposed to answer back correctly.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber