Help to configure incoming calls via TRUNK

Hi there,
Check this out: I’m going to describe a situation and I will write the configuration I have done and didn’t work :frowning:

1. Imagine that in YOU pbx you configure to ME the extensions:
User: 2020
Password: abc123

User: 2021
Password: abc123

And You pbx IP is: 5.5.5.5.

2. What configuration I need to Register my PBX with YOUR pbx using Ext. 2020 and 2021 and if YOU call exten 2020 and 2021 my phones Ring here?

In my sip.conf i tried:

[general]
register => 2020:abc123@5.5.5.5
register => 2021:abc123@5.5.5.5

[ext1]
type=friend
defaultuser=2020
fromuser=2020
secret=abc123
host=5.5.5.5
context=from-2020

[ext2]
type=friend
defaultuser=2021
fromuser=2021
secret=abc123
host=5.5.5.5
context=from-2021

Then I restart Asterisk
Now if you call me at 2020 the calls will be placed in context from-2020
but if you call me at 2021, the call will be placed in context from-2020 too.

Why go to the same context if they are really different in the config?
What I’m doing wrong?

Because they come from the same IP address, and, in spite of your use of friend, they are not passing the extension number in the From header (not that you would expect a PABX to do that).

Note that most SIP PABXes support SIP tie “trunks”, so you shouldn’t need to do this hack with extensions.

You continue to use the wrong forum for your support questions.

To pass the extension number in the From header what i have to do?
use type=trunk
or what I should do?

You will have to ask the vendor of the other PABX. However, it is unlikely that they will support doing it.

You probably have to parse out the To header the hard way. Alternatively just use a proper trunk.

You are doing things wrong.

PBX A has it’s own set of extensions.
PBX B has it’s own set of extensions.

Set up a telephone connection between PBX A and PBX B (i.e. SIP Trunk). If you are using SIP, I recommend not using any authentication or registration.

Use the PBX A - PBX B telephone connection in your call routing scenarios. PBX A should route calls to PBX B extension numbers via the telephone connection between PBX A and PBX B. The same goes for PBX B and calls to extension numbers that are on PBX A.