refactor kamailio state