Forwarding internal channel to external channel

#1

Dear Asterisk community,
In our company, we are using an productive PBX (PBX1) which is based on Asterisk.

On this PBX1 are around 50 SIP telephones, which are able to make internal and external calls.
For the calls to extern we have a channel (SIP Trunk) to our provider.

My goal is to add a second PBX (PBX2) via another (SIP Trunk) to the PBX1. PBX2 hast to dial to external devices (mobile phones,…) via the channel to the provider of PBX1.

So the Configuration is like that:
Provider <–TRUNK1–> PBX1 <–TRUNK2–> PBX2

In my opinion I have to configure TRUNK2 manually like that:
exten => _0X.,1,Dial(SIP/TRUNK1)

This means that everything that starts with 0 and comes from TRUNK2 should be directly forwarded to TRUNK1.
I think that I have to additionally add a user from PBX1 to the call. (PBX1 hast to know via which user it should call out)
How could I achieve that?

I hope you understand my problem. Thank you very much!

0 Likes

#2

Substring ${EXTEN}. There are examples in the Asterisk sample configurations. If you weren’t supplied with these, google extensions.conf.sample.

In any case, you presumably already have extensions that do this for locally originated calls, and can just add PBX2 to the same context, assuming it has the same level of trust with regard to making toll calls.

1 Like

#3

But PBX2 is NOT an extension. It’s connected via a trunk (channel).
Or is that actually the same for the base of Asterisk?

Could you maybe give me some example lines? Let’s say I have the users/extensions [1234.bmd] and [5678.xyz] on PBX1. (These can already make calls to extern and intern)
My trunk to PBX2 is called [TRUNKPBX2] and my trunk to the provider is called [TRUNKPROVIDER]

Then I should use
exten => _0X.,1,Dial(SIP/TRUNKPROVIDER)
on incoming calls from PBX2. But I have to call out with user/extension [1234.bmd] or [5678.xyz] -> How would you do that?

0 Likes

#4

The phones aren’t extensions either. Trunk and extension are terms used by FreePBX, not by Asterisk. Asterisk uses extension just for something that appears in extensions.conf, etc., SIP has no concept of extensions versus trunks.

Using FreePBX usage, extensions usually don’t accept dialled digits, but always provide them. Trunks generally always accept dialled digits, but only provide them if they are true direct in dialling ones. Tie trunks, as in your case, generally handle dialled digits in both directions, and the very fact that you are using a pattern in your dialplan is basically acknowledging that you can receive digits from the one from PBX2.

However, this distinction does not appear in the specification of SIP.

2 Likes

#5

Thank you very much, this helped me to get one step forward.

PBX1 actually tries to forward my calls to the provider from PBX2 now. The strange thing is, trace looks like that:

  • PBX 2 sends INVITE to PBX1 (Example: INVITE sip:066887434884@10.250.8.5)
  • PBX 1 sends TRYING to PBX2
  • PBX 1 sends INVITE to provider (Example: INVITE sip:p12124.asd@testprovider.at:5060)
  • Provider sends 404 not found to PBX 1

I have no idea why PBX 1 sends the USERNAME of the provider to the provider?! In my opinion the second invite should look like that: INVITE sip:066887434884@testprovider.at:5060

0 Likes

#6

That is what it should look like. It would appear that something is configured to override that.

0 Likes

#7

Dude I got it.
This did the trick:

exten => _0X.,1,Dial(SIP/providerTrunkName/${EXTEN})

Thank you so much!

1 Like