Merge "chan_pjsip: Fix crash on reINVITE before initial INVITE completes."

changes/15/1415/2
Joshua Colp 10 years ago committed by Gerrit Code Review
commit 38519aeadf

@ -2134,7 +2134,8 @@ static int chan_pjsip_incoming_request(struct ast_sip_session *session, struct p
return 0; return 0;
} }
if (session->inv_session->state >= PJSIP_INV_STATE_CONFIRMED) { /* Check for a to-tag to determine if this is a reinvite */
if (rdata->msg_info.to->tag.slen) {
/* Weird case. We've received a reinvite but we don't have a channel. The most /* Weird case. We've received a reinvite but we don't have a channel. The most
* typical case for this happening is that a blind transfer fails, and so the * typical case for this happening is that a blind transfer fails, and so the
* transferer attempts to reinvite himself back into the call. We already got * transferer attempts to reinvite himself back into the call. We already got
@ -2181,8 +2182,9 @@ static int call_pickup_incoming_request(struct ast_sip_session *session, pjsip_r
struct ast_features_pickup_config *pickup_cfg; struct ast_features_pickup_config *pickup_cfg;
struct ast_channel *chan; struct ast_channel *chan;
/* We don't care about reinvites */ /* Check for a to-tag to determine if this is a reinvite */
if (session->inv_session->state >= PJSIP_INV_STATE_CONFIRMED) { if (rdata->msg_info.to->tag.slen) {
/* We don't care about reinvites */
return 0; return 0;
} }
@ -2229,8 +2231,9 @@ static int pbx_start_incoming_request(struct ast_sip_session *session, pjsip_rx_
{ {
int res; int res;
/* We don't care about reinvites */ /* Check for a to-tag to determine if this is a reinvite */
if (session->inv_session->state >= PJSIP_INV_STATE_CONFIRMED) { if (rdata->msg_info.to->tag.slen) {
/* We don't care about reinvites */
return 0; return 0;
} }

@ -351,10 +351,11 @@ static void update_incoming_connected_line(struct ast_sip_session *session, pjsi
*/ */
static int caller_id_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata) static int caller_id_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata)
{ {
if (session->inv_session->state < PJSIP_INV_STATE_CONFIRMED) { if (!session->channel) {
/* /*
* Initial inbound INVITE. Set the session ID directly * Since we have no channel this must be the initial inbound
* because the channel has not been created yet. * INVITE. Set the session ID directly because the channel
* has not been created yet.
*/ */
if (session->endpoint->id.trust_inbound if (session->endpoint->id.trust_inbound
&& (!set_id_from_pai(rdata, &session->id) && (!set_id_from_pai(rdata, &session->id)
@ -367,9 +368,10 @@ static int caller_id_incoming_request(struct ast_sip_session *session, pjsip_rx_
if (!session->endpoint->id.self.number.valid) { if (!session->endpoint->id.self.number.valid) {
set_id_from_from(rdata, &session->id); set_id_from_from(rdata, &session->id);
} }
} else if (session->channel) { } else {
/* Reinvite. Check for changes to the ID and queue a connected line /*
* update if necessary * ReINVITE or UPDATE. Check for changes to the ID and queue
* a connected line update if necessary.
*/ */
update_incoming_connected_line(session, rdata); update_incoming_connected_line(session, rdata);
} }

Loading…
Cancel
Save