Recherche dans le site/ Search this Blog:

Login



Having a2billing and Asterisk apply different rates depending on the incoming line for the call. Imprimer

In typical calling card applications, it is standard to charge a different rate if the user dials in through an 1-800 line to get to the calling card system. We have looked all over the net for ways to do this with a2billing and we did not find any ready to go solutions, only hints on how to implement one. So here is how we did it.

We only needed 2 rate classes, 1 for 1-800 lines and 1 for local lines used by users to dial into the system.

In a2billing, in RateCard, Create new RateCard

Create 2 rate cards; TollFree and Local, in the DNID PREFIX field of the rate cards, enter 1800 for the toll free card and 1418 for the local card.

You will have to duplicate your rates in each rate cards. We used the same rate source for both cards, we just added 3 cents a minute to all rates for the TollFree card which is the extra price we pay when the call comes in through the toll free lines.

The calls coming through the 1-800 lines will then automatically use the TollFree RateCard and the calls coming through local lines will use the Local RateCard. You just have to make both RateCards available to your users in your Call Plan.

In /etc/asterisk/extensions_custom.conf, add the following:

[custom-callingcard]
exten => s,1,Answer
exten => s,2,Wait,2
exten => s,3,DeadAGI,a2billing.php|1
exten => s,4,Wait,2
exten => s,5,Hangup

[custom-callingcardtf]
exten => s,1,Answer
exten => s,2,Wait,2
exten => s,3,DeadAGI,a2billing.php|2
exten => s,3,Wait,2
exten => s,4,Hangup

In /etc/asterisk/a2billing.conf, you then need two matching sections (just copy the existing section and rename it) with the following added to them :

[agi-conf1]

.....

use_dnid = NO
our_own_custom_forced_dnid=1418

.....

[agi-conf2]

.....

use_dnid = NO
our_own_custom_forced_dnid=1800

.....

In /var/lib/asterisk/agi-bin/a2billing.php change the following at (or around) line 218 :

if ($agi->request['agi_extension']=='s'){
/// $A2B->dnid = $agi->request['agi_rdnis'];
$A2B->dnid = $A2B->agiconfig['our_own_custom_forced_dnid'];

}else{
$A2B->dnid = $agi->request['agi_extension'];
}

In FreePBX, in Inbound Routes

Route your toll free line calls to:

Custom App: custom-callingcardtf,s,1

Route your local line calls to:

Custom App: custom-callingcard,s,1

That did the trick for us ! Users calling the system through toll free lines are now billed accordingly.

 

Commentaires / Comments (2)
Can you use this to avail say 2 rate plans for customers?
1 dimanche, 21 juillet 2013 21:36
Limo
Can you use this to avail say 2 rate plans for customers? I am interested in giving my customers the choice to pick different quality routes based on their budget. There will be DIDs for "premium" and others for "economy" rates. Please advise! Thanks!
RE: Can you use this to avail say 2 rate plans for customers?
2 lundi, 22 juillet 2013 05:35
oc9
Of course you can. This is what we are doing here. Whether your more expensive DID is a toll free number or just a more expensive DID doesn't matter.

Note that this trick is only necessary for shared DIDs, just like in a calling card scenario where every customer call the same DIDs and where we can only know which account to bill after the customer has entered its PIN.

Otherwise, if your DIDs are assigned to a specific customer, you do not need to hack around like this. A2Billing already supports out of the box billing whatever you want for every incoming DID as long as the DID is tied to a specific customer account.

Ajouter votre commentaire / Add your comment

Votre nom / Your name:
Sujet / Subject:
Commentaire:
SPAM: Ne pas inclure de lien ou utiliser le stratagème suivant: "yahoo.com slash mapage.html"     Nous utilisons un filtre qui bloque les commentaires suspects avec une erreur 403. De même, du code de programmation ou sql peut provoquer des erreurs 403. Veuillez utiliser un lien vers votre code tel que: "pastebin.com slash jVNqLieD"    Merci!
Comment:
SPAM: Do not include any links in your post or use the following construct: "yahoo.com slash mypage.html"    We are using a filter that denies suspicious posts with a 403 error. Programming language or SQL code may also cause a 403 error. Please provide a link to your code instead like: "pastebin.com slash jVNqLieD"    Thank you! :
  Lettres de vérification; lettres minuscules seulement, pas d
Retaper les lettres affichées / Word verification:
Mis à jour / Last updated ( samedi, 15 décembre 2007 19:02 )
 



Consultez TOUS nos fils d'actualité ici. / View ALL our newsfeed here.