I have a phone number with Twilio that goes to a large Twiml application. Within the Twiml application, there are three certain menu options that forward the caller to a phone. Until now, the calls have been forwarded to several cell phones. Now we have a FreePBX server (RasPBX) with SIP phones and we want to use that instead.
The difficulty I have is that different menu options ring different sets of internal phones.
I thought I could do this using Twilio's SIP Registration feature by creating three separate Registration usernames (for example, option1
, option2
, and option3
) and creating a trunk for each one in FreePBX. Then I could have the menu options with Twiml like this:
<Response>
<Dial>
<Sip>
option1@example.sip.us1.twilio.com
</Sip>
</Dial>
</Response>
(and similar for option2
and option3
)
I managed to create the separate SIP trunks, and it seems like that is working properly. (CHAN_PJSIP is providing the line
parameter as part of the SIP registration, so I know that it can tell the difference between the incoming trunks using that.)
The problem is after that in the "Inbound Routes". It seems that Inbound Routes can only be chosen based on the DID that has been called or the Caller ID that placed the call. I can't use the former because all of the calls are on the same number, and I can't use the latter because anyone can call any of the options.
How can I choose Inbound Routes based on which trunk was used? Alternatively, is there a different way to do this that doesn't need multiple trunks?