Server A ext to server B as trunk

Form question

I have two servers Server A and Server B

Server A has a trunk to a provider… we have multiple dids from this trunk
Server A has and Extension Sip 1001 created
on Server A there is an Inbound route for a did from provider with
destination extensions:1000

Server B has a trunk setup with 1001 account as follows

trunk name servera-trunk

Peer Details
type=peer
host=IP.SERVER.A
username=1001
secret=<!001password>
nat=yes
trustrpid=true
sendrpid=true
insecure=port,invite
disallow=all
allow=ulaw
context=from-trunk
canreinvite=no
qualify=yes

register string
1001:<!001password>@serverA.ip/1000

when dids are forwarded from Server A to ext 1001 Server B sees
the call fine but as DID=1001, CID=

Is there a wau to keep DID when sending to Server B?

For a ‘tie-line Trunk’ Perhaps

context=from-internal

to start . . .

https://wiki.freepbx.org/pages/viewpage.action?pageId=4161588

Is there any reason why you cannot use static addresses on both ends, and therefore no registration? That should make things much easier for your usage, as it frees up the request URI for the actual destination information.

It looks like you have set up B as though it were an extension, whereas, I believe, for FreePBX you want it set up as an intra-company trunk. However, I’m really looking at this from an Asterisk point of view, and I may get FreePBX details wrong.

Why are you using the obsolescent chan_sip? (It does allow you to set To separately, which I suspect is where B is getting the DID from, but, with the right setup, you should be able to pass the required information in the request URI (as you would for an outgoing call).

You should not need nat= on an Asterisk to Asterisk trunk, as Asterisk can handle NAT properly.

There is no reason to have insecure on an Asterisk to Asterisk trunk, as Asterisk won’t use dynamic SIP source ports and will authenticate symmetrically.

canreinvite should be directmedia (if you need it at all)- the name was changed about a decade ago.

HI David55 thanks for the response

Server B is behind a dynamic ip and NAT.
Basically Server B is using Server A as its ITSP. I was hoping to do this using Extensions for easier setup on SERVER A. I have and do get it to work properly with trunk to trunk. I have many asterisks boxes setup trunks as dynamic and use username/secrect + Register string

I am using chan_sip as pj_sip was not working with some of our devices and yes I know its prob just a configuration issue on my side but I just haven’t had time to go over pjsip documentation yet and understand as well as I do chan_sip and chan_iax.

A lot of those settings were to testing trying to get this to work. Technically Server B is a client of Server A, iit should work if its an ATA, HANDSET or SERVER.

Ok so like I said this setup works with only one side affect the DID passed is the Ext and not the DID of incomming call from Server A’s ITSP. if I setup a inbound route with DID = ext I can route the calls but all DIDs comming from Server A are caught by that one route.

I will try this as well thanks :slight_smile:

Hi Comtech,

Thanks thats working as trunk to trunk its the Ext to Trunk thats not :frowning:

Basically I am looking at using server A as the ITSP for Server B.

The best solution for that with internal trunks, which are on different intranets, is to use a VPN so that it ceases to be subject to translation. However the correct way of handling server B if you must use NAT is to supply extern* address parameters. nat= should only be relevant for server A, when server B is unable to properly compensate for being behind NAT in terms of the addresses it sends.

I doubt that FreePBX was designed to cope with being the provider end of an asymmetric trunk arrangement, although I could be wrong. It is not a configuration one would use with a traditional PABX, and an intra-company trunk should be more flexible in the long run.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.