Separate in/out SIP trunks


I’ve tried to setup separate incoming and outgoing SIP trunks to the same provider without success. Even the examples published on this site were not helpful.
Can anybody post the really working example? I mean a single trunk definition with the separate outgoing & incoming sections.

Currently I simply want to have some settings configured differently for incoming & outgoing calls, like dtmf for example.


Which provider? And if the trunks are the same provider… I am not sure I see the point. Different DID’s?

I don’t get the DTMF bit as that is usually set to match to provider.

Provider name does not matter, assume it is used for both termination and DID. DTMF was taken as an example only, I could use the codecs order instead or any other parameter.

What if you want to make outgoing calls using G711 or G729 but on incoming calls you want to advertise G711 support only?
What if you want to send DTMF as SIP INFO on outgoing calls but on incoming calls (coming through the same SIP proxy) you want to advertise RFC2833 support?

AndrewZ, I don’t fair well making assumptions. Every provider will react differently depending how they prefer you to set up your trunk.

Why it is matters to me as I would expect to answer a bit differently depending. In general, you set the codecs to be used in the outbound/inbound trunks. I think dtmfmode=xxxx is a matching thing. In other words, you match it to your provider.

If your vsp allows for multiple trunk registrations… then you could set them up as you like and then control them via routes as normal.

OK, will try to give you the simple example.
I have 2 accounts with VSP, one is used on FreePBX and another on Nokia E-series phone; we will name them [email protected] and [email protected]

This VSP has a single media gateway which supports DTMF INFO only.
Asterisk is configured to use RFC2833 globally, so we will need to configure an outbound trunk to this VSP with dtmfmode=info

Then we want to make a call from Nokia to Asterisk through provider’s proxy, [email protected] -> [email protected] and reach our FreePBX IVR.
The problem that Nokia does not support DTMF as INFO, so it will send DTMF as per RFC2833. This means that we will need to configure incoming trunk from this VSP with dtmfmode=rfc2833.

Before switching to FreePBX I had this working, the trick was in the order the trunks were described in Asterisk:

secret = x
defaultuser = x
trunkname = outgoing
host = vsp.tld
fromuser = x
fromdomain = x
qualify = no
dtmfmode = info

secret = x
defaultuser = x
trunkname = incoming
host = vsp.tld
context = vsp-in
qualify = yes
; dtmfmode not set here as we have rfc2833 globally

Note that we have the same host in the both sections, but on incoming call Asterisk will match the last section with the right settings.

I’m still looking for achieving the same result with FreePBX.