[Refactored history page Tijmen de Mes **20221118083228 Ignore-this: 421dee3c3f605a774bf48f50e6be5a72 ] hunk ./library/sip_settings.php 5871 - function showCallsTab() { - + public function showCallsTab() + { hunk ./library/sip_settings.php 5876 - $chapter=sprintf(_("Call Statistics")); + $chapter = sprintf(_("Call Statistics")); hunk ./library/sip_settings.php 5879 - $calltime=normalizeTime($this->duration); + $calltime = normalizeTime($this->duration); hunk ./library/sip_settings.php 5915 - $cdr_source = 'sipthor'; + $cdr_source = 'sipthor'; hunk ./library/sip_settings.php 5917 - $cdr_source = 'sip_trace'; + $cdr_source = 'sip_trace'; hunk ./library/sip_settings.php 5921 - $chapter=sprintf(_("Incoming")); + $chapter = sprintf(_("Incoming")); hunk ./library/sip_settings.php 5924 - $j=0; hunk ./library/sip_settings.php 5925 - foreach (array_keys($this->calls_received) as $call) { - $j++; - - $uri = $this->calls_received[$call]['remoteParty']; - $media=""; - foreach ($this->calls_received[$call]['media'] as $m) { - $media.="$m,"; + foreach ($this->calls_received as $item => $call) { + $uri = $call['remoteParty']; + $media = ""; + foreach ($call['media'] as $m) { + $media .= "$m,"; hunk ./library/sip_settings.php 5931 - $media=quoted_printable_decode($media); - $media=rtrim($media,","); + $media = quoted_printable_decode($media); + $media = rtrim($media, ","); hunk ./library/sip_settings.php 5940 - $sessionId = urlencode($this->calls_received[$call]['sessionId']); - $fromTag = urlencode($this->calls_received[$call]['fromTag']); - $toTag = urlencode($this->calls_received[$call]['toTag']); - $proxyIP = urlencode($this->calls_received[$call]['proxyIP']); - $trace_link = "Server Logs"; - - if (!$this->calls_received[$call]['duration']) { + $phonebookQuery = array( + 'tab' => 'contacts', + 'task' => 'add', + 'uri' => $urlURI, + 'search_text' => $urlURI, + ); + + $traceQuery = array( + 'cdr_source' => $cdr_source, + 'callid' => $call['sessionId'], + 'fromtag' => $call['fromTag'], + 'totag' => $call['toTag'], + 'proxyIP' => $call['proxyIP'] + ); + + $traceLink = sprintf( + " + Server Logs", + http_build_query($traceQuery) + ); + + if (!$call['duration']) { hunk ./library/sip_settings.php 5965 - $rr=floor($j/2); - $mod=$j-$rr*2; + $rr = floor($item / 2); + $mod = $item - $rr * 2; hunk ./library/sip_settings.php 5969 - $_class='odd'; + $_class = 'odd'; hunk ./library/sip_settings.php 5971 - $_class='even'; + $_class = 'even'; hunk ./library/sip_settings.php 5973 - - print " - - $htmlDate - $dialURI - $duration - $htmlURI ($media) - "; - print "$trace_link"; - print "url&tab=contacts&task=add&uri=$urlURI&search_text=$urlURI>$this->phonebook_img"; - print " - - "; + printf( + " + + %s + %s + %s + %s (%s) + %s + %s + + ", + $_class, + $htmlDate, + $dialURI, + $duration, + $htmlURI, + $media, + $traceLink, + $this->url, + $phonebookQuery, + $this->phonebook_img + ); hunk ./library/sip_settings.php 5996 - print ""; + print(""); hunk ./library/sip_settings.php 6000 - $chapter=sprintf(_("Outgoing")); + $chapter = sprintf(_("Outgoing")); hunk ./library/sip_settings.php 6003 - $j=0; - hunk ./library/sip_settings.php 6004 - foreach (array_keys($this->calls_placed) as $call) { - $j++; - - if ($this->calls_placed[$call]['to'] == "sip:".$this->voicemail['Account'] ) { + foreach ($this->calls_placed as $item => $call) { + if ($call['to'] == "sip:".$this->voicemail['Account']) { hunk ./library/sip_settings.php 6009 - $uri = $this->calls_placed[$call]['remoteParty']; + $uri = $call['remoteParty']; hunk ./library/sip_settings.php 6011 - foreach ($this->calls_placed[$call]['media'] as $m) { - $media.="$m,"; + foreach ($call['media'] as $m) { + $media .= "$m,"; hunk ./library/sip_settings.php 6014 - $media=rtrim($media,","); - $price = $this->calls_placed[$call]['price']; - $status = $this->calls_placed[$call]['status']; - $rateinfo = $this->calls_placed[$call]['rateInfo']; - $duration = normalizeTime($this->calls_placed[$call]['duration']); + $media = rtrim($media, ","); + + $price = $call['price']; + $status = $call['status']; + $rateinfo = $call['rateInfo']; + $duration = normalizeTime($call['duration']); hunk ./library/sip_settings.php 6021 - $htmlDate = $this->colorizeDate($this->calls_placed[$call]['startTime']); - $stopTime = $this->calls_placed[$call]['stopTime']; + $htmlDate = $this->colorizeDate($call['startTime']); + $stopTime = $call['stopTime']; hunk ./library/sip_settings.php 6026 - $sessionId = urlencode($this->calls_placed[$call]['sessionId']); - $fromTag = urlencode($this->calls_placed[$call]['fromTag']); - $toTag = urlencode($this->calls_placed[$call]['toTag']); - $proxyIP = urlencode($this->calls_placed[$call]['proxyIP']); - $trace_link = "Server Logs"; + $phonebookQuery = array( + 'tab' => 'contacts', + 'task' => 'add', + 'uri' => $urlURI, + 'search_text' => $urlURI, + ); + + $traceQuery = array( + 'cdr_source' => $cdr_source, + 'callid' => $call['sessionId'], + 'fromtag' => $call['fromTag'], + 'totag' => $call['toTag'], + 'proxyIP' => $call['proxyIP'] + ); + + $traceLink = sprintf( + " + Server Logs", + http_build_query($traceQuery) + ); hunk ./library/sip_settings.php 6048 - $price_print =sprintf(" (%s %s)",$price,$this->currency); + $pricePrint = sprintf(" (%s %s)", $price, $this->currency); hunk ./library/sip_settings.php 6050 - $price_print = ''; + $pricePrint = ''; hunk ./library/sip_settings.php 6053 - $rr=floor($j/2); - $mod=$j-$rr*2; + $rr = floor($item / 2); + $mod = $item - $rr * 2; hunk ./library/sip_settings.php 6056 - if ($mod ==0) { - $_class='odd'; + if ($mod == 0) { + $_class = 'odd'; hunk ./library/sip_settings.php 6059 - $_class='even'; + $_class = 'even'; hunk ./library/sip_settings.php 6061 + hunk ./library/sip_settings.php 6066 - print " - - $htmlDate - $dialURI - $duration - $htmlURI ($media) $price_print - "; - - print "$trace_link"; - print "url&tab=contacts&task=add&uri=$urlURI&search_text=$urlURI>$this->phonebook_img"; - print " - - "; + printf( + " + + %s + %s + %s + %s (%s) %s + %s + %s + + ", + $_class, + $htmlDate, + $dialURI, + $duration, + $htmlURI, + $media, + $pricePrint, + $traceLink, + $this->url, + $phonebookQuery, + $this->phonebook_img + ); hunk ./library/sip_settings.php 6092 - hunk ./library/sip_settings.php 6094 - function getHistory($status = 'all') + private function getHistory($status = 'all') hunk ./library/sip_settings.php 6195 - function getCallStatistics() + private function getCallStatistics()