diff --git a/src/sipsess/connect.c b/src/sipsess/connect.c index 6280ed005..56f7322cb 100644 --- a/src/sipsess/connect.c +++ b/src/sipsess/connect.c @@ -148,22 +148,22 @@ static void invite_resp_handler(int err, const struct sip_msg *msg, void *arg) } else if (msg->scode < 300) { + sess->established = true; + sess->hdrs = mem_deref(sess->hdrs); err = sip_dialog_established(sess->dlg) ? sip_dialog_update(sess->dlg, msg) : sip_dialog_create(sess->dlg, msg); - if (err) - goto out; if (sdp) { if (sess->neg_state == SDP_NEG_LOCAL_OFFER) { sess->neg_state = SDP_NEG_DONE; - err = sess->answerh(msg, sess->arg); + err |= sess->answerh(msg, sess->arg); } else if (sess->neg_state == SDP_NEG_NONE) { sess->neg_state = SDP_NEG_REMOTE_OFFER; - err = sess->offerh(&desc, msg, sess->arg); + err |= sess->offerh(&desc, msg, sess->arg); } } @@ -179,7 +179,6 @@ static void invite_resp_handler(int err, const struct sip_msg *msg, void *arg) && mbuf_get_left(desc)) sess->neg_state = SDP_NEG_DONE; - sess->established = true; mem_deref(desc); if (err || sess->terminated)