res_pjsip_session: Add additional checks for delaying session refreshes.
[asterisk/asterisk.git] / channels / chan_pjsip.c
index 1ca5806..b8fb35c 100644 (file)
@@ -1081,12 +1081,16 @@ static int update_connected_line_information(void *data)
                }
        } else {
                enum ast_sip_session_refresh_method method = session->endpoint->id.refresh_method;
+               int generate_new_sdp;
                struct ast_party_id connected_id;
 
                if (session->inv_session->invite_tsx && (session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE)) {
                        method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
                }
 
+               /* Only the INVITE method actually needs SDP, UPDATE can do without */
+               generate_new_sdp = (method == AST_SIP_SESSION_REFRESH_METHOD_INVITE);
+
                /*
                 * We can get away with a shallow copy here because we are
                 * not looking at strings.
@@ -1099,7 +1103,7 @@ static int update_connected_line_information(void *data)
                    (session->endpoint->id.trust_outbound ||
                     ((connected_id.name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED &&
                      (connected_id.number.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED))) {
-                       ast_sip_session_refresh(session, NULL, NULL, NULL, method, 1);
+                       ast_sip_session_refresh(session, NULL, NULL, NULL, method, generate_new_sdp);
                }
        }