diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 4b08621145..57c673e0c6 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -1097,6 +1097,11 @@ static void change_outgoing_sdp_stream_media_address(pjsip_tx_data *tdata, struc char host[NI_MAXHOST]; struct ast_sockaddr addr = { { 0, } }; + /* If the stream has been rejected there will be no connection line */ + if (!stream->conn) { + return; + } + ast_copy_pj_str(host, &stream->conn->addr, sizeof(host)); ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID); diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c index 285e9015e6..e44820214c 100644 --- a/res/res_pjsip_t38.c +++ b/res/res_pjsip_t38.c @@ -776,6 +776,11 @@ static void change_outgoing_sdp_stream_media_address(pjsip_tx_data *tdata, struc char host[NI_MAXHOST]; struct ast_sockaddr addr = { { 0, } }; + /* If the stream has been rejected there will be no connection line */ + if (!stream->conn) { + return; + } + ast_copy_pj_str(host, &stream->conn->addr, sizeof(host)); ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID);