On Monday 10 November 2008, Fabian Borot wrote:
I am having an issue handling UN-REGISTERs.
This is my config file: route{ [..] if (uri==myself) { if (method=="REGISTER" && (!search("expires=0"))) { if (!www_authorize("", "subscriber")) { www_challenge("", "0"); exit; }; save("location"); xlog("L_INFO","mylog: save-location successful.\n"); exit; } [..] # native SIP destinations are handled using our USRLOC DB if (!lookup("location")) { sl_send_reply("404", "Not Found"); xlog("L_INFO","mylog: lookup-location failed, sending 404 Not Found. Method: [$rm].\n"); exit; }; append_hf("P-hint: usrloc applied\r\n"); }; route(1); }
I added the "&& (!search("expires=0"))" to make sure that only the REGISTER requests will be processed by the next lines and the AOR will be saved in those cases. The X-lite sends "expires=0" in the Contact HF when it is unregistering. This is how the processing of a REGISTER looks like as per my code:
Hi Fabian,
somehow the search(..) does not match, so the REGISTER case is not used for unregistrations. My twinkle e.g. uses uppercase at the beginning in certain cases, you only match for lower case at the moment. But instead of changing the match i'd just let the registrar handle this in save(). It should work just fine.
Unregistration requests are then proceeded by the lookup, and of course no contact is found for this URI. If you comment the lookup block out, you'll get a loop, as its visible from the log below.
[..] ../../sbin/kamailio[26203]: mylog: starting_main_logic. Nov 10 12:36:43 sp1094a ../../sbin/kamailio[26203]: mylog: Message too big.
Cheers,
Henning