Asterisk scaling and load balance

What I think I would like to do is recive calls into a single asterisk instance.
Answer the call, collect some digits
And then pass on the call and media to 1 of 10 other Asterisk servers depending on the digits recived.

Is this possible?

It is important the call is always sent to the same server based on the digits collected.

An enhancment would be to forward calls to a seconday in the event of a server not being available.


Use a SIP Proxy

What I am trying to do is breakup tasks in the asterisk dial plan. A sip proxy wont give me the opportunity to perform any ivr functions before off loading to a que or service on another Asterisk server.

I’m trying to rout on skill not availability

You don’t seem to be doing load balancing, you seem to be doing call routing. That is a very basic application for Asterisk.

On the other hand, if you have very simple routing requirements, a proxy may be more efficient.

I need to put people through an IVR first.

So I could do something like this

exten => s,1,Answer()
same => n,Playback(silence/1)
same => n,Read(route,welcome,1,1,1)
same => n,ExecIf($["${route}"=“1”]?Dial(SIP/server1)
same => n,ExecIf($["${route}"=“2”]?Dial(SIP/server2)
same => n,ExecIf($["${route}"=“3”]?Dial(SIP/server3)
same => n,Hangup()

I assume the original server would remain in the call path rather than transfer sip and media direct to the next server. Is this correct?

How do we route the call on and drop the original server out of the call?

Assuming you control all the servers up and downstream:

Enabling direct media in sip.conf, and not using any feature that requires media to go through Asterisk, will result in the media bypassing Asterisk if up- and down-stream peers support that.

Using Transfer, rather than Dial (note it takes actual SIP addresses) will also release the signalling path, but Transfer is relatively fragile and not much work has gone into.

If the upstream is an ITSP, it is very unlikely they will support Transfer, and if they do, they will probably charge it the same as passing the call through in tandem. Most ITSP’s will not support direct media, and making it work will involve NAT issues, even if they do.

Yes your analysis is correct. The upstream is an wholesale ITSP who does support direct media. In fact I think I read that it was their preferred method.

I agree there is a NAT issue to consider.

Another ways of achieving the end game?

Try to route the calls through IAX with different Asterisk Server instead of SIP.

It is also possible to route the calls through SIP.

IAX will break the direct media.

My experience with direct media has been with a non-NAT environment. It should be possible to do with NAT, but you have to be more careful to configure everything properly.