Skip to content

Commit

Permalink
sipsess/connect: set sess->established immediately on 200 receival
Browse files Browse the repository at this point in the history
Otherwise, if something in invite_resp_handler fails and
sipsess_terminate is called, no BYE will be sent.
  • Loading branch information
maximilianfridrich committed May 23, 2024
1 parent f2f1b3e commit 33cb491
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/sipsess/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ 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 (sdp && !err) {
if (sess->neg_state == SDP_NEG_LOCAL_OFFER) {
sess->neg_state = SDP_NEG_DONE;
err = sess->answerh(msg, sess->arg);
Expand All @@ -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)
Expand Down

0 comments on commit 33cb491

Please sign in to comment.