Unusual Trunk Setup

Need a little help.

I want to connect one main Asterisk Server (SIP1) to a SIP trunk provider.
SIP1 will be connected to the provider through one SIP trunk with “unlimited” channels
I want to create IAX2 trunks to connect other Customer Asterisk PBX’s to SIP1.

This is being done for billing purposes. I can aggregate my minutes on the provider trunk to get reduced rates.

I will generate billing off each of the customer trunks on SIP1

I have connected SIP1 to the provider.
I have connected two PBX’s together using IAX2 trunks. (CST1 <> SIP1)

I am stumped on how to setup the call routing.

Call comes into PROV on DID and is routed to SIP trunk on SIP1.
SIP1 should automatically send call out IAX2 trunk to CST1.

Extension on CST1 makes outbound call. Call is routed across IAX2 trunk to SIP1 where it is passed to PROV trunk and out PSTN.

Any assistance would be greatly appreciated.

This has been covered innumerable times in other posts. If you are going to “resell” service you should be more versed in the platform.

In any event, it is best done with custom extensions. If you insist on using the FreePBX interface you have to create a custom extension per DID with the dial string as follows:

IAX2/trunkname/DID_to_send

I spent time searching several forums including this one and couldn’t find the posting. Even now searching by “IAX2/trunkname/DID_to_send” Only find my post.

Would you mind sending the correct terminology or search phrase to search by or maybe the link to the post?

I may have written it differently in the other posts.

trunkname = the trunk you want to forward the DID to
DID to send = the digits you want to send the remote PBX

If the remote trunk is in the from_internal context then you want to send the extension, if it is in from_trunk then the DID should be sent so you can use the inbound routes.

Here is another thread where I give the custom code examples:

http://support.freepbx.org/forum/freepbx/users/how-to-do-a-re-route-of-did-in-the-freepbx

Let us know if you have trouble with either solution.

Thank you for your response. I now have calls routing by DID to the end users pbx.

  1. How would I route multiple DID’s to the same customer? Must I create a new custom extension for each DID or can I string them together with a comma, semi colon or other means.

  2. A2Billing bill off trunks. Using this method it does not see the custom extensions as trunks and won’t generate billing. We would have to manually generate CDRs on each extension and combine for billing.

Suggestions?