I had a similar problem with calls coming only from some providers in central america.
The server was calling back 2, 3, 4 or 5 times the client...!
I solved this problem and just want to share with you my solution (sure it's not the best but it works)
A first solution is to try this
Code:
exten => 058xxx0001,n,Ringing
exten => 058xxx0001,n,Wait(2)
exten => 058xxx0001,n,Hangup(38)
didn't work for me but could be a solution
I also saw this solution in the forum but it didn't works for me as i had more than 2 simultaneous calls coming from the same client :
Code:
exten => 0582950001,n,Ringing
exten => 058xxx0001,n,Wait(1)
exten => 058xxx0001,n,Hangup(38)
exten => h,1,GotoIf($[${CALLBACK} = 0]?10:20)
exten => h,10,DeadAGI(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()
(you have to define a global variable named CALLBACK)
At least i decided to use the a2billing database to see if the system was already calling the CID or not. However I didn't really found which a2billing table to use so I made my own table and database
1. I created a database (using phpmyadmin) mya2billing_chab
2. I created a table in this database with the name "callback_log" and 2 fields (ID and CallerID). ID is auto-increment and primary key and CallerID is a varchar(20)
3. You need to verify that the a2billinguser has sufficient rights to insert and delete this database
4. When a call is coming for the first time the CID is added to the table callback_log which contained the ongoing callbacks. In extension.conf i put :
Code:
exten => 058xxx0001,n,MYSQL(Connect connid 127.0.0.1 a2billinguser xxYOURxxPASSWORDxx mya2billing_chab)
exten => 058xxx0001,n,MYSQL(Query resultid ${connid} SELECT CallerID FROM callback_log WHERE CallerID = ${CALLERID(num)})
exten => 058xxx0001,n,MYSQL(Fetch fetchid ${resultid} callernumber)
exten => 058xxx0001,n,MYSQL(Clear ${resultid})
exten => 058xxx0001,n,GotoIf($[${CALLERID(number)} = ${callernumber}]?loopCallback:firstCallback)
; ### It's the 2nd, 3rd or 4th calls coming from the same CID
exten => 058xxx0001,n(loopCallback),Hangup(38)
; ### It's the first time the CID is calling
exten => 058xxx0001,n(firstCallback),MYSQL(Query resultid ${connid} INSERT INTO callback_log (CallerID) VALUES (${CALLERID(num)}))
exten => 058xxx0001,n,MYSQL(Disconnect ${connid})
exten => 058xxx0001,n,Goto(a2billing-all-callback,${CALLERID(num)},1)
exten => 058xxx0001,n,Hangup(38)
5. Then when the callback is finished i deleted the CID of the mysql table. In extensions_a2billing_1_6.conf
Code:
; To standard Outbound the callback - this is used internally by the callback daemon
[a2billing-callback]
exten => _X.,1,DeadAgi(a2billing.php,2,callback)
exten => h,1,MYSQL(Connect connid 127.0.0.1 a2billinguser xxYOURxxPASSWORDxx mya2billing_chab)
exten => h,n,MYSQL(Query resultid ${connid} DELETE FROM callback_log WHERE CallerID = ${CALLERID(number)})
exten => h,n,MYSQL(Disconnect ${connid})
exten => h,n,Hangup
Sure it's not so clean but i didn't find other solution.
Maybe a2billing developers could integrate this kind of "security" to avoid the system to callback several times the same CID ?