Hello, On 15.05.20 23:50, Easy Rider wrote: > Hi everyone > > I'm trying to implement OpenSIPS-like mid registrar functionality > using UAC module > > Up to now, I was simply performing authentication on my kamailio > instance, saving to local domain and forwarding the request to another > proxy > I'd like to lower the number of requests sent to this other proxy, by > forwarding only a few of the incoming requests. This is not a problem > to do, but then comes the handling of expiration. If the SIP UAC is > disconnected, the registration expires on my kamailio instance, but I > don't know how to correctly notify the other proxy on the > unregistration (I was trying to build and send a request using > uac_send_req(), but this is useless as I can't set the CSeq value)
Have you tried by setting the CSeq header inside $uac_req(hdrs)? Then there is the option with t_uac_send() from tm module: * https://www.kamailio.org/docs/modules/stable/modules/tm.html#tm.f.t_uac_send > > While looking for a solution to my problem, I discovered that OpenSIPS > had a mid registrar module doing exactly what I'd like to do > (according to the documentation at least). I also saw old messages on > this list that it was possible to achieve the same result with UAC > module on kamailio > > In particular, I don't see why (or if) I need to populate the uacreg > table. I don't see why it should be necessary, and it would have a > great impact on performance to use a db for this matter. I also don't > need (I think) to have different local and remote from and to URIs This kind of mapping allows more flexibility, you can set the same username/domain for remote and local users. But you can also have mapping on different providers. So I can run my kamailio at asipto.com with user id [email protected], which can be then mapped to [email protected]. So my kamailio registers to sipgate.com server with TELNUMBER and when someone is calling from PSTN the TELNUMBER, the call is forwarded to my kamailio at asipto.com, which will route it further to my phone [email protected]. If you have same user id, the you can eventually skip uac_reg_lookup(). > > I think I need to build the a new REGISTER request using $uac_req, but > I don't see any contact header in the outgoing request, despite having > set reg_contact_addr value The $uac_req(...) variable and uac_req_send() function are from the same uac module but they are independent of uac_reg_*() functions and uacreg db table. You have to add the Contact header in $uac_req(hdrs) if you want it the REGISTER generated with $uac_req(...) variable and uac_req_send() function (or with t_uac_send() from tm). If you go with the uacreg db table and uac_reg_*() functions, then on unregister from end point you can use uac_req_disable() to perform unregister to the remote server. Then there is uac_req_enable() to get it back registered to the remote server when new registration comes from end point. When a registrations expires due to time out, you can have an event_route executed from usrloc module where you can do uac_req_disable(). I think you have all the pieces that you need to enable/disable registrations to remote server based on registration/unregistration of the end point. By setting a larger expires value inside uacreg table, you should achieve what you look for. Cheers, Daniel -- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla _______________________________________________ Kamailio (SER) - Users Mailing List [email protected] https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
