Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Sat Jul 22, 2017 10:48 pm
VoIP Billing solution


All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Change callerID CDR's data
PostPosted: Mon Jan 02, 2012 8:32 am 
Offline

Joined: Sat Dec 10, 2011 12:23 pm
Posts: 30
Hi,

More an Asterisk issue than A2billing but was wondering anyone can offer advice on if this will work.

I have a need to set the CallerID in the CDR's to a different field of the invite header, presently it uses the "From" section but i want to use the "p asserted identity" section instead. The reason why is the From section shows as "anonymous" when a user calls in from a private number which doesnt allow customer to authenticate and it also causes the CDR's to display as anonymous.

I'm using the "p asserted identity" to authenticate calls (thanks to Joe) but i also want to use this same field to display as the callerID in the CDR's. So authentication is working great but the CDR's are not displaying what i want.

I'm wondering if anyone can tell me if this will work before I impliment it on the product server

Right now the call comes in and it hits the below part of the dial plan which replaces the CallerID with the "p asserted identity" information (the real CLI from the customer) that the carrier is sending me.

;Sanitise the caller ID
[a2billing-sanitise-callerid]
exten => _.,1,Set(NewCLI=${SIP_HEADER(P-Asserted-Identity)})
exten => _.,n,Set(A2BCALLERID=${NewCLI:5:11})

exten => _.,n,Goto(a2billing-dialler,a2b-identify,1)

It then sends the call off to the a2billing dialler section, i'm just going to paste the section i have modified, can anyone tell me if this looks right and if this will update the CDR's "CallerID" section with the "p asserted identity" information?

The first line is the existing section of the dial plan and below that is the section i have inserted
exten => a2b-identify,n(lbl_a2billing-dialler_1),Set(CDR(accountcode)=${A2BACCOUNTCODE})
exten => a2b-identify,n(lbl_a2billing-dialler_1),Set(CDR(CALLERID)=${A2BCALLERID})


So basically my question is, will this section i've added work?

Set(CDR(CALLERID)=${A2BCALLERID})

Any advice is greatly appreciated.


Top
 Profile  
 
 Post subject: Re: Change callerID CDR's data
PostPosted: Mon Jan 02, 2012 9:43 am 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4064
Hi

The answer is "probably", However, if the caller has withheld their caller ID, it is likely that you are now going to publicise it in the outbound call, which is not what the customer wanted!

You can test this without affecting your existing work by doing something like:-

Code:
[a2billing-sanitise-callerid-test]
exten => _.,1,Set(NewCLI=${SIP_HEADER(P-Asserted-Identity)})
exten => _.,n,Set(A2BCALLERID=${NewCLI:5:11})
exten => _.,n,Goto(a2billing-dialler,a2b-identify,1)


The create a new Misc Destination to a2billing-sanitise-callerid-test,${EXTEN},1 then point your 7777 test DID to the test destination.

Joe


Top
 Profile  
 
 Post subject: Re: Change callerID CDR's data
PostPosted: Mon Jan 02, 2012 12:29 pm 
Offline

Joined: Sat Dec 10, 2011 12:23 pm
Posts: 30
Thanks Joe, i'll give that a run.

Do you recognize that code? You wrote it :)


Top
 Profile  
 
 Post subject: Re: Change callerID CDR's data
PostPosted: Mon Jan 02, 2012 6:40 pm 
Offline

Joined: Sat Dec 10, 2011 12:23 pm
Posts: 30
Well i gave this a go and it didnt update the CDR's CLI field with the CLI.

i changed the line in the dial plan to

Set(CDR(clid)=${A2BCALLERID})

I did have it as CALLERID but i was looking at the tables and the relevent column in the Asterisk CDR table is named "clid"

I did try both but neither worked.

Below is the output of the Asterisk CLI, it looks like its setting the CDR field but doesnt seem to populate it to the actual CDR's (i've replaced the real CLI and account code with "fake.."):-

-- Executing [[email protected]:21] Set("SIP/carrier-in-0001163b", "CDR(accountcode)=fakeaccountcode") in new stack
-- Executing [[email protected]:22] Set("SIP/carrier-in-0001163b", "CDR(clid)=fakeCLI") in new stack

Should the set CDR be clid or CallerID? Im thinking its probably something to do with this but not sure.

Edit: I think i've found the problem. Checking core show function CDR from the CLI shows the below


Here is a list of all the available cdr field names:
clid lastdata disposition
src start amaflags
dst answer accountcode
dcontext end uniqueid
dstchannel duration userfield
lastapp billsec channel
All of the above variables are read-only, except for accountcode,
userfield, and amaflags. You may, however, supply
a name not on the above list, and create your own
variable
, whose value can be changed with this function,

So reading this it seems i wont be able to over write the clid field but i'd have to create a new field or use the userfield but the a2billing php doesnt include a userfield so ti would never show in the a2billing cdrs anyway.

Not sure where to go from here.


Top
 Profile  
 
 Post subject: Re: Change callerID CDR's data
PostPosted: Tue Jan 03, 2012 4:06 pm 
Offline

Joined: Sat Dec 10, 2011 12:23 pm
Posts: 30
Ok i've worked out how to get the userfield to display in the CDR's by adding a line to the "call-log-customers.php".

This is the line i added

$FG_TABLE_COL[]=array (gettext ( "CLI" ), "userfield", "7%", "center", "SORT", "30" );

I changed the dial plan edit to the below to use the "userfield section.

exten => a2b-identify,n(lbl_a2billing-dialler_1),Set(CDR(userfield)=${NewCLI:5:11})

Which i can see in the CLI produces this

(I've replaced the CLI with "040000000" since its my actual phone number)

-- Executing [[email protected]:22] Set("SIP/carrier-in-00013138", "CDR(userfield)=040000000") in new stack

So that looks like it should be working but when i check the CDR records in a2b its putting some value in there but i have no idea what that value relates too

This is how the CDR displays (i've hidden most of the information in the CDR for obvious reasons).


Image

i've circled the value i'm talking about. I named the field "CLI" in the php.

I have no idea what that data in that field relates to, its different in every record but seems to always start with 709


Top
 Profile  
 
 Post subject: Re: Change callerID CDR's data
PostPosted: Thu Jan 05, 2012 10:32 am 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4064
A Noop statement in your dialplan displaying

CDR(userfield)
NewCLI
NewCLI:5:11

May give you some clues.

Joe


Top
 Profile  
 
 Post subject: Re: Change callerID CDR's data
PostPosted: Thu Jan 05, 2012 3:07 pm 
Offline

Joined: Sat Dec 10, 2011 12:23 pm
Posts: 30
i've worked out what that data is, its the actual call count, not the call ID but the actual call, its now up to 76000 something (which on a side note means i've had that many calls go through the system in the last 20 days:) ).

Now i just need to work out why the userfield is having the call count written to it.

I did put a Noop statment in and it just returned the same value as the set(cdr) (the correct CLI that i want it to).

Is it possible that the CLI data i'm writing to the CDR userfield is being over written at a later stage in the dial plan somewhere?


Top
 Profile  
 
 Post subject: Re: Change callerID CDR's data
PostPosted: Wed Jan 11, 2012 12:58 am 
Offline

Joined: Sat Dec 10, 2011 12:23 pm
Posts: 30
Bump

Anyone?


Top
 Profile  
 
 Post subject: Re: Change callerID CDR's data SOLVED
PostPosted: Wed Jun 03, 2015 7:22 pm 
Offline

Joined: Wed Jun 03, 2015 7:09 pm
Posts: 1
Sorry for that late supply..
Had the same issue today, googled around and found this thread at first place.
Best way to get the changed callerid into the CDR is done by copying the changed clid to CALLERID(ani) too.

CDR uses current value of CALLERID(ani) instead of original CALLERID(num) for CDR(src) if CALLERID(ani) is not unset.

Code:
[incoming]
exten => s,1,Verbose(Incoming call on line 123)
; try to extract phone number from sip header P-Asserted-Identity
same => n,Set(FON=$["${SIP_HEADER(P-Asserted-Identity)}" : "<sip:([0-9+]+)"])
same => n,ExecIf($[${ISNULL(${FON})}=0]?Set(CALLERID(num)=${FON})) ; This changes clid number wthout affecting cdr's (Just for Dial...)
; prevent beeing hacked by inject
same => n,Set(CALLERID(num)=${FILTER(+0123456789,${CALLERID(num)})})
; This tells cdr to use the new num for "automatic identified (billing) number" as src-field
same => n,Set(CALLERID(ani)=${CALLERID(num)})
same => n,Dial(Some/nerd)


This is because you have to log the real originating extension instead of the general public service number (08000815) for internal billing.
In most cases the interesting part for billing is the real originating extension. Thats why CDR saves the original value of CALLERID(num).
CALLERID(num) often gets modified to general public number during an outgoing call. In this case you couldn't identify the real originating extension anymore by cdr.

Best regards,
Jan


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 
Hosted Voice Broadcast


All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group