-
Notifications
You must be signed in to change notification settings - Fork 6
Dev Notes
This is a work in progress. This page is mostly for my own use, as a way of tracking various elements of the project. Read if you like, but everything here is subject to change and will eventually wind up in proper documentation.
The canonical Twiml uses the Dial verb to do many things. The baseline is simply calling PSTN numbers by including the number in the CDATA space (i.e. the "value") of the Dial element. I have that working now. The next step is to add support for all of the other nouns that Dial can take: Sip, Client, Conference, and Queue.
Making a call to a SIP destination using a raw URI is a bit odd for an Asterisk installation. Sure, it can do it, but nobody actually uses raw SIP URI dialing. At least not that I've seen in a long time. In Asterisk-world what we normally see are SIP calls being placed between local endpoints and SIP calls to destinations at the far end of a SIP trunk.
Calling A Local Endpoint
; using the classic sip channel
exten => 6101,1,Dial(SIP/6101)
; using the PJSIP channel
exten => 6101,1,Dial(PJSIP/6101)
Calling Across A Trunk
; using the classic sip channel
exten => _1NXXNXXXXXX,1,Dial(SIP/mytrunk/${EXTEN})
; using the PJSIP channel
exten => _1NXXNXXXXXX,1,Dial(PJSIP/${EXTEN}@mytrunk)
I think for this I'm going to break with the core spec since the SIP values are actually going to be different for each installation (unless you've gone to the trouble of setting up your domain for SIP calling). So to make a sip call, simply place the endpoint value you want and Aria will call it. So...
<Dial>
<Sip>PJSIP/foobar</Sip>
</Dial>
Will result in an originate with the value PJSIP/foobar
in the "endpoint" value.
So this is kind of interesting. Twilio obviously maintains a large cloud infrastructure, presumably with multiple kinds of resource nodes available for various tasks. I have to guess that rather than running the conference on the same system on which the call arrives, the Conference noun actually instructs the controller to route the call on to another system which hosts the conference. This probably results in signaling from the controller back to the SIP proxy to re-invite the call away. Either way, the call is directed to a bridge somewhere else.
It would be very cool if Aria could be configured to do something similar. Something like:
- Look up the conference name in a data store - preferably Redis since it's already in use.
- If the conference already exists
- Redirect the call to the server hosting the conference.
- If the conference does not exist:
- Select a server from a list of available conference servers.
- Create a record indicating that the selected server is hosting the conference.
- Redirect the call to the server, including a header to indicate the destination.
But at this point that's putting the cart ahead of the horse. For now, the Conference noun should drop the call into a local bridge, honoring the attributes set in the Twiml.