What are your trunk settings on the sip settings tab? Particularly the settings disallow and allow?
For example, I have in the PEER Details in the sip Settings tab...
disallow=all
allow=ulaw&g729
Also, check your Extension settings, Advanced page.
What is the Disallowed Codecs set to? (Mine = all)
What is the Allowed Codecs set to? (Mine = g722&ulaw&g729)