You might want to have a look at Sippy. It's a B2BUA with a complete SIP stack implementation underneath (you could use just that). It's written entirely in Python, so it's pretty hackable. Sippy is implemented with Twisted but uses none of its SIP functionality.