[ASTPPCOM-144] ASTPP v.3, Inbound call from clients not write to Data Base. Created: 03/Nov/16  Updated: 05/Sep/17  Resolved: 05/Sep/17

Status: Done
Project: ASTPP Community
Component/s: None
Affects Version/s: None
Fix Version/s: v3.5

Type: Task
Reporter: alexzh16 Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Hi, I'm have one questions about mod_json_cdr and insert cdr to cdrs table. Its not working. i thing its bug. for example in fs_cli a see:

2016-11-03 11:01:02.127337 [INFO] mod_json_cdr.c:271 Process [5cd1b590-a1ac-11e6-9e3c-bf48254b27d6.cdr.json]
2016-11-03 11:01:02.127337 [NOTICE] switch_core_session.c:1695 Session 541 (sofia/default/86630648@sip.eu) Ended
2016-11-03 11:01:02.127337 [NOTICE] switch_core_session.c:1699 Close Channel sofia/default/86630648@sip.eu [CS_DESTROY]
2016-11-03 11:01:15.707359 [NOTICE] switch_channel.c:1104 New Channel sofia/default/86630648@sip.eu [756-a1ac-11e6-9e7b-bf27d6]
2016-11-03 11:01:15.707359 [WARNING] sofia_reg.c:1792 SIP auth challenge (INVITE) on sofia profile 'default' for [00440123123@sip.eu] from ip 8.3.4.2
2016-11-03 11:01:15.807345 [INFO] mod_dialplan_xml.c:637 Processing ������� < 86630648 >->00440123123 in context default

and in Master.csv

".......","86630648","00440123123","default","2016-11-03 11:09:28","2016-11-03 11:09:34","2016-11-03 11:09:42","14","8","NORMAL_CLEARING","5cd1b590-a1ac-11e6-9e3c-bf48254b27d6","5cd1b590-a1ac-11e6-9e3c-bf48254b27d6","440123123","PCMA","PCMA"

but in DataBase it nothing. Billing not function and client have same Credit as before calling.

Can you check what its ?



 Comments   
Comment by alexzh16 [ 03/Nov/16 ]

UPDATE:
after check log file:
*Normal billing client xml have*

[2016-11-03 11:20:57] _* Directory Starts _****
[sip_call_id] => be1d0be6b9c4eeaf
_* Directory Ends _****

*Not Normal billing client xml have*

[2016-11-03 11:20:57] _* Directory Starts _****
[sip_call_id] => 00004f66-dd58705e6bfe1000857a0080f0d51536@192.168.4.5
_* Directory Ends _****

after that, Normal billing client xml have have long log with

_* Directory Ends _****
[2016-11-03 11:21:04] Array
(
[core-uuid] => 5939aee4-a1b4-11e6-b6e6-a5996f04dde6
[switchname] ....
)

[2016-11-03 11:21:04] Return cost 0.00
[2016-11-03 11:21:04] Return cost 0.00
[2016-11-03 11:21:04] Debit :0.00 Cost : 0 Provider Cost : 0.00
[2016-11-03 11:21:04] _********** OUTBOUND CALL ENTRY START _
[2016-11-03 11:21:04] INSERT INTO cars ...... values ('974304ee-a1b7-11e6-ba2c-a5996f04dde6','4','0','"00420" <6516581>','420','0',4,'10.0.0.15','10.0.0.15','ORIGINATOR_CANCEL'
*** OUTBOUND CALL ENTRY END *

but Normal billing client xml not have long log file, only:
[2016-11-03 11:18:52] * Directory Ends __
[2016-11-03 11:19:05]
[2016-11-03 11:19:05] Return cost 0.00
[2016-11-03 11:19:05] Return cost 0.00
[2016-11-03 11:19:05] Debit :0.00 Cost : 0 Provider Cost : 0.00
[2016-11-03 11:19:05] _* OUTBOUND CALL ENTRY START _***
[2016-11-03 11:19:05] INSERT INTO cdrs (uniqueid,accountid,type,callerid,callednum,billseconds,trunk_id,trunkip,callerip,disposition,callstart,debit,cost,provider_id,pricelist_id,package_id,pattern,notes,rate_cost,reseller_id,reseller_code,reseller_code_destination,reseller_cost,provider_code,provider_code_destination,provider_cost,provider_call_cost,call_direction,calltype,profile_start_stamp,answer_stamp,bridge_stamp,progress_stamp,progress_media_stamp,end_stamp,billmsec,answermsec,waitmsec,progress_mediamsec,flow_billmsec) values ('','0','0','','','0',0,,,'','','0.00','0.00',0,'','0','','','0',
'0','0','',0,'',
'',0,'0.00','internal','STANDARD','1970-01-01 00:00:00','1970-01-01 00:00:00','1970-01-01 00:00:00','1970-01-01 00:00:00','1970-01-01 00:00:00','1970-01-01 00:00:00',,'','','','')
[2016-11-03 11:19:05] _********** OUTBOUND CALL ENTRY END _
[2016-11-03 11:19:05] _* CDR ends _****

all customers have same preferences.

Comment by alexzh16 [ 04/Nov/16 ]

UPDATE:

after enable logger in the file fs/asp.cdr.php i'm se, that array $data its Null.

Comment by alexzh16 [ 06/Nov/16 ]

can you me please send route, where files call astpp step by step after start calling? i can check and send more info about this. in log ngnix, astpp and fs all its ok.

Comment by Samir Doshi [ 06/Nov/16 ]

Do you see any error in apache or astpp log?

Comment by alexzh16 [ 09/Nov/16 ]

so i find where its problem. Problem its with function json_decode and codepage.If clients send symbols in callerid another as ASCII, that json_decode return NULL.

I'm changed cdr.php severals rows.
Old:
$data = json_decode(file_get_contents("php://input"),true);
New:
$data = file_get_contents("php://input");
$data = utf8_encode($data);
$data = json_decode($data,true);

now all working. Only that not good ways for encoding input data. But billing working correct.

Unfortonely mb_detect_encoding( file_get_contents("php://input") ) not working correctly, and I'm not found ways for check, where code page have caller id. Maybe check direct array field with callerid and detect encoding code page. I'm try.

Comment by Samir Doshi [ 10/Nov/16 ]

This is strange. What is your php version?

Best Regards

Samir Doshi
iNextrix Technologies Pvt. Ltd.
http://www.inextrix.com

Disclaimer:
The information contained in this communication is confidential and may be
legally privileged. It is intended solely for the use of the individual or
entity to whom it is addressed and others authorised to receive it. If you
are not the intended recipient you are hereby notified that any disclosure,
copying, distribution or taking action in reliance of the contents of this
information is strictly prohibited and may be unlawful.

On Wed, Nov 9, 2016 at 8:28 PM, alexzh16 notifications@github.com wrote:

> so i find where its problem. Problem its with function json_decode and
> codepage.If clients send symbols in callerid another as ASCII, that
> json_decode return NULL.
>
> I'm changed cdr.php severals rows.
> Old:
> $data = json_decode(file_get_contents("php://input"),true);
> New:
> $data = file_get_contents("php://input");
> $data = utf8_encode($data);
> $data = json_decode($data,true);
>
> now all working. Only that not good ways for encoding input data. But
> billing working correct.
>
> Unfortonely mb_detect_encoding( file_get_contents("php://input") ) not
> working correctly, and I'm not found ways for check, where code page have
> caller id. Maybe check direct array field with callerid and detect encoding
> code page. I'm try.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> https://github.com/iNextrix/ASTPP/issues/144#issuecomment-259433859, or mute
> the thread
> https://github.com/notifications/unsubscribe-auth/AA6gcdKTh5RzPFripTI8cpbEXQCzVLbZks5q8d-EgaJpZM4KoLqt
> .

Comment by alexzh16 [ 10/Nov/16 ]

PHP 5.4.16 (cli) (built: Aug 11 2016 21:24:59) with version 7, not working.

Comment by alexzh16 [ 10/Nov/16 ]

and I'm think, that will be good make verifications in lib/astpp.cdr.php for the null array $data, with send email notifications, or... another alert.

Comment by Samir Doshi [ 05/Sep/17 ]

We updated code with your given solution and merged into ASTPP 3.5.

Generated at Sat Feb 10 07:14:32 CET 2024 using Jira 8.13.3#813003-sha1:22ebedbb75c99b147c66f14e031dd8a2d214753a.