diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 4b086211452a08d1f05dfdecb80a52d05d85b02e..57c673e0c6e2d1d621f9ca319c75a79c60a6eca7 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 285e9015e6da8f55bec659c4e5232d61a20c7499..e44820214c701bf7cabd920a7bd159fbfa6395df 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);