0
votes

I am using twilio to manage our IVR, to handle SMS, and for a few other things. After a user calls and goes through the IVR (for example they press 2 for sales or they say they want extension 205) I need it to hand off to Asterisk.

Setting up the trunk isn't my issue. I need to somehow tag it so asterisk knows how to handle the call. If they chose ext 205 on twilio, I need asterisk to automatically ring ext 205.

I am using a minimal version of asterisk basically for sip registration and voicemail and the rest is done by twilio.

Does anyone know if there is a way to do this in code? Or is my best bet to create a different trunk for each extension. That seems like it would get messy.

1

1 Answers

0
votes

Correct solution is make IVR on asterisk. This solution also will be MUCH less costly.

But if you really want... On twilio setup via SIP tag

https://www.twilio.com/docs/voice/twiml/sip

set url to sip:0000+exten@your_asterisk_ip

On asterisk setup trunk to twilio server or allowguest=yes and default context to 'goext'

After that goext context something like this

[goext]
exten => _0000XXX,1,Set(ext=${EXTEN:4})
same => n,Dial(SIP/${ext},,o)

0000 replace with some random code, that required for prevent bots calls when allowguest=yes.