I'm not aware of any documentation that's all in one place. It all uses basic Asterisk functionality with FAGI scripts to do anything with advanced logic.
Twilio essentially provides the phone number. Calls to and from are sent over the internet using the SIP protcol. Twilio can talk to Asterisk or Freeswitch or any similar project. Asterisk has incredible customizability, so that's where I do everything.