The UAC module is super handy for creating and sending SIP requests from Kamailio. It could be triggered via HTTP requests using xHTTP, other SIP messages or on a scheduled basis like with Rtimer.
More and more I’ve been using KEMI to allow me to write Python based Kamailio dialplans, do to all sorts of funky stuff.
The UAC module can handle the replies to requests it originated, it’s handled through the event route blocks in the native Kamailio diaplan with
event_route[uac:reply] {}
But that doesn’t exist inside KEMI.
But inside our kamailio.cfg
we can specify the event callback route:
loadmodule "uac"
modparam("uac", "event_callback", "ksr_uac_event")
Then in our Kemi code (mine is in Python) we can pick it up with:
def ksr_uac_event(self, msg, evname):
KSR.info("===== uac module triggered event: " + evname + "\n")
return 1
And that’s it!