-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sipsess/connect: set sess->established immediately on 200 receival #1128
Conversation
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without a dialog sending a BYE is not possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dialog is created in sipsess_connect
. Even if this fails, a BYE can still be sent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we send ACK if sip_dialog_create
fails?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If yes, then I would prefer:
if (sdp && !err) {
/*call answer/offer handler*/
}
instead of a second sipsess_ack()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two cases for why sip_dialog_create
might fail:
- We received a malformed response (Contact or Record-Route header are not a valid SIP URI or To tag is not set).
- Something internally failed on our side (e.g. ENOMEM).
Regarding point 1: I looked through RFC 3261 thoroughly and I could not find anything that states what should be done when a malformed response is received to an INVITE. At this point in the code a lot of validation has happened before (sip_msg_decode
and the Via branch is matched in ctrans.c
.).
So I believe sending an ACK is okay even if the Contact or Record-Route headers are malformed - a BYE is sent immediately afterwards anyways to terminate the session.
Same for the second case, I think we should still try to send an ACK even if something failed internally and then we try to terminate the session.
962caa3
to
13dc2c8
Compare
Otherwise, if something in invite_resp_handler fails and sipsess_terminate is called, no BYE will be sent.
13dc2c8
to
33cb491
Compare
Looks good now. |
This is ready for the merge from our side. |
I somehow missed this PR. When |
Thank you @juha-h. In Do you think in e.g.: if (!sip_dialog_cmp_half(sess->dlg, msg)
|| sip_dialog_lseq(sess->dlg) != msg->cseq.num) {
goto out;
} |
My understanding is that for transaction match it is enough that Via and CSeq of response matches to those of the request. But for creation of a session, also dialog identifiers must match. So To/From tag and Call-ID check would be needed. |
#1129 looks OK, since the added |
Otherwise, if something in
invite_resp_handler
fails andsipsess_terminate
is called, no BYE will be sent.