You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

A2Billing为何不对客户间通话计费?求排查解决方法

Alright, let’s dig into this zero-billing issue for customer-to-customer calls on your A2Billing + Asterisk 13.18-cert3 setup. I’ve troubleshooted similar scenarios before, so here’s a step-by-step breakdown to fix those $0 CDRs:

1. Verify Your LOCAL Carrier’s Matching & Rate Configuration

First, let’s make sure your LOCAL carrier is correctly identifying internal calls and has valid rates attached:

  • Head to A2Billing Admin → Carriers → Edit your LOCAL carrier.
    • Set a Match Rule that catches your internal numbers (e.g., ^(\d{4,7})$ for 4-7 digit extensions) so A2Billing recognizes these as local customer calls.
    • Double-check that the carrier is linked to a Ratecard with non-zero rates for internal calls (even if you want them free, set a 0.0000 rate explicitly—this ensures the billing logic triggers instead of skipping).
    • Confirm Allow IP is enabled and set to your Asterisk server’s IP (or 127.0.0.1 for local deployments) to trust calls coming from your own system.

2. Audit Your Asterisk Trunk & Dialplan

Your Tech=local trunk needs to properly pass call metadata to A2Billing’s AGI:

  • In A2Billing’s Trunks settings, ensure the trunk type is set to LOCAL and Provider IP points to your Asterisk instance (use 127.0.0.1 if it’s on the same server).
  • Check your Asterisk extensions.conf dialplan for internal calls—make sure it calls the A2Billing AGI before connecting the call, so billing is triggered. Example snippet:
[from-internal]
exten => _XXXX,1,AGI(a2billing.php,1) ; The "1" here is your A2Billing AGI config ID
same => n,Dial(local/${EXTEN},20)
same => n,Hangup()
  • Verify the AGI config (A2Billing Admin → AGI Configs) linked to that ID has CDR Enabled turned on and Billing Type set to Per Call or Per Minute as needed.

3. Fix CDR Type & Billing Trigger Settings

The two CDR types (DID_Voip and DID-ALEG) might be slipping through the billing cracks:

  • Go to A2Billing Admin → System → CDR Management → CDR Import Settings.
    • Set Import CDR Type to Both (or explicitly select the two types you’re seeing) to ensure both legs of the call are processed.
    • Confirm Billing Trigger is set to Answer—this ensures billing starts only when the call is answered, which should populate the billsec field needed for calculating costs.
  • Check the actual CDRs (A2Billing Admin → CDR → List CDRs) for those zero-cost entries: look for missing accountcode, empty billsec, or mismatched src/dst numbers that aren’t linked to valid customer accounts.

4. Validate Asterisk CDR Data Flow

Asterisk needs to pass accurate call data to A2Billing’s database:

  • In the Asterisk CLI, run cdr show status to confirm your CDR module (e.g., cdr_mysql or cdr_adaptive_odbc) is active and connected to the A2Billing database.
  • After testing a customer-to-customer call, run cdr show last to check if billsec has a non-zero value—if it’s 0, Asterisk isn’t detecting the call as answered, which would lead to $0 billing.
  • Check Asterisk’s CDR logs (/var/log/asterisk/cdr-csv/Master.csv) to ensure all required fields (accountcode, src, dst, billsec, duration) are populated.

5. Debug with AGI Logs

The A2Billing AGI logs are gold for tracking billing failures:

  • Check /var/log/asterisk/a2billing.log for entries related to your test calls. Look for errors like:
    • Rate not found: Means the carrier’s match rule isn’t picking up the number, so no rate is applied.
    • Account not found: The accountcode passed from Asterisk doesn’t link to a valid A2Billing customer.
  • If you’re using the A2Billing call simulator, make sure you’re using valid customer numbers with active accounts, and check the simulator’s output for any rate-matching errors.

内容的提问来源于stack exchange,提问作者Ali Sarbanha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:22:49