| View previous topic :: View next topic |
| Author |
Message |
kai4711
Joined: 21 Nov 2007 Posts: 30
|
Posted: Sat May 24, 2008 8:40 pm Post subject: Extended listeners logging |
|
|
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 |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sun May 25, 2008 2:25 am Post subject: |
|
|
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 |
|
 |
kai4711
Joined: 21 Nov 2007 Posts: 30
|
Posted: Sun May 25, 2008 10:04 am Post subject: |
|
|
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 |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Sun May 25, 2008 12:05 pm Post subject: |
|
|
yes, auth could be based on any number of factors not just user/password.
karl. |
|
| Back to top |
|
 |
kaneza
Joined: 09 May 2008 Posts: 31
|
Posted: Tue Jun 03, 2008 8:53 am Post subject: |
|
|
| i would like to do the same type of loggin too... how to do this type of authentication? |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue Jun 03, 2008 1:47 pm Post subject: |
|
|
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 |
|
 |
kaneza
Joined: 09 May 2008 Posts: 31
|
Posted: Wed Jun 04, 2008 2:54 pm Post subject: |
|
|
| the problem is that my script seems not to catch the data and do like a database insert... |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Jun 04, 2008 6:16 pm Post subject: |
|
|
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 |
|
 |
kaneza
Joined: 09 May 2008 Posts: 31
|
Posted: Thu Jun 05, 2008 9:14 am Post subject: |
|
|
| 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 |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Jun 05, 2008 10:49 am Post subject: |
|
|
Who says you need to supply a username and password?
karl. |
|
| Back to top |
|
 |
kaneza
Joined: 09 May 2008 Posts: 31
|
Posted: Thu Jun 05, 2008 12:49 pm Post subject: |
|
|
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 |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Jun 05, 2008 1:36 pm Post subject: |
|
|
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 |
|
 |
kaneza
Joined: 09 May 2008 Posts: 31
|
Posted: Thu Jun 05, 2008 1:47 pm Post subject: |
|
|
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 |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Jun 05, 2008 2:07 pm Post subject: |
|
|
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 |
|
 |
kaneza
Joined: 09 May 2008 Posts: 31
|
Posted: Thu Jun 05, 2008 2:14 pm Post subject: |
|
|
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 |
|
 |
|