The Asterisk Jabber Interface, AJI, publishes an API for modules to use jabber communication.
res_jabber.c implements a Jabber client and a component that can connect as a service to Jabber servers.
AJI use the IKSEMEL library found at
http://iksemel.jabberstudio.org/