Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 4:15 pm
Hosted Voice Broadcast


All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: no credit announcement in voip call
PostPosted: Mon Sep 23, 2013 8:49 pm 
Offline

Joined: Thu Apr 05, 2012 8:12 am
Posts: 48
Hello,

I am struggling to setup no credit announcement in a2b in agi-conf2 which I use for voip/SIP customers.

When a voip customer tries to make an outbound call and there is no credit I would like a2b to play an announcement - you do not have enough credit - and hang up.

I have notenoughcredit_cardnumber = YES and if answer_call = YES all works as expected but the issue is that I do not want a2b to answer each outgoing voip call, I have always answer_call = NO.

I would prefer it to answer a call only when the caller does not have enough credit.

Is it just a matter of setting it in the agi-conf2 or changes in the code are required?

Marcin


Top
 Profile  
 
 Post subject: Re: no credit announcement in voip call
PostPosted: Tue Sep 24, 2013 8:58 am 
Offline

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

Unfortunately, you cannot have it both ways as standard.

You can either answer the call, and play IVR, or not answer the call, then you can't hear the audio.

If this is a feature you need, I'd advise building some dialplan before launching A2Billing to check the customer's balance, and if it's insufficient, answer the call, and send the call into an agi-conf that plays the balance, and tells them they have not got enough credit.

If there is enough balance, just send the call into the normal, no answer, agi-conf.

Joe


Top
 Profile  
 
 Post subject: Re: no credit announcement in voip call
PostPosted: Fri Nov 01, 2013 8:09 pm 
Offline

Joined: Thu Apr 05, 2012 8:12 am
Posts: 48
Hello,

I have employed a coder to write me an agi script to check the account balance for each outgoing voip call before the call is passed to agi-conf2. It seems to work OK.

Here it is...

#!/usr/bin/php -q
<?php
require_once("lib/phpagi/phpagi.php");
$agi = new AGI();

$exten = $agi->get_variable("EXTEN");
$exten = $exten["data"];
$acc=$agi->get_variable("CDR(accountcode)");
//print_r($acc);
$acc=$acc["data"];

$callerid = $agi->get_variable("CALLERID(num)");
$callerid = $callerid["data"];

$channel = $agi->get_variable("CHANNEL");
$channel = $channel["data"];

$agi->verbose("***Preroute-AGI => exten => ".$exten, 4);
$agi->verbose("***Preroute-AGI => callerid => ".$callerid, 4);
$agi->set_variable("CALLERID(num)", $callerid);
$agi->set_variable("CALLERID(dnid)", $dnid);
$agi->verbose("***Preroute-AGI =>Account code => ".$acc, 4);
$agi->set_variable("EXTEN", $exten);

$ini_array = parse_ini_file("/etc/a2billing.conf");
$connA = mysql_connect($ini_array["hostname"], $ini_array["user"], $ini_array["password"]);
mysql_select_db($ini_array["dbname"], $connA);
$query="select credit from cc_card where id in(select id_cc_card from cc_sip_buddies where accountcode='$acc')";
$res=mysql_query($query);
$data=mysql_fetch_assoc($res);
$credit=$data['credit'];
$agi->verbose("***Preroute-AGI => credit => ".$credit, 4);
if($credit<=0)
{
$agi->exec("goto","voip-balance-check,*0,1"); <<<< if the account balance = 0 or less the call is passed to agi-conf9 which is set to play the "you do not have enough credit..."

}

?>




[voip-balance-check]
exten => *0,1,Noop(zero balance)
exten => *0,n,DeadAgi(a2billing.php,9)
exten => *0,n,Hangup



I hope that helps... :-)

Marcin


Top
 Profile  
 
 Post subject: Re: no credit announcement in voip call
PostPosted: Sat Nov 02, 2013 8:37 am 
Offline

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

The downside of checking the balance, then answering, then playing, "you don't have enough balance", is for any PBX or wholesale customers you have, it stops them from using a failover trunk to possibly another carrier.

Joe


Top
 Profile  
 
 Post subject: Re: no credit announcement in voip call
PostPosted: Sat Nov 02, 2013 10:41 am 
Offline

Joined: Thu Apr 05, 2012 8:12 am
Posts: 48
Joe,

This is the way how I use this script; in my view the failover trunks are not affected:

;this is just to catch calls to uk mobiles
exten => _07X.,1,Goto(a2billing-sip-GB-to-mobile,${EXTEN},1)



[a2billing-sip-GB-to-mobile]
exten => _X.,1,AGI(checkbal.php) <<< the new script checks the balance and if greater than 0 goes to the next line,
exten => _X.,n,Goto(${EXTEN:1},3) <<< to change the dialled number to 447... format
exten => _X.,n,Goto(44${EXTEN},4)
exten => _X.,n,Progress()
exten => _X.,n,DeadAGI(a2billing.php,2) <<<< to send it to a2b
exten => _X.,n,Hangup



Joe - what do you think, would the failover trunk be affected?

Thanks

Marcin


Top
 Profile  
 
 Post subject: Re: no credit announcement in voip call
PostPosted: Sat Nov 02, 2013 11:16 am 
Offline

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

Once your customer's PBX sees the call is answered, albeit by your A2Billing machine, it's not going to move on and try the next trunk.

This is OK where you are the only VoIP supplier, but not very friendly if your customers have other suppliers.


Joe


Top
 Profile  
 
 Post subject: Re: no credit announcement in voip call
PostPosted: Sat Nov 02, 2013 12:27 pm 
Offline

Joined: Thu Apr 05, 2012 8:12 am
Posts: 48
Joe,

I know what you mean.

Currently I sell my services to individual voip clients only so I should be OK for now.

Many thanks.

Marcin


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


All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 11 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