= Integrating Third Party Media Stack with PJSIP = == Introduction == PJSIP consists of several libraries which mostly are independent from one another. The library architecture diagram below shows how libraries are interacting with each other. == SIP and Media Interaction == Pseudo-code when creating a call (same flow for caller and callee): '''create_call()'''[[BR]] {[[BR]] ''// Create the dialog''[[BR]] '''dlg = pjsip_dlg_create_uac/uas();''' ''// Create media transport (pair of RTP/RTCP socket) for''[[BR]] ''// transmitting/receiving the media from remote endpoint''[[BR]] '''media_transport = pjmedia_transport_udp_create();''' ''// Get the socket address info of the media transport''[[BR]] ''// These are needed to create a complete SDP descriptor''[[BR]] '''media_sock_info = pjmedia_transport_get_info(media_transport);''' ''// Create local SDP to be given to invite session''[[BR]] '''sdp = pjmedia_endpt_create_sdp(media_sock_info);''' ''// Create the invite session, giving it both the dialog''[[BR]] ''// and local SDP to be negotiated''[[BR]] '''inv = pjsip_inv_create_uac/uas();'''[[BR]] } '''pjsip_endpt_create_sdp(media_sock_info)'''[[BR]] {[[BR]] ''// Query list of codecs that we support''[[BR]] '''codec_list[] = pjmedia_codec_mgr_enum_codecs();''' ''// Put each codec information in the SDP''[[BR]] ... ''// Put media socket address info in SDP c= and m= line''[[BR]] ... '''return sdp;''' }