Force signaling via SIP trunk when UAs are both local

Hi there, I’m new to Asterisk and FreePBX. Reasonably new to SIP generally, it’s fair to say, although I am experienced in TDM IN interworking.

I’m trying to do a proof-of-concept whereby I have two local UAs connected directly to the FreePBX instance, with a SIP trunk registered to another SIP server acting in B2BUA mode, and an outgoing route with a dial prefix of ‘.’ that is intended to mean that all calls should go out the SIP trunk.

If I dial a true external number, that’s fine. I have it talking to my other box, which is sending a new INVITE back to FreePBX (currently blocked by the firewall, but that is a different issue!) However if I call from one softphone attached to FreePBX to another one attached to it as well, FreePBX does the smart thing and just connects them directly.

But I still want the SIP signaling to go out the trunk where it will be monitored and possibly modified by the system at the other end of the trunk before tromboning back to FreePBX to terminate the call.

It sounds like this is a simple trick that I’m missing. Can anyone point me in the right direction?

Sounds like you need a true proxy to handle that, look into kamailio perhaps?

Perhaps

http://www.opentelecoms.org/use-a-sip-proxy-instead-of-asterisk

to see why you need that.

Or, you could create a custom context and put the extensions in that. In that custom context you could forward that SIP invite down the trunk, bypassing the FreePBX dial plan. You would lose all FreePBX functionality though.

Option 2 would be to copy the entire from-internal context and remove the internal dial plan. The put that entire dial-plan, and he includes in “my-custom-dialplan”

Thanks all, Kamailio seems like it might be more what I want. There’s even a recipe there to do exactly what I’m after, by the look of it.