Changeset 5812 for pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
- Timestamp:
- Jun 25, 2018 2:58:18 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
r5714 r5812 163 163 pj_str_t done_tag; /* To tag in RX response with answer */ 164 164 pj_bool_t done_early;/* Negotiation was done for early med? */ 165 pj_bool_t done_early_rel;/* Early med was realiable? */ 165 166 pj_bool_t has_sdp; /* Message with SDP? */ 166 167 }; … … 2001 2002 /* Initialize info that we are following forked media */ 2002 2003 inv->following_fork = PJ_FALSE; 2004 inv->updated_sdp_answer = PJ_FALSE; 2003 2005 2004 2006 /* MUST NOT do multiple SDP offer/answer in a single transaction, 2005 * EXCEPT if: 2006 * - this is an initial UAC INVITE transaction (i.e. not re-INVITE), and 2007 * - the previous negotiation was done on an early media (18x) and 2008 * this response is a final/2xx response, and 2009 * - the 2xx response has different To tag than the 18x response 2010 * (i.e. the request has forked). 2007 * EXCEPT previous nego was in 18x (early media) and any of the following 2008 * condition is met: 2009 * - Non-forking scenario: 2010 * - 'accept_multiple_sdp_answers' is set, and 2011 * - previous early response was not reliable (rfc6337 section 3.1.1). 2012 * - Forking scenario: 2013 * - This response has different To tag than the previous response, and 2014 * - This response is 18x/2xx (early or final). If this is 18x, 2015 * only do multiple SDP nego if 'follow_early_media_fork' is set. 2011 2016 * 2012 * The exception above is to add a rudimentary support for early media 2013 * forking (sample case: custom ringback). See this ticket for more 2014 * info: http://trac.pjsip.org/repos/ticket/657 2017 * See also tickets #657, #1644, #1764, and #2123 for more info. 2015 2018 */ 2016 2019 if (tsx_inv_data->sdp_done) { … … 2021 2024 st_code = rdata->msg_info.msg->line.status.code; 2022 2025 2023 /* Allow final/early response after SDP has been negotiated in early 2024 * media, IF this response is a final/early response with different 2025 * tag. 2026 * See ticket #1644 and #1764 for forked early media case. 2027 */ 2028 if (tsx->role == PJSIP_ROLE_UAC && 2029 (st_code/100 == 2 || 2030 (st_code/10 == 18 /* st_code == 18x */ 2031 && pjsip_cfg()->endpt.follow_early_media_fork)) && 2032 tsx_inv_data->done_early && 2033 pj_stricmp(&tsx_inv_data->done_tag, &res_tag)) 2026 if (tsx->role == PJSIP_ROLE_UAC && tsx_inv_data->done_early && 2027 ( 2028 /* Non-forking scenario */ 2029 ( 2030 !tsx_inv_data->done_early_rel && 2031 (st_code/100 == 2 || st_code/10 == 18) && 2032 pjsip_cfg()->endpt.accept_multiple_sdp_answers && 2033 !pj_stricmp(&tsx_inv_data->done_tag, &res_tag) 2034 ) 2035 || 2036 /* Forking scenario */ 2037 ( 2038 (st_code/100 == 2 || 2039 (st_code/10 == 18 && 2040 pjsip_cfg()->endpt.follow_early_media_fork)) && 2041 pj_stricmp(&tsx_inv_data->done_tag, &res_tag) 2042 ) 2043 ) 2044 ) 2034 2045 { 2035 2046 const pjmedia_sdp_session *reoffer_sdp = NULL; 2036 2047 2037 PJ_LOG(4,(inv->obj_name, "Received forked%s response "2048 PJ_LOG(4,(inv->obj_name, "Received %s response " 2038 2049 "after SDP negotiation has been done in early " 2039 2050 "media. Renegotiating SDP..", … … 2055 2066 } 2056 2067 2057 inv->following_fork = PJ_TRUE; 2068 inv->following_fork = !!pj_stricmp(&tsx_inv_data->done_tag, 2069 &res_tag); 2070 inv->updated_sdp_answer = PJ_TRUE; 2058 2071 2059 2072 } else { … … 2164 2177 status_code = rdata->msg_info.msg->line.status.code; 2165 2178 tsx_inv_data->done_early = (status_code/100==1); 2179 tsx_inv_data->done_early_rel = tsx_inv_data->done_early && 2180 pjsip_100rel_is_reliable(rdata); 2166 2181 pj_strdup(tsx->pool, &tsx_inv_data->done_tag, 2167 2182 &rdata->msg_info.to->tag);
Note: See TracChangeset
for help on using the changeset viewer.