<commit_before><?php
/*
 * HOMER Web Interface
 * Homer's SipResult class
 *
 * Copyright (C) 2011-2012 <NAME> <<EMAIL>>
 * Copyright (C) 2011-2012 <NAME> <<EMAIL>>
 *
 * The Initial Developers of the Original Code are
 *
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
*/

class SipResult
{
  private $id;
  private $date;
  private $micro_ts;
  private $method;
  private $reply_reason;
  private $ruri;
  private $ruri_user;
  private $from_user;
  private $from_tag;
  private $to_user;
  private $to_tag;
  private $pid_user;
  private $contact_user;
  private $auth_user;
  private $callid;
  private $callid_aleg;
  private $via_1;
  private $via_1_branch;
  private $cseq;
  private $diversion;
  private $reason;
//  private $contenttype;
  private $authorization;
  private $user_agent;
  private $source_ip;
  private $source_port;
  private $destination_ip;
  private $destination_port;
  private $contact_ip;
  private $contact_port;
  private $originator_ip;
  private $originator_port;
  private $proto;
  private $family;
  private $type;
  private $node;  
  private $callidtag;  
  private $rtp_stat;  

  private $loctable;
  private $tnode;
  private $location;
  private $unique = 0;
  

  public function __construct($data, $location)
  {

	foreach($data as $key=>$value) {
	      if(property_exists('SipResult',$key)) $this->$key = $value;
	}
		
	$this->location = $location;
  }

  public function getID()
  {
      return $this->id;
  }
  
  public function getCheckbox()
  {
      return "<input style='input' type='checkbox' id='cb".$this->id."' name='cid[]' value='". substr($this->micro_ts,0,-2)."' onclick='checkboxEvent(this.value, this.id);' />";
  }

  public function getDate()
  {
      //Corellation for 3000 nanoseconds
      //if($row->tnode == 2) (int) $row->micro_ts - (int) 4000;
      $seconds = intval($this->micro_ts / 1000000);  //4
      $ms = $this->micro_ts - ($seconds*1000000); //4      
      //return date("H:i:s", strtotime($this->date));  
      return date("H:i:s", $seconds).".".$ms;
      //return $this->date;
  }
  
  public function getMicroTs()
  {
     return $this->micro_ts;
     //return substr($this->micro_ts, -9);
  }
  
   public function getMethod()
  {

      if(!defined('MESSAGE_POPUP')) $popuptype = 1;
      else $popuptype = MESSAGE_POPUP;

      $fd = date("Y-m-d", strtotime($this->date));
      $ft = date("H:i:s", strtotime($this->date));

      $url = "utils.php?task=sipmessage&id=".$this->id."&popuptype=".$popuptype;
      $url .= "&from_time=".$ft."&from_date=".$fd;
      
      $rtpinfo = "";
      if(preg_match('/=/',$this->rtp_stat)) $rtpinfo = " <b>(R)</b>";     
      return "<a href=\"javascript:popMessage2(".$popuptype.",'".$this->id."','".$url."');\">".$this->method."</a>".$rtpinfo;
  }

  public function getReplyReason()
  {
      return $this->reply_reason;
  }
  
  public function getRuri()
  {
      return $this->ruri;
  }
  
  public function getRuriUser()
  {
      return $this->ruri_user;
  }
  
  public function getFromUser()
  {
      return $this->from_user;
  }  
  
  public function getFromTag()
  {
      return $this->from_tag;
  }  

  public function getToUser()
  {
      return $this->to_user;
  }
  
  public function getToTag()
  {
      return $this->to_tag;
  }
  
  public function getPidUser()
  {
      return $this->pid_user;
  }
 
  public function getContactUser()
  {
      return $this->contact_user;
  }

  public function getAuthUser()
  {
      return $this->auth_user;
  }

  public function getCallId()
  {

   $search = json_decode($_SESSION['homersearch']);
   if(!defined('CFLOW_POPUP')) $popuptype = 1;
   else $popuptype = CFLOW_POPUP;
      
   $fd = date("Y-m-d", strtotime($search->from_date));
   $td = date("Y-m-d", strtotime($search->to_date));   
   $url = "cflow.php?cid=".$this->callid;
   $url .= "&from_time=".$search->from_time."&to_time=".$search->to_time."&from_date=".$fd."&to_date=".$td;
   $url .= "&callid_aleg=".$search->b2b."&popuptype=".$popuptype;


   return "<a alt='callflow' href=\"javascript:showCallFlow2($popuptype, '".$this->callid."','".$url."');\">".$this->callid."</a>";<commit_msg>added tnode for method and location for cflow.<commit_after><?php
/*
 * HOMER Web Interface
 * Homer's SipResult class
 *
 * Copyright (C) 2011-2012 <NAME> <<EMAIL>>
 * Copyright (C) 2011-2012 <NAME> <<EMAIL>>
 *
 * The Initial Developers of the Original Code are
 *
 * <NAME> <<EMAIL>>
 * <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
*/

class SipResult
{
  private $id;
  private $date;
  private $micro_ts;
  private $method;
  private $reply_reason;
  private $ruri;
  private $ruri_user;
  private $from_user;
  private $from_tag;
  private $to_user;
  private $to_tag;
  private $pid_user;
  private $contact_user;
  private $auth_user;
  private $callid;
  private $callid_aleg;
  private $via_1;
  private $via_1_branch;
  private $cseq;
  private $diversion;
  private $reason;
//  private $contenttype;
  private $authorization;
  private $user_agent;
  private $source_ip;
  private $source_port;
  private $destination_ip;
  private $destination_port;
  private $contact_ip;
  private $contact_port;
  private $originator_ip;
  private $originator_port;
  private $proto;
  private $family;
  private $type;
  private $node;  
  private $callidtag;  
  private $rtp_stat;  

  private $loctable;
  private $tnode;
  private $location;
  private $unique = 0;
  

  public function __construct($data, $location)
  {

	foreach($data as $key=>$value) {
	      if(property_exists('SipResult',$key)) $this->$key = $value;
	}
		
	$this->location = $location;
  }

  public function getID()
  {
      return $this->id;
  }
  
  public function getCheckbox()
  {
      return "<input style='input' type='checkbox' id='cb".$this->id."' name='cid[]' value='". substr($this->micro_ts,0,-2)."' onclick='checkboxEvent(this.value, this.id);' />";
  }

  public function getDate()
  {
      //Corellation for 3000 nanoseconds
      //if($row->tnode == 2) (int) $row->micro_ts - (int) 4000;
      $seconds = intval($this->micro_ts / 1000000);  //4
      $ms = $this->micro_ts - ($seconds*1000000); //4      
      //return date("H:i:s", strtotime($this->date));  
      return date("H:i:s", $seconds).".".$ms;
      //return $this->date;
  }
  
  public function getMicroTs()
  {
     return $this->micro_ts;
     //return substr($this->micro_ts, -9);
  }
  
   public function getMethod()
  {

      if(!defined('MESSAGE_POPUP')) $popuptype = 1;
      else $popuptype = MESSAGE_POPUP;

      $fd = date("Y-m-d", strtotime($this->date));
      $ft = date("H:i:s", strtotime($this->date));

      $url = "utils.php?task=sipmessage&id=".$this->id."&popuptype=".$popuptype;
      $url .= "&from_time=".$ft."&from_date=".$fd."&tnode=".$this->tnode;
      
      $rtpinfo = "";
      if(preg_match('/=/',$this->rtp_stat)) $rtpinfo = " <b>(R)</b>";     
      return "<a href=\"javascript:popMessage2(".$popuptype.",'".$this->id."','".$url."');\">".$this->method."</a>".$rtpinfo;
  }

  public function getReplyReason()
  {
      return $this->reply_reason;
  }
  
  public function getRuri()
  {
      return $this->ruri;
  }
  
  public function getRuriUser()
  {
      return $this->ruri_user;
  }
  
  public function getFromUser()
  {
      return $this->from_user;
  }  
  
  public function getFromTag()
  {
      return $this->from_tag;
  }  

  public function getToUser()
  {
      return $this->to_user;
  }
  
  public function getToTag()
  {
      return $this->to_tag;
  }
  
  public function getPidUser()
  {
      return $this->pid_user;
  }
 
  public function getContactUser()
  {
      return $this->contact_user;
  }

  public function getAuthUser()
  {
      return $this->auth_user;
  }

  public function getCallId()
  {

   $search = json_decode($_SESSION['homersearch']);
   if(!defined('CFLOW_POPUP')) $popuptype = 1;
   else $popuptype = CFLOW_POPUP;
      
   $fd = date("Y-m-d", strtotime($search->from_date));
   $td = date("Y-m-d", strtotime($search->to_date));   
   $url = "cflow.php?cid=".$this->callid;
   $url .= "&from_time=".$search->from_time."&to_time=".$search->to_time."&from_date=".$fd."&to_date=".$td;
   $url .= "&callid_aleg=".$search->b2b."&popuptype=".$popuptype."&location[]=".implode("&location[]=", $search->location);


   return "<a alt='callflow' href=\"javascript:showCallFlow2($popuptype, '".$this->callid."','".$url."');\">".$this->callid."</a>";
{'fraction_non_alphanumeric': 0.16298398540441922, 'fraction_numerical': 0.01297384958443138, 'mean_word_length': 3.297473867595819, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 119, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2095194', 'n_tokens_mistral': 3582, 'n_tokens_neox': 3430, 'n_words': 807}