[asterisk-dev] PJSIP: Is SDP answer? Is SDP offer?

Joshua C. Colp jcolp at digium.com
Wed Mar 31 10:07:30 CDT 2021


On Wed, Mar 31, 2021 at 11:56 AM Alexander Traud <pabstraud at compuserve.com>
wrote:

> In the function res_pjsip_sdp_rtp:setup_sdes_srtp(.), an upcoming patch of
> mine needs to determine whether that code processes an SDP answer or an SDP
> offer. Is there (somewhere) a flag or condition which I can check?
>
> In chan_sip, I can use AST_LIST_EMPTY(sip_pvt->offered_media). Does a
> similar trick work with via the struct pjmedia_sdp_media?
>

No, you can't use what is passed in to determine this. Passing in the
session however would give access to the INVITE session and the SDP
negotiator. It allows you to query state using pjmedia_sdp_neg_get_state[1]
which can tell you whether there is a remote offer or not. There are also
other SDP negotiator calls such as pjmedia_sdp_neg_was_answer_remote[2].
Which is applicable depends on when the function is called, during
negotiation or after negotiation is complete (which are two separate steps).

[1]
https://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__SDP__NEG.htm#gad2ee6d1a7bf2976c1ac9642b70b9a2fc
[2]
https://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__SDP__NEG.htm#ga86557cce0d6db9e67d17f1b2554bbce6

-- 
Joshua C. Colp
Asterisk Technical Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20210331/36628eb7/attachment.html>


More information about the asterisk-dev mailing list