Might I recommend a project that was written for that exact purpose? Have you heard of OpenSIPS/OpenSER or what is that other name... I can't spell it nor remember it... but it combined with FreeSWITCH would solve your problem better I suspect. Use the proxy for registrations and FreeSWITCH for media servers.
/b