Hi, An alternative to the C/Module version would be the following:
# Allow no more than 2 contacts per AOR modparam("registrar", "max_contacts", 2) # Order usr-loc entries by the order of registration, not the Q-Value: modparam("usrloc", "desc_time_order", 1) # Table holding last selected AOR per record: modparam("htable", "htable", "selectedaor=>size=8;autoexpire=7200;") if(reg_fetch_contacts("location", "$fu", "caller")) { # Registration found if($sht(selectedaor=>$fu)!=$null) { if ($sht(selectedaor=>$fu) == 1) { $sht(selectedaor=>$fu) = 0; } else { $sht(selectedaor=>$fu) = 1; } } else { $sht(selectedaor=>$fu) = 0; } # Rewrite URI $ru = $(ulc(caller=>addr)[$sht(selectedaor=>$fu)]); # and do whatever you want, with the rest of the info... } So long, Carsten 2012/3/26 Daniel-Constantin Mierla <mico...@gmail.com>: > Hello, > > On 3/24/12 2:35 PM, Krishna Kurapati wrote: > > Thanks Daniel for the suggestions. To make the script manageable, I am > thinking of implementing last option. > Have another flag to "save". May be 0x8? > > yes, it is ok. > > Perhaps this should have lower priority than 0x4, just in case someone sets > both of them. > > > We will still use max_contacts = 2 in mod params. > And when the save("location", "0x08") is called, the oldest contact is > removed and the new contact is > added. This can apply to any number of max_contacts... > > > Perfect. As said in previous email, this value can be set per registration > right now, with devel version. > > Cheers, > Daniel > > > This way everything else remains the same. > > Krish Kura > > On Sat, Mar 24, 2012 at 3:48 AM, Daniel-Constantin Mierla > <mico...@gmail.com> wrote: >> >> Hello, >> >> >> On 3/23/12 3:21 PM, Krishna Kurapati wrote: >>> >>> Hi, >>> >>> Is there a way to set up maximum of 2 active roll over contacts per user? >>> Currently when I setup max contacts param as 2, >>> The third one is responding with 503 error for 3rd Register. How can we >>> remove one of the contacts and replace it with the >>> new one. >>> >>> I need it when the device is switching over from Wifi to 3G and back. or >>> Wifi network to Wifi network switching. >> >> the master branch support setting number of contacts per registration, but >> it is the old fashion of rejecting new contacts. >> >> Some ideas coming in my mind, not sure if all get to a proper solution: >> - play with two tables for usrloc, like location1 and location2, each with >> save(...) last registration and you do round robing with the registration >> (use htable to keep which location table to use next). Then do >> lookup/append_branch over the table one, revert the uri and do lookup over >> the second table -- combine these operations as you need >> - use database mode only and then sqlops to remove entries that are no >> longer useful for you. defining location table in memory (possible with >> mysql), gives you good performances >> >> Of course, an extension to c code to have such functionality would be >> another option, contributions will be accepted as usual. >> >> Cheers, >> Daniel >> >> -- >> Daniel-Constantin Mierla >> Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany >> http://www.asipto.com/index.php/kamailio-advanced-training/ >> > > > -- > Daniel-Constantin Mierla > Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany > http://www.asipto.com/index.php/kamailio-advanced-training/ > > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users > -- Carsten Bock CEO (Geschäftsführer) ng-voice GmbH Schomburgstr. 80 D-22767 Hamburg / Germany http://www.ng-voice.com mailto:cars...@ng-voice.com Mobile +49 179 2021244 Office +49 40 34927219 Fax +49 40 34927220 Sitz der Gesellschaft: Hamburg Registergericht: Amtsgericht Hamburg, HRB 120189 Geschäftsführer: Carsten Bock Ust-ID: DE279344284 Hier finden Sie unsere handelsrechtlichen Pflichtangaben: http://www.ng-voice.com/imprint/ -- Meet ng-voice at LinuxTag 2012 in Berlin - May 23rd - 26th, 2012. Save the date! _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users