Rating calls for each endpoint behing a SIP trunk

Good night; I need some guide for the following scenario:

  • 1 main office with ASTPP6 and some land lines, everything working ok.
  • 2 remote offices, each one with asterisk(FreePBX); each user in remote offices register against Asterisk.
  • 1 SIP trunk between Asterisk´s and ASTPP in Main Office(using VPN links), everything OK.
  • Each remote user(endpoint) has been created in ASTPP as “Account”(not SIP user), because my goal is get rates and calls made from each remote extension/endpoint.
  • I already configured Asterisk´s to route outgoing calls to ASTPP, and this one is making calls OK.
  • When I check reports in ASTPP, outgoing calls are being charged to the TRUNK, not to each user in the remote sites.
  • THE PROBLEM: I need to apply rates to EACH REMOTE EXTENSION; I wonder ASTPP should receive some “account” code from Asterisk´s.? Or… how ASTPP could identify to each remote endpoint, in order to charge calls to each one…?


The billing in ASTPP is charged to an “account” with an account number. When you connect something, whether it be a sip trunk, or a SIP phone, then that account will be charged.

So either you will need to connect those endpoints to separate accounts in ASTPP, or use another billing platform like BillRun where you can send it account codes as listed in the extension settings in FreePBX

Thanks for your response; if I understood well, you say “ASTPP charges billing to the Account…” that´s clear.I understood too, that “connect endpoints to separate acounts in ASTPP” could be the solution.
My problem is endpoints are in remote office, all of them registered in a freePBX(not registered in ASTPP); the SIP trunk between freePBX and ASTPP can transport multiple simultaneous calls…HOW TO IDENTIFICATE EACH OF THESE CALLS in order to charge to the remote “real” originators, one by one?

…or maybe you suggest connect one sip trunk from freePBX to ASTPP, one for EACH remote user…?? You mean -for example- if in remote office I hace 30 endpoints, I should create 30 SIP trunks, one for each endpoint??

You can either create 30 different accounts for those extensions, or go by the extensions in the CDR in FreePBX

Thanks KNERD! In fact, yes…I have created ONE account in ASTPP, per each “remote” endpoint(30 remote endpoints means 30 accounts created in ASTPP); here is exactly where my problem begins, because calls originated in any of those remote endpoints, arrives to ASTPP through SIP trunk, but ASTPP recognizes the call as if it was originated by the “admin” or “reseller” account(the user to whom the SIP trunk belongs); I don´t find the way ASTPP recognize the call as originated for some specific user behind SIP trunk, and then charge the call to that specific user.
Right now, I just have all the calls coming from the SIP trunk, being charged to the same “admin”/“reseller” user…
Thanks a lot!

Or you could make 30 SIP trunks and using the FreePBX “extension routes” commercial module, have each extension use an assigned outbound & SIP trunk.

Hi @KNERD, thanks for your suggestion; yes, this is exactly I´m trying. I have already created one account for each endpoint; but endpoint registers against remote FreePBX…could you (please!) detail how to “associate” remote endpoint calls to each account billing?
At this time, no matter which endpoint originates the call, all the calls are charged to the whole trunk, not to each created account…

xcuse me, didn´t catch the suggestion…“go” by the extensions?
PS: no, change to BillRun is not a good idea…my head is focused in ASTPP :slight_smile:
I´m sure there is a way to ASTPP make my happiness.!

Extension numbers, or put special account codes in the extension settings

Hi @dhruvil.panchal
Yesterday in our phone call, I mentioned you about a persistent doubt I have, regarding the correct(and efficient) way to identify and rate the calls originated by each ENDPOINT in our VoIP network…here please check detailed case.
Yesterday I told you my endpoints are registering against a remote freePBX , and the freePBX has a SIP trunk with my main ASTPP; thanks to @KNERD, I understood I can create a SIP trunk for EACH endpoint between freePBX and ASTPP, so in this way, ASTPP can recognize all the calls on each trunk, as originated by each individual endpoint…

…that means if I have(for example) 100 endpoints attached to freePBX…I should create 100 SIP trunks…?? Really?

Maybe do you see some other way to pass all the calls originated by endpoints, using just one SIP trunk, and (using some other way than creating a lot of trunks) allow ASTPP to recognize each originator endpoint??


You could still use BillRun. Give each extension an account number and account number will be recorded in the CDR and you can run the calls through BillRun. BillRun will recognize those account numbers from the extensions. Actually, they have an API, or you can import a CDR.

However, BillRun’s forum is not very active.

Thanks @KNERD for BillRun suggestion, but…no. I tested BillRun before and that is not what I´m looking for.
I´m happy with ASTPP; I´m totally sure there will be some creative way to solve my needs with ASTPP…I will wait @dhruvil.panchal answer.


Hello @urbanet,

Yes this is possible by smaller configuration.

First you need to create same number of accounts at ASTPP sides which are exist at your FreePBX.

Now you need to add unique prefix at freePBX side for your each endpoints.

Single trunk is enough to connect your freebPBX with ASTPP.

At ASTPP side you need to bind (prefix+IP) with similar ASTPP account of FreePBX. e.g : Endpoint 11223344 of FreePBX will dial number with prefix 91 and your trunk IP we can assume In IP setting of ASTPP, add prefix 91, IP and select account 11223344 of ASTPP. Same mapping required for rest of the endpoints of FreePBX.

In this case, you don’t need to create same number of trunks of endpoints.

I hope this clear to you.

Please find below diagram for you:


@dhruvil.panchal this works like a CHARM.!
Thanks again.!!!

1 Like