Skip to main content

CDR - BILLING/DOCUMENTATION option

Posted by trinitel on Sun, 10/03/2010

Is there a way to change the BILLING/DOCUMENTATION option in CDR? I've got 3 SIP trunks, at the moment all call to these 3 trunks are labelled as BILLING . But I need calls to first SIP trunk labelled as DOCUMENTATION and calls to the other two trunks to be labelled as BILLING.
Any clues?

Thanks

Peter
Trinitel Ltd
www.trinitel.co.uk


Submitted by trinitel on Sun, 10/03/2010 Permalink

I found the SetAMAFlags(billing) in dial-out base script. So it looks that in order to achieve what I need I would have to re-write the Dialout-base script with new argument - AMAFlags. Is that correct?

Peter
Trinitel Ltd
www.trinitel.co.uk

Submitted by eeman on Sat, 10/09/2010 Permalink

are you actually using this field? Unless you have external software looking for it, it doesnt actually do anything.

you'd be better off just removing the SetAMAFlags dialplan option and just set it directly on the sip options of each trunk.

Submitted by trinitel on Mon, 10/11/2010 Permalink

We are testing the option of using CDR from asterisk without the need of using external gateway.
We have 2 SIP trunks (for calls to PSTN) + loopback sip trunk for calls between tenants. Calls between tenants should be free so we need to label them as "documentation".
Our software developer is preparing small software which will price every call (based od AMAFlags) and save it all to DB.
Data from DB can be than used in CRM (vtiger) for user access or Invoice generation.

I managed to re-write dial-out base script and create dial-out 3 trunks scrip so I can manually set the AMAFlags in every route. But setting it as a sip option of the trunk seems to be better option.

Thanks

Peter
Trinitel Ltd
www.trinitel.co.uk

Submitted by trinitel on Mon, 10/11/2010 Permalink

It don't work with trunk sip options. If I use dial-out 1 trunk script it is OK. Dialling to PSTN is labeled for billing, dialling to loopback trunk is labeled by documentation. But the problem is when I use dial-out 2 or 3 trunks, all the calls are labelled as documentation. The first trunk is loopback trunk and second is trunk to PSTN. It looks that AMAFlags option from first SIP trunk is saved to CDR. Am I doing something wrong or this is expected behavior?

Thanks

Peter
Trinitel Ltd
www.trinitel.co.uk

Submitted by eeman on Mon, 10/11/2010 Permalink

so you're saying that it goes like this...

sip-trunk1 amaflags=documentation

sip-trunk2 amaflags=billing

but for some reason it ignores the next amaflag setting in sip.conf when it goes out that trunk???

Submitted by eeman on Mon, 10/11/2010 Permalink

that sounds like an unintended asterisk bug to me.. what version of asterisk? I would bug it.. just explain it like this...

exten => _1NXXNXXXXXX,1,Dial(SIP/trunk1)
exten => _1NXXNXXXXXX,n,Dial(SIP/trunk2)
exten => _1NXXNXXXXXX,n,Dial(SIP/trunk3)

then give example sip.conf entries.

until then I guess you're stuck with modifying dialout-base..

They way I could see making it useful would be to change this line in tl-dialout-base

exten => s,n,SetAMAFlags(billing)

to

exten => onetrunk,n,SetAMAFlags(${TRUNK_AMAFLAGS_${TRUNK}})

then use the GUI's trunks cgi to write these globals to the trunks.include file like the others.

then you could/should be able to still set it on each trunk via dialplan, but specify it in the trunk setting instead of the outbound route area, plus would involve less code.

do me a favor and experiment with this.. make the script change now and just manually add those globals to your trunks.include to see if it solves your issue. If it does then I can ask alex to alter edit_trunk.cgi to add another global variable.

corrected.... script change has to move from s,n to onetrunk,n because $TRUNK doesnt get defined until that loop. Just stick it after it defines what $TRUNK is.

Submitted by trinitel on Tue, 10/12/2010 Permalink

It's asterisk 1.6.2.10.
I tried what you suggested (manually edited trunks.include and modified dialout-base script) and this works.
You can ask Alex to add another variable ;)
If we will upgrade thirdlane in the future do we need to manually backup our scripts and manually edited config files (trunks.include)? Would these be overwritten during thirdlane upgrade?

Thanks for your help.

Peter
Trinitel Ltd
www.trinitel.co.uk