@@ -159,16 +159,16 @@ discard block |
||
159 | 159 | $dataVariable['call_direction'] = "inbound"; |
160 | 160 | $dataVariable['calltype'] = "DID"; |
161 | 161 | |
162 | - //Override variables if call for DID PSTN |
|
163 | - if(isset($dataVariable['caller_did_account_id'])) |
|
164 | - { |
|
165 | - $dataVariable['receiver_accid'] = $dataVariable['caller_did_account_id']; |
|
166 | - $dataVariable['call_direction'] = "outbound"; |
|
167 | - $dataVariable['calltype'] = "STANDARD"; |
|
168 | - $dataVariable['effective_destination_number']=$dataVariable['sip_to_user']; |
|
169 | - unset($termination_rate); |
|
170 | - unset($provider_cost); |
|
171 | - } |
|
162 | + //Override variables if call for DID PSTN |
|
163 | + if(isset($dataVariable['caller_did_account_id'])) |
|
164 | + { |
|
165 | + $dataVariable['receiver_accid'] = $dataVariable['caller_did_account_id']; |
|
166 | + $dataVariable['call_direction'] = "outbound"; |
|
167 | + $dataVariable['calltype'] = "STANDARD"; |
|
168 | + $dataVariable['effective_destination_number']=$dataVariable['sip_to_user']; |
|
169 | + unset($termination_rate); |
|
170 | + unset($provider_cost); |
|
171 | + } |
|
172 | 172 | |
173 | 173 | |
174 | 174 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | //Generate CDR string for insert query for reseller |
317 | 317 | function get_reseller_cdr_string($dataVariable,$accountid,$account_type,$actual_duration,$termination_rate,$origination_rate,$provider_cost,$parentid,$debit,$cost) |
318 | 318 | { |
319 | - $dataVariable['calltype'] = ($dataVariable['calltype'] == 'DID-LOCAL' || $dataVariable['calltype'] == 'SIP-DID' || $dataVariable['calltype'] == 'OTHER')?"DID":$dataVariable['calltype']; |
|
319 | + $dataVariable['calltype'] = ($dataVariable['calltype'] == 'DID-LOCAL' || $dataVariable['calltype'] == 'SIP-DID' || $dataVariable['calltype'] == 'OTHER')?"DID":$dataVariable['calltype']; |
|
320 | 320 | $callerIdNumber = isset($dataVariable['effective_caller_id_number']) && !empty($dataVariable['effective_caller_id_number'])? $dataVariable['effective_caller_id_number'] :$dataVariable['caller_id']; |
321 | 321 | |
322 | 322 | return $cdr_string = "'".($dataVariable['uuid'])."','".$accountid."','".(urldecode($callerIdNumber))."','".($dataVariable['effective_destination_number'])."','".$actual_duration."','".($dataVariable['hangup_cause'])."','".convert_to_gmt(urldecode($dataVariable['callstart']))."','".$debit."','".$cost."','".$origination_rate[$accountid]['RATEGROUP']."','".$dataVariable['package_id']."','".($origination_rate[$accountid]['CODE'])."',".(($origination_rate[$accountid]['DESTINATION']) ? "'".$origination_rate[$accountid]['DESTINATION']."'" : "'".''."'").",".(($origination_rate[$accountid]['COST']) ? "'".$origination_rate[$accountid]['COST']."'" : "'".'0'."'").",'".$parentid."',".(($origination_rate[$parentid]['CODE'] ) ? "'".$origination_rate[$parentid]['CODE']."'" : "'".'0'."'").",".(($origination_rate[$parentid]['DESTINATION']) ? "'".$origination_rate[$parentid]['DESTINATION']."'" : "'".''."'").",".(($origination_rate[$parentid]['COST']) ? "'".$origination_rate[$parentid]['COST']."'" : '0').",".(($dataVariable['call_direction']) ? "'".$dataVariable['call_direction']."'" : "'internal'").",'".($dataVariable['calltype'])."'"; |
@@ -327,27 +327,27 @@ discard block |
||
327 | 327 | * @param integer $entity_id |
328 | 328 | */ |
329 | 329 | function update_balance($user_id, $amount, $entity_id, $logger, $db) { |
330 | - $math_sign = ($entity_id == 0 || $entity_id == 1) ? '-' : '+'; |
|
331 | - $query = "UPDATE accounts SET balance=balance-" . $amount . " WHERE id=" . $user_id; |
|
332 | - $logger->log("Balance update : " . $query); |
|
333 | - $db->run($query); |
|
330 | + $math_sign = ($entity_id == 0 || $entity_id == 1) ? '-' : '+'; |
|
331 | + $query = "UPDATE accounts SET balance=balance-" . $amount . " WHERE id=" . $user_id; |
|
332 | + $logger->log("Balance update : " . $query); |
|
333 | + $db->run($query); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | //Normalize rate string which we are getting from dialplan |
337 | 337 | function normalize_rate($dataVariable) |
338 | 338 | { |
339 | 339 | $rates = urldecode($dataVariable); |
340 | - $data = explode("|", $rates); |
|
340 | + $data = explode("|", $rates); |
|
341 | 341 | |
342 | 342 | $newarray = array(); |
343 | - foreach ($data as $key => $value) |
|
344 | - { |
|
345 | - $data1 = explode(":", $value); |
|
346 | - foreach ($data1 as $newkey => $newvalue) |
|
347 | - { |
|
348 | - $newarray[$data1[0]] = $data1[$newkey]; |
|
349 | - } |
|
350 | - } |
|
343 | + foreach ($data as $key => $value) |
|
344 | + { |
|
345 | + $data1 = explode(":", $value); |
|
346 | + foreach ($data1 as $newkey => $newvalue) |
|
347 | + { |
|
348 | + $newarray[$data1[0]] = $data1[$newkey]; |
|
349 | + } |
|
350 | + } |
|
351 | 351 | return $newarray; |
352 | 352 | } |
353 | 353 |