I’m looking to add some fail over support to our Asterisk system and I’m wondering if this is possible:
In our DNS server, I have A records set to two Asterisk servers. Lets call them sip1 and sip2.
And an SRV record for sip with 50/50 weight pointing to sip1 and sip2.
These Asterisk systems are both using a shared realtime MySQL database. So any user can register on sip1 or sip2.
The SRV record works; if you register to sip, you sometimes register to sip1 and sometimes you register to sip2.
The issue I’m having is calling across servers. Say 101 calls 102 - where 101 is registered to sip1 and 102 is on sip2.
We are using an ARI dial type app handling routing. If 101 calls 102, we call all contacts of 102 and stop ringing once one picks up.
It would be really simple if 101 can call every contact of 102 across all servers. I tried this and got inconsistent results. Using X-Lite and Zoiper registered to separate servers, Zoiper will ring but X-Lite will not when calling each other.
I can get this to work over an IAX connection between the servers though it can get complicated since an endpoint could have a contact on either/both servers at once. This might be the way I do this in the end though.
It really depends on the network and endpoint itself. If NAT is involved then you may or may not be able to send a message to the device from another server, as it is dependent on the properties of the NAT itself. The endpoint itself can also choose to ignore your message as it did not originate from the server it registered to.
Yes, endpoints will almost always be behind a NAT. So this will not work I guess.
Would using a proxy server instead of SRV records solve this? I have looked into Kamailio but honestly found it pretty difficult to wrap my head around.
No, there is no way as things are right now. That information is not present. It was not designed for that deployment model and has not been changed to work as such either. ContactInfo is for a PJSIP contact, but I have not used it through the dynamic mechanism so I can’t comment on it. It also would not tell you what server the contact is on.
If I remove the realtime contacts configuration from extconfig.conf and sorcery.conf so that contacts are not stored in the database, then each server only knows about contacts stored on themselves. Then I can use ARI to check other servers to see if the contact is registered there too.
This kind of seems like a hacky approach to this… I think I’m not sure exactly what is the purpose of the ps_contacts table when using ARI. Is there some other function that I’m missing?
I really appreciate your answers. Thanks
Edit:
It does give useful info like via_addr and user_agent. Is there a way to get this from ARI?