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
…1128)

Otherwise, if something in invite_resp_handler fails and
sipsess_terminate is called, no BYE will be sent.
  • Loading branch information
maximilianfridrich authored May 27, 2024
1 parent d021190 commit b3c50e6
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 b3c50e6

Please sign in to comment.