Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 11:06 pm
Auto Dialer Software


All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: CID Callback creates 2 callbacks (ONLY with LES.net)
PostPosted: Mon Aug 04, 2008 9:25 pm 
Offline

Joined: Tue Jun 03, 2008 12:26 am
Posts: 29
Hi,

I'm using Asterisk 1.4.21.2 and A2Billing 1.3.3. I always get 2 or more callbacks from a2billing. In WebUI > Show callbacks > I see 2 or more callbacks were generated about 3-5 seconds apart from one phone call I made to CID callback triggered number. So, I answer 1 call and the other call will go to my voicemail.

Another question, I set the rate @ $0.01/min. and I have $5 balance but a2billing say I have 125 min to call. It should be 250 min (1 cent for each leg).

Thank you,
Sukasem


Last edited by sukasem on Fri Aug 22, 2008 12:57 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 10:38 pm 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
Perhaps you are queueing two callbacks from the Asterisk dialplan. Watch the Asterisk console carefully whilst triggering a callback to see if A2B is invoked twice.

I believe it's also possible to have two copies of the callback daemon running at once, which would also account for your problem.

The calculation of the maximum total duration of both legs of a callback is far from trivial. A2B currently uses a poor approximation so, to greatly reduce the possibility of the call costing more than the available funds, the user's credit is halved before making the calculation.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 11:15 pm 
Offline

Joined: Tue Jun 03, 2008 12:26 am
Posts: 29
Thank you for fast responding,

stavros wrote:
Perhaps you are queueing two callbacks from the Asterisk dialplan. Watch the Asterisk console carefully whilst triggering a callback to see if A2B is invoked twice.

Yes, it does trigger twice. How to fix this?
Here is my inbound routes.
[ext-did]
exten => 403456XXXX,1,Set(__FROM_DID=${EXTEN})
exten => 403456XXXX,n,GotoIf($[ "${CALLERID(name)}" != "" ] ?cidok)
exten => 403456XXXX,n,Set(CALLERID(name)=${CALLERID(num)})
exten => 403456XXXX,n(cidok),Noop(CallerID is ${CALLERID(all)})
exten => 403456XXXX,n,Set(__CALLINGPRES_SV=${CALLINGPRES_${CALLINGPRES}})
exten => 403456XXXX,n,SetCallerPres(allowed_not_screened)
exten => 403456XXXX,n,Goto(a2billing-cid-callback,_X.,1)


stavros wrote:
I believe it's also possible to have two copies of the callback daemon running at once, which would also account for your problem.

I use ps -aux command but I only see callback daemon once.


stavros wrote:
The calculation of the maximum total duration of both legs of a callback is far from trivial. A2B currently uses a poor approximation so, to greatly reduce the possibility of the call costing more than the available funds, the user's credit is halved before making the calculation.

Maybe, because of those 2 queues.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 11:50 pm 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
sukasem wrote:
Yes, it does trigger twice. How to fix this?
Well we've narrowed this down to a problem in your Asterisk dialplan. Exactly how to fix this depends on how things are currently configured but, simply put, you need to eliminate the section of the call flow which is invoking A2B a second time. As a general strategy try studying your extensions.conf (and any #include'd files) in tandem with the log from the Asterisk console showing the unwanted 2nd invocation.
Quote:
Maybe, because of those 2 queues.
Not really, no. A2B's behaviour when simultaneous calls on one card are permitted is very simple: the credit is checked at the start of the call, and the credit is updated at the end of the call. Given this behaviour the only way to guarantee the balance doesn't descend below 0.00 is to disallow simultaneous calls. Asiby's posts in this thread give a lot more context to this quandary.

Quote:
I use ps -aux command but I only see callback daemon once..
All these years I've been using BSD-style syntax to 'ps' without realising it. Thanks for causing me to read the man page.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 12:21 am 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
Hello sukasem,

There is a line in a2billing.php that explicitly divide the customer`s credit by 2 prior to doing any call. I personally strip out that part of the code every time I install a2billing cause we can't come up with any possible justification for allowing only half of their account balance to be used for each call.

Change this ...

Code:
765                // DIVIDE THE AMOUNT OF CREDIT BY 2 IN ORDER TO AVOID NEGATIVE BALANCE IF THE USER USE ALL HIS CREDIT
766                $orig_credit = $A2B -> credit;
767                $A2B -> credit = $A2B->credit / 2;


to ...

Code:
765                // DIVIDE THE AMOUNT OF CREDIT BY 2 IN ORDER TO AVOID NEGATIVE BALANCE IF THE USER USE ALL HIS CREDIT
766                $orig_credit = $A2B -> credit;
767                //$A2B -> credit = $A2B->credit / 2;


This will take care of the call duration.

As Stavros has suggested, you probably have the daemon running twice. Try this

Code:
pstree -p


It will show each process with the process id. So any duplicated process will show up on its own line.

You can also try this:

Code:
tail -f /path/to/a2billing-daemon-callback.log


By default, the daemon checks the callback queue every 10 seconds. So if the above command shows some activity at a frequency higher than 1 beat per 10 seconds, than either you have 2 daemon running, or the daemon frequency in the configuration is wrong.

Good luck.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 9:17 pm 
Offline

Joined: Tue Jun 03, 2008 12:26 am
Posts: 29
Hi asiby,
Thank you for the code,

Here what I got from pstree -p
Code:
root@pbx:~ $ pstree -p
init(1)ââ¬âa2billing-callb(2285)
        ââacpid(2051)
        ââatd(2474)
        ââauditd(1833)ââ¬âpython(1835)
        â              ââ{auditd}(1834)
        ââautomount(2028)ââ¬â{automount}(2029)
        â                 ââ{automount}(2030)
        â                 ââ{automount}(2033)
        â                 ââ{automount}(2036)
        ââavahi-daemon(2531)âââavahi-daemon(2532)
        ââbash(7900)âââsh(7901)âââop_server.pl(8653)
        ââcrond(2352)
        ââcupsd(2114)
        ââdbus-daemon(1921)
        ââevents/0(5)
        ââfail2ban(2404)
        ââgam_server(2783)
        ââhald(2566)âââhald-runner(2569)ââ¬âhald-addon-acpi(2640)
        â                                ââhald-addon-cpuf(2641)
        â                                ââhald-addon-keyb(2649)
        â                                ââhald-addon-stor(2658)
        ââhcid(1936)
        ââhidd(2006)
        ââhttpd(2335)ââ¬âhttpd(7707)
        â             ââhttpd(7708)
        â             ââhttpd(7709)
        â             ââhttpd(7710)
        â             ââhttpd(7711)
        â             ââhttpd(7712)
        â             ââhttpd(7713)
        â             ââhttpd(7714)
        ââkhelper(6)
        ââklogd(1856)
        ââkrfcommd(1961)
        ââksoftirqd/0(3)
        ââkthread(7)ââ¬âaio/0(162)
        â            ââata/0(347)
        â            ââata_aux(348)
        â            ââcqueue/0(96)
        â            ââkacpid(12)
        â            ââkauditd(389)
        â            ââkblockd/0(11)
        â            ââkgameportd(885)
        â            ââkhubd(99)
        â            ââkjournald(362)
        â            ââkjournald(1356)
        â            ââkmpathd/0(1334)
        â            ââkpsmoused(323)
        â            ââkseriod(101)
        â            ââksnapd(359)
        â            ââkswapd0(161)
        â            ââpccardd(311)
        â            ââpccardd(313)
        â            ââpdflush(159)
        â            ââpdflush(160)
        ââmigration/0(2)
        ââmingetty(2945)
        ââmingetty(2946)
        ââmingetty(2947)
        ââmingetty(2948)
        ââmingetty(2949)
        ââmingetty(2950)
        ââminiserv.pl(2941)
        ââmysqld_safe(2215)âââmysqld(2251)ââ¬â{mysqld}(2252)
        â                                  ââ{mysqld}(2253)
        â                                  ââ{mysqld}(2254)
        â                                  ââ{mysqld}(2255)
        â                                  ââ{mysqld}(2262)
        â                                  ââ{mysqld}(2263)
        â                                  ââ{mysqld}(2264)
        â                                  ââ{mysqld}(2265)
        â                                  ââ{mysqld}(2266)
        â                                  ââ{mysqld}(6220)
        âânmbd(2440)
        âântpd(2148)
        ââportmap(1894)
        ââsafe_asterisk(7814)âââasterisk(7825)ââ¬â{asterisk}(7829)
        â                                      ââ{asterisk}(7830)
        â                                      ââ{asterisk}(7831)
        â                                      ââ{asterisk}(7832)
        â                                      ââ{asterisk}(7834)
        â                                      ââ{asterisk}(7835)
        â                                      ââ{asterisk}(7836)
        â                                      ââ{asterisk}(7838)
        â                                      ââ{asterisk}(7839)
        â                                      ââ{asterisk}(7840)
        â                                      ââ{asterisk}(7841)
        â                                      ââ{asterisk}(7842)
        â                                      ââ{asterisk}(7843)
        â                                      ââ{asterisk}(7844)
        â                                      ââ{asterisk}(7845)
        â                                      ââ{asterisk}(7846)
        â                                      ââ{asterisk}(7847)
        â                                      ââ{asterisk}(7848)
        â                                      ââ{asterisk}(7849)
        â                                      ââ{asterisk}(7850)
        â                                      ââ{asterisk}(7851)
        â                                      ââ{asterisk}(7852)
        â                                      ââ{asterisk}(7853)
        â                                      ââ{asterisk}(7854)
        â                                      ââ{asterisk}(7855)
        â                                      ââ{asterisk}(7856)
        â                                      ââ{asterisk}(7858)
        â                                      ââ{asterisk}(8378)
        â                                      ââ{asterisk}(8658)
        ââscreen(3012)âââbash(3013)âââmplayer(3031)
        ââsdpd(1947)
        ââsendmail(2310)
        ââsendmail(2318)
        ââsmartd(2934)
        ââsmbd(2437)âââsmbd(2455)
        ââsshd(2099)âââsshd(10494)âââbash(10499)âââpstree(10622)
        ââsyslogd(1853)
        ââudevd(423)
        ââwatchdog/0(4)
        ââxfs(2389)
        ââxinetd(2130)
        ââyum-updatesd(2777)

Well, I did try fresh install on the other machine and I have no problem with 2 callbacks now.

But I got another problemwith callerID. Some providers have CallerID format 1-Area code-Local Number. How can I remove 1 from CallerID?

I try exten => _X.,1,Set($CALLERID(num)=${CALLERIDNUM:-10}) but it doesn't work. I have no idea to to write codes but I read article on www.the-asterisk-book.com. They have example exten => _0X.,1,Set(LOCALNUMBER=${EXTEN:-7}) to store only last 7 digit.

Could you help please?

Thank you again,


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 06, 2008 10:55 pm 
Offline
Moderator
User avatar

Joined: Thu Jun 22, 2006 2:19 pm
Posts: 2890
Location: Devon, UK
sukasem wrote:
exten => _X.,1,Set($CALLERID(num)=${CALLERIDNUM:-10})
Remove the first $ and it will probably work:
Code:
exten => _X.,1,Set(CALLERID(num)=${CALLERIDNUM:-10}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 22, 2008 12:44 am 
Offline

Joined: Tue Jun 03, 2008 12:26 am
Posts: 29
I found the problem "callback create 2 queues" now.
I was LES.net DID.
I tried other providers with no problem.

Anyone have this problem with LES.net?

Cheers,


Top
 Profile  
 
 Post subject: Re: CID Callback creates 2 callbacks (ONLY with LES.net)
PostPosted: Mon Sep 07, 2009 9:37 pm 
Offline

Joined: Mon Apr 14, 2008 8:37 pm
Posts: 356
Location: Canada
how did you resolve the 2 callback issue? i'm stuck right now!! :( running into the same issue, i receive the callback, but then 2-10 seconds later i recieve another callback. my logs aren't working properly, so i can't see exactly whats going on :( but in konw for sure that there is only one process of the daemon running using pidof... when i check in the admin interface, (CALLBACK > Add) i see two callbacks are initiated AT EXACTLY THE SAME AMOUNT OF TIME!! EXACT!! there is no delay, nothing... btw, i'm using asterisk 1.4.2X, freepbx 2.5, a2billing 1.4.2 and php 5.2 any help would be much appreciated!


Top
 Profile  
 
 Post subject: Re: CID Callback creates 2 callbacks (ONLY with LES.net)
PostPosted: Wed Sep 30, 2009 6:56 pm 
Offline

Joined: Fri Apr 24, 2009 7:34 pm
Posts: 11
Same here..it creates 2 callback with another provider.
What I figured so far:
asterisk 1.6 a2billing 1.3 freepbx 2.6
-asterisk pickup the first ring and direct the call to the context of CID callback .
-asterisk pickup the second ring from the same call and it thinks it's a totally new call...
-this is confirmed into the asterisk LOG.. being used twice..
netsock.c: == Using SIP RTP TOS bits 184
netsock.c: == Using SIP RTP CoS mark 5

Must be a bug from the provider of some sort ?? or asterisk ??


Top
 Profile  
 
 Post subject: Re: CID Callback creates 2 callbacks (ONLY with LES.net)
PostPosted: Tue Oct 13, 2009 12:29 am 
Offline

Joined: Fri Apr 24, 2009 7:34 pm
Posts: 11
>[quote="patrolg"]Same here..it creates 2 callback with another provider.
>What I figured so far:
>asterisk 1.6 a2billing 1.3 freepbx 2.6
>-asterisk pickup the first ring and direct the call to the context of CID callback .
>-asterisk pickup the second ring from the same call and it thinks it's a totally new call...
>-this is confirmed into the asterisk LOG.. being used twice..
> netsock.c: == Using SIP RTP TOS bits 184
> netsock.c: == Using SIP RTP CoS mark 5

I am not sure why it creates totally new call with a second ring. Perhaps is because asterisk has already acted on the first ring and sees the second ring has being totally another call. Could be a bug...

FIX WITH THIS SOLUTION..
define a global variable name CALLBACK = 0. A global variable is chosen because asterisk creates totally a new call hence we would loose the channel variable.
In my case it is freepbx..with asterisk 1.6 so under ect/asterisk/globals-custom.conf
[globals]
CALLBACK=0

Now into your extension for a2billing.
[a2billing-cid-callback]
exten => _X.,1,Verbose(Executing Calling back CID for=${CALLERID(num)})
exten => _X.,n,Ringing
exten => _X.,n,Wait(10)
exten => _X.,n,Hangup
exten => h,1,GotoIf($[${CALLBACK} = 0]?10:20)
exten => h,10,AGI(a2billing.php,2,cid-callback)
exten => h,n,Set(GLOBAL(CALLBACK)=1)
exten => h,n,Verbose(CALLBACK Variable changed first callback =${CALLBACK})
exten => h,n,Hangup()
exten => h,20,Set(GLOBAL(CALLBACK)=0)
exten => h,n,Verbose(CALLBACK Variable changed second callback =${CALLBACK})
exten => h,n,Hangup()

In this way it will execute the CID-CALLBACK ounce every 2 calls.
Take notice that small letter or big letters when creating a global variable doesn't matter. We just set a standard by using big letters for GLOBAL variables and small or mix is for channel variable.


Top
 Profile  
 
 Post subject: Re: CID Callback creates 2 callbacks (ONLY with LES.net)
PostPosted: Sun Jan 10, 2010 6:45 pm 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
Nive move patrolg, but this will only work if your DID is generating only 2 calls for the same call.

If you have never used LES.NET services (then avoid them), then here is what happen with them when you call your DID number:

- The askerisk server with often no be able to successfuly hangup and close the line
- The caller may not hear anything
- If your asterisk hangs up, then the caller will often hear the message saying "The voice over ip customer that you are trying to reach is currently offline" ... which is bad for callback businesses.
- For each ringing that the caller will hear, a new callback will be requested. That means that you can end up request 20 callbacks if you don't hangup the line.
- etc.

Simple switch provider or port your number to a better DID provider and your problem will be solved.

Cheers


Top
 Profile  
 
 Post subject: Re: CID Callback creates 2 callbacks (ONLY with LES.net)
PostPosted: Sun Jan 10, 2010 6:59 pm 
Offline

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

Sometimes, putting in a bit of dial plan that allows Asterisk to ring two or three times can help in certain circumstances.

if it doesn't, follow asiby's advice.

Joe


Top
 Profile  
 
 Post subject: Re: CID Callback creates 2 callbacks (ONLY with LES.net)
PostPosted: Sun Oct 31, 2010 3:59 pm 
Offline

Joined: Tue Oct 06, 2009 12:23 pm
Posts: 23
Location: Austria
Hello,

we had same problem and solved it on our a2billing 1.8.1 and asterisk 1.4.21
answer_call=No
and sending hangup code 38
exten => _X.,n,Hangup(38)

Hope this helps

Greetings
http:www.bestcallshop.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 
VoIP Billing solution


All times are UTC


Who is online

Users browsing this forum: No registered users and 9 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