to go one step further, how can i do the unregister upon receiving another register request?
From the same user? By default the user can only be registered at one location.
Bear in mind registrations are timeout based, and refreshed by sending further REGISTER packets periodically.
That means if you have 2 phones using the same user details the 2nd will register and replace the 1st, then the 1st reregister and replace the 2nd, then the 2nd reregister and replace the 1st...
You can't stop them reregistering. Probably wouldn't want to either, or you'll stop blocking legitimate reregistrations, such as when a phone moves location.
-Steve