<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
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]<br><br>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?<br><br><br>also, I see the loop but do not understand why it happens.<br><br>regards<br><br>Fabian<br><br><br><br><br><div>
<div> </div></div><br><br><br><br>> From: henning.westerholt@1und1.de<br>> To: users@lists.kamailio.org<br>> Subject: Re: [Kamailio-Users] question about register<br>> Date: Tue, 11 Nov 2008 18:41:17 +0100<br>> CC: fborot@hotmail.com<br>> <br>> On Monday 10 November 2008, Fabian Borot wrote:<br>> > I am having an issue handling UN-REGISTERs.<br>> ><br>> ><br>> > This is my config file:<br>> > route{<br>> > [..]<br>> > if (uri==myself) {<br>> > if (method=="REGISTER" && (!search("expires=0"))) {<br>> > if (!www_authorize("", "subscriber")) {<br>> > www_challenge("", "0");<br>> > exit;<br>> > };<br>> > save("location");<br>> > xlog("L_INFO","mylog: save-location successful.\n"); <br>> > exit;<br>> > } <br>> > [..]<br>> > # native SIP destinations are handled using our USRLOC DB<br>> > if (!lookup("location")) {<br>> > sl_send_reply("404", "Not Found");<br>> > xlog("L_INFO","mylog: lookup-location failed, sending 404<br>> > Not Found. Method: [$rm].\n"); exit;<br>> > };<br>> > append_hf("P-hint: usrloc applied\r\n");<br>> > };<br>> > route(1);<br>> > }<br>> ><br>> ><br>> > I added the "&& (!search("expires=0"))" to make sure that only the REGISTER<br>> > requests will be processed by the next lines and the AOR will be saved in<br>> > those cases. The X-lite sends "expires=0" in the Contact HF when it is<br>> > unregistering. This is how the processing of a REGISTER looks like as per<br>> > my code:<br>> <br>> Hi Fabian,<br>> <br>> somehow the search(..) does not match, so the REGISTER case is not used for <br>> unregistrations. My twinkle e.g. uses uppercase at the beginning in certain <br>> cases, you only match for lower case at the moment. But instead of changing <br>> the match i'd just let the registrar handle this in save(). It should work <br>> just fine.<br>> <br>> Unregistration requests are then proceeded by the lookup, and of course no <br>> contact is found for this URI. If you comment the lookup block out, you'll <br>> get a loop, as its visible from the log below.<br>> <br>> > [..]<br>> > ../../sbin/kamailio[26203]: mylog: starting_main_logic. Nov 10 12:36:43<br>> > sp1094a ../../sbin/kamailio[26203]: mylog: Message too big.<br>> <br>> Cheers,<br>> <br>> Henning<br><br /><hr />Windows Live Hotmail now works up to 70% faster. <a href='http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_faster_112008' target='_new'>Sign up today.</a></body>
</html>