[Asterisk-code-review] res/res pjsip session: Check for presence of an active negot... (asterisk[13])
Matt Jordan
asteriskteam at digium.com
Wed Jun 29 16:02:00 CDT 2016
Matt Jordan has uploaded a new change for review.
https://gerrit.asterisk.org/3111
Change subject: res/res_pjsip_session: Check for presence of an active negotiator
......................................................................
res/res_pjsip_session: Check for presence of an active negotiator
It is possible in certain situations for a session refresh to be invoked
on a PJSIP channel when the negotiatior on the INVITE session has not
yet been established. This patch adds checks for the presence of the
negotiator before calling PJSIP functions that assume it is non-NULL.
Change-Id: I1028323e7e01b0a531865e5412a71b6f6ec4276d
---
M res/res_pjsip_session.c
1 file changed, 8 insertions(+), 6 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/11/3111/1
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 23d2f2f..4ac711e 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -791,12 +791,14 @@
static pjmedia_sdp_session *generate_session_refresh_sdp(struct ast_sip_session *session)
{
pjsip_inv_session *inv_session = session->inv_session;
- const pjmedia_sdp_session *previous_sdp;
+ const pjmedia_sdp_session *previous_sdp = NULL;
- if (pjmedia_sdp_neg_was_answer_remote(inv_session->neg)) {
- pjmedia_sdp_neg_get_active_remote(inv_session->neg, &previous_sdp);
- } else {
- pjmedia_sdp_neg_get_active_local(inv_session->neg, &previous_sdp);
+ if (inv_session->neg) {
+ if (pjmedia_sdp_neg_was_answer_remote(inv_session->neg)) {
+ pjmedia_sdp_neg_get_active_remote(inv_session->neg, &previous_sdp);
+ } else {
+ pjmedia_sdp_neg_get_active_local(inv_session->neg, &previous_sdp);
+ }
}
return create_local_sdp(inv_session, session, previous_sdp);
}
@@ -916,7 +918,7 @@
if (generate_new_sdp) {
/* SDP can only be generated if current negotiation has already completed */
- if (pjmedia_sdp_neg_get_state(inv_session->neg) != PJMEDIA_SDP_NEG_STATE_DONE) {
+ if (inv_session->neg && pjmedia_sdp_neg_get_state(inv_session->neg) != PJMEDIA_SDP_NEG_STATE_DONE) {
ast_debug(3, "Delay session refresh with new SDP to %s because SDP negotiation is not yet done...\n",
ast_sorcery_object_get_id(session->endpoint));
return delay_request(session, on_request_creation, on_sdp_creation,
--
To view, visit https://gerrit.asterisk.org/3111
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1028323e7e01b0a531865e5412a71b6f6ec4276d
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
More information about the asterisk-code-review
mailing list