[asterisk-commits] res pjsip session.c: Send 100 Trying out earlier to prevent ... (asterisk[13])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 25 16:41:01 CDT 2017
George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/5514 )
Change subject: res_pjsip_session.c: Send 100 Trying out earlier to prevent retransmissions.
......................................................................
res_pjsip_session.c: Send 100 Trying out earlier to prevent retransmissions.
If ICE is enabled and a STUN server does not respond then we will block
until we give up on the STUN response. This will take nine seconds. In
the mean time the peer that sent the INVITE will send retransmissions.
* Restructure res_pjsip_session.c:new_invite() to send a 100 Trying out
earlier to prevent these retransmissions.
ASTERISK-26890
Change-Id: Ie3fc611e53a0eff6586ad55e4aacad81cf6319a8
---
M res/res_pjsip_session.c
1 file changed, 29 insertions(+), 24 deletions(-)
Approvals:
George Joseph: Looks good to me, approved; Approved for Submit
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index a3110f5..7bd0063 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -2148,12 +2148,29 @@
goto end;
};
- if ((sdp_info = pjsip_rdata_get_sdp_info(invite->rdata)) && (sdp_info->sdp_err == PJ_SUCCESS) && sdp_info->sdp) {
+ pjsip_timer_setting_default(&timer);
+ timer.min_se = invite->session->endpoint->extensions.timer.min_se;
+ timer.sess_expires = invite->session->endpoint->extensions.timer.sess_expires;
+ pjsip_timer_init_session(invite->session->inv_session, &timer);
+
+ /*
+ * At this point, we've verified what we can that won't take awhile,
+ * so let's go ahead and send a 100 Trying out to stop any
+ * retransmissions.
+ */
+ if (pjsip_inv_initial_answer(invite->session->inv_session, invite->rdata, 100, NULL, NULL, &tdata) != PJ_SUCCESS) {
+ pjsip_inv_terminate(invite->session->inv_session, 500, PJ_TRUE);
+ goto end;
+ }
+ ast_sip_session_send_response(invite->session, tdata);
+
+ sdp_info = pjsip_rdata_get_sdp_info(invite->rdata);
+ if (sdp_info && (sdp_info->sdp_err == PJ_SUCCESS) && sdp_info->sdp) {
if (handle_incoming_sdp(invite->session, sdp_info->sdp)) {
- if (pjsip_inv_initial_answer(invite->session->inv_session, invite->rdata, 488, NULL, NULL, &tdata) == PJ_SUCCESS) {
+ tdata = NULL;
+ if (pjsip_inv_end_session(invite->session->inv_session, 488, NULL, &tdata) == PJ_SUCCESS
+ && tdata) {
ast_sip_session_send_response(invite->session, tdata);
- } else {
- pjsip_inv_terminate(invite->session->inv_session, 488, PJ_TRUE);
}
goto end;
}
@@ -2166,31 +2183,19 @@
/* If we were unable to create a local SDP terminate the session early, it won't go anywhere */
if (!local) {
- if (pjsip_inv_initial_answer(invite->session->inv_session, invite->rdata, 500, NULL, NULL, &tdata) == PJ_SUCCESS) {
+ tdata = NULL;
+ if (pjsip_inv_end_session(invite->session->inv_session, 500, NULL, &tdata) == PJ_SUCCESS
+ && tdata) {
ast_sip_session_send_response(invite->session, tdata);
- } else {
- pjsip_inv_terminate(invite->session->inv_session, 500, PJ_TRUE);
}
goto end;
- } else {
- pjsip_inv_set_local_sdp(invite->session->inv_session, local);
- pjmedia_sdp_neg_set_prefer_remote_codec_order(invite->session->inv_session->neg, PJ_FALSE);
+ }
+
+ pjsip_inv_set_local_sdp(invite->session->inv_session, local);
+ pjmedia_sdp_neg_set_prefer_remote_codec_order(invite->session->inv_session->neg, PJ_FALSE);
#ifdef PJMEDIA_SDP_NEG_ANSWER_MULTIPLE_CODECS
- pjmedia_sdp_neg_set_answer_multiple_codecs(invite->session->inv_session->neg, PJ_TRUE);
+ pjmedia_sdp_neg_set_answer_multiple_codecs(invite->session->inv_session->neg, PJ_TRUE);
#endif
- }
-
- pjsip_timer_setting_default(&timer);
- timer.min_se = invite->session->endpoint->extensions.timer.min_se;
- timer.sess_expires = invite->session->endpoint->extensions.timer.sess_expires;
- pjsip_timer_init_session(invite->session->inv_session, &timer);
-
- /* At this point, we've verified what we can, so let's go ahead and send a 100 Trying out */
- if (pjsip_inv_initial_answer(invite->session->inv_session, invite->rdata, 100, NULL, NULL, &tdata) != PJ_SUCCESS) {
- pjsip_inv_terminate(invite->session->inv_session, 500, PJ_TRUE);
- goto end;
- }
- ast_sip_session_send_response(invite->session, tdata);
handle_incoming_request(invite->session, invite->rdata);
--
To view, visit https://gerrit.asterisk.org/5514
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie3fc611e53a0eff6586ad55e4aacad81cf6319a8
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
More information about the asterisk-commits
mailing list