Re: [Asterisk-Users] Billing inbound calls per minute

9 views
Skip to first unread message

bbe...@mail.bg

unread,
Feb 10, 2006, 11:36:09 AM2/10/06
to asteris...@lists.digium.com
On Monday 06 February 2006 09:25, JP Carballo wrote:
> Michiel van Baak wrote:
> >On 00:30, Mon 06 Feb 06, bbe...@mail.bg wrote:
> >>Hi,
> >>Does anyone have a neat idea as how to
> >>bill inbound calls per minute(second) real time?
> >>
> >>I've been pplaying with astcc, but while
> >>'billseconds' stays empty, 'billcost' has
> >>strange behavior - either stays ampty
> >>or takes ONCE the "Connect fee"(if I put one)
> >>and keeps it that way no matter how long
> >>the call is ...( if no "Connect fee" -stays empty).
> >>
> >>i.e.
> >>[inbound]
> >>exten => 1122334455,1,Set(CALLERID(number)=${EXTEN})
> >>exten => 1122334455,2,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN},4)
> >>exten => 1122334455,3,Hangup
> >
> >DeadAGI is for hungup channels, not for active channels.
> >That might be a problem.
> >
> >Try this:
> >exten => h,1,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN},4)
>
> ASTCC works fine here. The duration and billseconds fields in my cdrs as
> well as ASTCC's cdr are filled.
> I don't use the connect fee field though and all are set to 0.
Would you share with me how'd you do billing on a DID
(if you do), and through what Technology?
Anything that goes Local here is ANSWEREDTIME zero.
Thanks,
benchev
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

Asterisk-Users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users

JP Carballo

unread,
Feb 10, 2006, 9:22:53 PM2/10/06
to Asterisk Users Mailing List - Non-Commercial Discussion
bbe...@mail.bg wrote:

>On Monday 06 February 2006 09:25, JP Carballo wrote:
>
>

>> <snip>


>>
>>ASTCC works fine here. The duration and billseconds fields in my cdrs as
>>well as ASTCC's cdr are filled.
>>I don't use the connect fee field though and all are set to 0.
>>
>>
>Would you share with me how'd you do billing on a DID
>(if you do), and through what Technology?
>Anything that goes Local here is ANSWEREDTIME zero.
>Thanks,
>benchev
>
>

That probably explains it.
IIRC, from when I was still testing ASTCC, when calling a Local channel,
the AGI suffers from short term memory loss and forgets the values of
channel variables even if "/n" is used in the dial string.
I checked my test server logs and while I can verify that ASTCC's CDR
does have blank duration and billsec fields for the Local calls, *'s CDR
records them.
If it's also true for you, you might want to use *'s CDRs for rating.

I do billing based on account number so clients are free to call from
any phone. I don't check callerid.
Since each account is based on the phone number registered by the
client, I can just chop off the 2 digit prefix and set their callerid
with the result.

[makecall]
exten => s,1,Set(CALLERID(num)=${CARDNO:2})
exten => s,n,DeadAGI(astcc.agi,${CARDNO})
exten => s,n,Goto(nf2xsubmenu,s,1)

All my calls are routed to IAX2 or SIP or Zap.

--
JP Carballo

http://www.netfone2x.com
Bringing the world closer.

It might look like I'm doing nothing, but at the cellular level, I'm really quite busy.

Darren Wiebe

unread,
Feb 10, 2006, 11:32:50 PM2/10/06
to Asterisk Users Mailing List - Non-Commercial Discussion
Are you running a relatively recent version of ASTCC? Say within the
last 6 months. The answeredtime = 0 bug was supposed to have been fixed
by http://bugs.digium.com/view.php?id=4300 Unless something has changed
in Asterisk that affects this....

bbe...@mail.bg wrote:


--
Darren Wiebe
dar...@aleph-com.net
Aleph Communications
ASTPP - Open Source Voip Billing & Calling Cards
www.aleph-com.net/astpp

bbe...@mail.bg

unread,
Feb 11, 2006, 3:20:13 AM2/11/06
to Asterisk Users Mailing List - Non-Commercial Discussion
> >On Monday 06 February 2006 09:25, JP Carballo wrote:
> >> <snip>
> >>
> >>ASTCC works fine here. The duration and billseconds fields in my cdrs as
> >>well as ASTCC's cdr are filled.
> >>I don't use the connect fee field though and all are set to 0.
> >
> >Would you share with me how'd you do billing on a DID
> >(if you do), and through what Technology?
> >Anything that goes Local here is ANSWEREDTIME zero.
> >Thanks,
> >benchev
>
> That probably explains it.
> IIRC, from when I was still testing ASTCC, when calling a Local channel,
> the AGI suffers from short term memory loss and forgets the values of
> channel variables even if "/n" is used in the dial string.
> I checked my test server logs and while I can verify that ASTCC's CDR
> does have blank duration and billsec fields for the Local calls, *'s CDR
> records them.
Similar here, and I read the patch from Darren May, 2005
where "Local/$phone/$res->{path}|30|HL/n was changed to
"Local/$phone\@$res->{path}|30|HL/n

<snip>


> I do billing based on account number so clients are free to call from
> any phone. I don't check callerid.
> Since each account is based on the phone number registered by the
> client, I can just chop off the 2 digit prefix and set their callerid
> with the result.

Yes, I do that also with another instance of astcc, I call astcc-disa.agi
to allow clients from outside to enter * and do things.


> [makecall]
> exten => s,1,Set(CALLERID(num)=${CARDNO:2})
> exten => s,n,DeadAGI(astcc.agi,${CARDNO})
> exten => s,n,Goto(nf2xsubmenu,s,1)
>
> All my calls are routed to IAX2 or SIP or Zap.

And this is my problem because my target is to use Local, but
please follow my answer, within that thread, to Darren.

Thanks very much for your help.
benchev

bbe...@mail.bg

unread,
Feb 11, 2006, 7:11:30 AM2/11/06
to Asterisk Users Mailing List - Non-Commercial Discussion
> >>>On 00:30, Mon 06 Feb 06, bbe...@mail.bg wrote:
> >>>>I've been playing with astcc, but while

> >>>>'billseconds' stays empty, 'billcost' has
> >>>>strange behavior - either stays ampty
> >>>>or takes ONCE the "Connect fee"(if I put one)
> >>>>and keeps it that way no matter how long
> >>>>the call is ...( if no "Connect fee" -stays empty).
> >>>>i.e.
> >>>>[inbound]
> >>>>exten => 1122334455,1,Set(CALLERID(number)=${EXTEN})
> >>>>exten => 1122334455,2,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN},4)
> >>>>exten => 1122334455,3,Hangup
> >>>
> >>Michiel van Baak wrote:
> >>>DeadAGI is for hungup channels, not for active channels.
> >>>That might be a problem.
> >>>
> >>>Try this:
> >>>exten => h,1,DeadAGI(astcc.agi,${CALLERIDNUM},${EXTEN},4)
> >>
> >>On Monday 06 February 2006 09:25, JP Carballo wrote:
> >>ASTCC works fine here. The duration and billseconds fields in my cdrs as
> >>well as ASTCC's cdr are filled.
> >>I don't use the connect fee field though and all are set to 0.
> >
> >Would you share with me how'd you do billing on a DID
> >(if you do), and through what Technology?
> >Anything that goes Local here is ANSWEREDTIME zero.

>On Saturday 11 February 2006 06:32, Darren Wiebe wrote:
> Are you running a relatively recent version of ASTCC? Say within the
> last 6 months. The answeredtime = 0 bug was supposed to have been fixed
> by http://bugs.digium.com/view.php?id=4300 Unless something has changed
> in Asterisk that affects this....

Thanks Daren,
Yes, my version of astcc is the most recent one.
Asterisk-1.2.4
I have found you patch 0004300 from 16 May 2005.
Probably it's time to reverse it back since "something has changed
in Asterisk that affects this..." as you said.
My observation is:
If I keep:
$dialstr = "Local/$phone\@$res->{path}|30|HL/n(" . ($maxtime * 60 * 1000) .
":60000:30000)";
Either the billseconds is empty(when dial out through Local), either there is
a<ZOMBIE> when dialing in.
I put back the dialstring to:
"Local/$phone/$res->{path}|30|HL/n(" . ($maxtime * 60 * 1000) .
":60000:30000)";
The only difference that it looks only for is a default context.

extensions.conf
[inbound]
; 10 digits DID = _XXXXXXXXXX = cardnumber
;
exten => _XXXXXXXXXX ,1,Answer()
exten => _XXXXXXXXXX ,n,Set(DB(RCID/${CALLERIDNUM})=${CALLERIDNUM})
exten => _XXXXXXXXXX ,n,Set(realcid=${DB(RCID/${CALLERIDNUM})})
exten => _XXXXXXXXXX ,n,Noop(${REALCID})
;exten => _XXXXXXXXXX ,n,Set(TIMEOUT(digit)=4)
exten => _XXXXXXXXXX ,n,Set(CALLERID(number)=${EXTEN})
exten => _XXXXXXXXXX ,n,Set(CALLERID(name)= ${REALCID})
;exten => t,3,Goto(h|1)
;exten => _XXXXXXXXXX 2,Goto(s|1)
;exten => s,1,Wait,1 ; is this preventing HUP?
exten => h,1,DeadAGI(astcc.agi,${CALLERIDNUM},${CALLERIDNUM},4)
; must be "h,1" as per Michiel van Baak note(above).
exten => h,2,Hangup
[internal]
; i.e. 360 1234567 = DID = card
exten => 3601234567,1,Macro(stdexten,3601234567,sip/did_owner)
[default]
include => internal
[personal]
exten => t,1,Hangup
include => inbound

Result:
- ANSWEREDTIME is OK
- inbound call billed on the callee
- there is CALLERID(name) for callerid in the cdrs(kind of)
There is still a small but "looong" problem - Timeout about 10
secs long while the IAX2/incoming Hangup in personal,t,1.
But CDR is updated after that and the call is billed as expected.

Sorry for the long explanation.
What do you think? Is there something "suspicious" in
that solution?

Reply all
Reply to author
Forward
0 new messages