Hi Experts,

We have been using Kamailio as a sip proxy for a fair bit of time now(version 5.3.2 though) and do understand the native routing mechanism that can be instrumented through the kamailio cfg scripts.
We initially had only two sides, where the traffic could come from into Kamailio and it just passed through to the other side(ie Traffic from A was routed to B and that from B was routed to A). Off late, a few more sip elements have been introduced in the deployment and now there is a need for a more formal/robust mechanism to select the intended destination to forward an initial SIP INVITE to.

I believe that we could still keep all the logic in the native kamailio script and do the routing(for example, an incoming call where the From URI contains sip.elementA.com should be routed to destination sip.elementB.com, where as if the To URI contains sip.elementC.com, the request should be routed to sip.elementC.com). Since we have many sip elements like A,B.C,D,E etc where the requests might have to be routed to, based on certain different criteria, this logic would become cumbersome. What would be the best way to accommodate this? 

Would it be possible to rewire this routing logic at runtime(like in some csv file that can be reloaded) without a Kamailio restart? 

Regards,
Harneet Singh

--
"Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth" - Sir Arthur Conan Doyle