change router and session manager to ejabberd code