-
Notifications
You must be signed in to change notification settings - Fork 632
Sipmsg validate all contacts #3804
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
Sipmsg validate all contacts #3804
Conversation
9c15692 to
de9a9ba
Compare
de9a9ba to
8e76c90
Compare
8e76c90 to
017de72
Compare
bogdan-iancu
left a comment
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 patch looks fine thank you.
If I may suggest a small simplifying of the code, to get rid of this repeating sequence of:
ret = ... ;
goto failed;
where there is just a return ret.
I would suggest simply doing an inline of return ...... ; instead of setting ret + goto. Also drop the failed label and do return SV_NO_ERROR; at the end.
Up to you if you want to do this change :)
|
@bogdan-iancu I did the inline return, makes more sense so ready to merge whenever CI is good thanks |
Sipmsg validate all contacts (cherry picked from commit 18fdeaf)
Sipmsg validate all contacts (cherry picked from commit 18fdeaf)
|
Thank you @davidtrihy-genesys |
Summary
Extends
sipmsg_validatewithcflag set for validatingContactheaders to multiple different requestsDetails
In response to my testing of the fix outlined in this PR #3803 I found limitations of the
sipmsg_validatefunction which only appliedContactvalidation toINVITE.This extends validation to
REGISTER|UPDATE|SUBSCRIBE|REFER- not taking into account what type of request it is eg. initial or in dialog, so with aREFERa dialog can be created from aREFERrequest according to https://www.rfc-editor.org/rfc/rfc3515#section-2 but an in dialogREFERdoes not honour theContactheader sent but this validation logic does not check that and it will fail, it is designed to be up to the script writer to do the in dialog check themselves.Solution
New static function created to specifically check the
Contactheader which will take into account multiple different aspects of the SIP message.Failure conditions
i. Is a SIP reply
ii. is not a REGISTER request
iii. is a REGISTER request but the
Expiresheader is missing or it is set to a value greater than 0New return code of -30 for when a * is the value but is invalid for the three types of conditions listed in 2.
Compatibility
Depending on how you have written your script and if the behaviour of your OpenSIPs deployment is relying implicitly on the Contact header not being checked for the new requests it could break scripts.