txs Henning, the search() works, that block only matches REGISTERs, but my point was whether the lookup() function makes sense or not for handling REGISTERs [ I see it in some tutorials, I am a beginner to kamailio by the way]
as far as handling UN-REGISTRATIONs, would save() fit there as well? should I do something special to handle the UN-REGISTRATION or kamailio should know that should remove the AOR automaticall when it sees the "expires=0" in the Contact HF?
also, I see the loop but do not understand why it happens.
regards
Fabian
From: henning.westerholt@1und1.de To: users@lists.kamailio.org Subject: Re: [Kamailio-Users] question about register Date: Tue, 11 Nov 2008 18:41:17 +0100 CC: fborot@hotmail.com
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
_________________________________________________________________ Windows Live Hotmail now works up to 70% faster. http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_faster_...