[Updated php scripts to work with latest mediaproxy statistics ag@ag-projects.com**20081205145702] { move ./web/config/phone_images.php ./web/phone_images.php hunk ./web/config/media_sessions.conf.sample 4 + +# Optional access list of domains for which sessions are displayed +# $allowedDomains = array('example.com','customer.com'); + hunk ./web/library/media_sessions.php 3 + hunk ./web/library/media_sessions.php 10 - var $dispatcher_port = 25061; + var $dispatcher_port = 25061; hunk ./web/library/media_sessions.php 15 - function MediaSessions ($dispatcher='',$filters=array(),$allowedDomains=array()) { + function MediaSessions ($dispatcher='',$allowedDomains=array(),$filters=array()) { + + if (!strlen($dispatcher)) return false; hunk ./web/library/media_sessions.php 19 - global $userAgentImages; - require("config/phone_images.php"); + global $userAgentImages; + require_once("phone_images.php"); + $this->userAgentImages = $userAgentImages; hunk ./web/library/media_sessions.php 26 - $this->userAgentImages = $userAgentImages; - - if (!strlen($dispatcher)) return false; - hunk ./web/library/media_sessions.php 32 - return $this->getSessions($this->dispatcher_ip,$this->dispatcher_port); + return $this->getSessions(); hunk ./web/library/media_sessions.php 42 + printf ("
Connected to MediaProxy2 dispatcher %s:%s",$this->dispatcher_ip, $this->dispatcher_port);
hunk ./web/library/media_sessions.php 46
-
- while (!feof($fp)) {
- $line = fgets($fp);
-
- if (preg_match("/^\r\n/",$line)) {
- break;
- }
-
- $this->relays[] = json_decode($line);
- }
- }
+ $line = fgets($fp);
+ $this->relays = json_decode($line);
+ }
hunk ./web/library/media_sessions.php 51
+ $line = fgets($fp);
hunk ./web/library/media_sessions.php 53
- while (!feof($fp)) {
- $line = fgets($fp);
-
- $this->sessions_json[] = $line;
-
- if (preg_match("/^\r\n/",$line)) {
- break;
- }
+ $_sessions=json_decode($line);
hunk ./web/library/media_sessions.php 55
- $line=json_decode($line);
-
- if (count($this->allowedDomains)) {
- list($user1,$domain1)=explode("@",$line->from_uri);
- list($user2,$domain2)=explode("@",$line->to_uri);
+ if (count($this->allowedDomains)) {
+ foreach ($_sessions as $_session) {
+ list($user1,$domain1)=explode("@",$_session->from_uri);
+ list($user2,$domain2)=explode("@",$_session->to_uri);
hunk ./web/library/media_sessions.php 62
- }
hunk ./web/library/media_sessions.php 63
- if (strlen($this->filters['user'])) {
- $user=$this->filters['user'];
- if (preg_match("/$user/",$line->from_uri) ||
- preg_match("/$user/",$line->to_uri)
- ) {
- $this->sessions[] = $line;
+ if (strlen($this->filters['user'])) {
+ $user=$this->filters['user'];
+ if (preg_match("/$user/",$_session->from_uri) ||
+ preg_match("/$user/",$_session->to_uri)
+ ) {
+ $this->sessions[] = $_session;
+ }
hunk ./web/library/media_sessions.php 71
-
- } else {
- $this->sessions[] = $line;
hunk ./web/library/media_sessions.php 72
-
+ } else {
+ $this->sessions = $_sessions;
hunk ./web/library/media_sessions.php 76
- fclose($fp);
+
+ fclose($fp);
hunk ./web/library/media_sessions.php 87
+ if (!count($this->sessions)) return;
hunk ./web/library/media_sessions.php 158
- print "
";
- print "
-