Asterisk 16 - where does the SDP change for B2B

Hello

I’m working on adding RTT to asterisk by adding it to PJSIP. I’m trying to find out where exactly does asterisk change the SDP before it creates a B2B user agent.

Thanks

Asterisk doesn’t “change” the SDP. Each leg is completely independent.

@jcolp thanks for the answer, can you elaborate more on this ?

I’m curious about the egress leg, where does it get the SDP for the invite it creates for the destination phone ?

The SDP generation code comes from pjmedia, but the data structures are constructed in res_pjsip_session.c and res_pjsip_sdp_rtp.c modules in the res directory.

It constructs an offer or answer as appropriate based on configuration.

The SDP is created from the codec preferences passed through to it, either implicitly, based on those elected on the inbound leg, or, more explicitly based on values provided by the dialplan, and from the outbound leg configuration.

Thank you for the advice, I need some help with something else. I’m trying to register the SDP handler for TEXT, but for some reason it does not seem to call the functions for the text.

Is there something i’m missing ?

I’ved added the following lines into res_pjsip_sdp_rtc.c

/*! \brief SDP handler for 'text' media stream */
static struct ast_sip_session_sdp_handler text_sdp_handler = {
        .id = STR_TEXT,
        .negotiate_incoming_sdp_stream = negotiate_incoming_sdp_stream,
        .create_outgoing_sdp_stream = create_outgoing_sdp_stream,
        .apply_negotiated_sdp_stream = apply_negotiated_sdp_stream,
        .change_outgoing_sdp_stream_media_address = change_outgoing_sdp_stream_media_address,
        .stream_stop = stream_stop,
        .stream_destroy = stream_destroy,
};

in load module

    if (ast_sip_session_register_sdp_handler(&text_sdp_handler, STR_TEXT)) {
        ast_log(LOG_ERROR, "Unable to register SDP handler for %s stream type\n", STR_TEXT);
        goto end;
    }

in static int unload_module(void)

ast_sip_session_unregister_sdp_handler(&text_sdp_handler, STR_TEXT);

I’d suggest examining res_pjsip_session and adding log messages to understand what it is doing, and why your code would not be called.