-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add SIP Request Ping and Registration Options Feature #5382
base: master
Are you sure you want to change the base?
Add SIP Request Ping and Registration Options Feature #5382
Conversation
@louislam , @thomasleveil , Lets give it a try . I'm open for discussion. |
@CommanderStorm , |
I did not incorporate SIP Register requests because it is irrelevant for my use cases, but maybe extend on my PR (which has had no response) #5362 ? |
@louislam, @CommanderStorm, Please review the changes. The code is ready for merging. Kindly merge it so I can incorporate the latest updates you make. |
@laupse ? |
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.
Sorry for the long wait. Exams are killing me currently.
Here are a few things which need to be changed.
Given that some of the changes requested are major, this will need another round of review
@@ -0,0 +1,67 @@ | |||
BEGIN TRANSACTION; |
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.
This is the old way of writing migrations. Please change this to the newer js files.
@@ -34,6 +34,163 @@ const rootCertificates = rootCertificatesFingerprints(); | |||
* 2 = PENDING | |||
* 3 = MAINTENANCE | |||
*/ | |||
|
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.
New monitors need to be in their own file. Please see the DNS monitor for further context
@@ -0,0 +1,93 @@ | |||
const NotificationProvider = require("./notification-provider"); | |||
|
|||
class SIP extends NotificationProvider { |
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.
Please move the notification provider to a different PR.
Otherwise it is not review
The rest of the code (for example utils) is convoluted enough.
@@ -34,6 +34,163 @@ const rootCertificates = rootCertificatesFingerprints(); | |||
* 2 = PENDING | |||
* 3 = MAINTENANCE | |||
*/ | |||
|
|||
const sipStatusCodes = [ |
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.
This seems like http status codes?
If they are, there surely is a better way than this.. the request should have a text field or something similar
transport: transport, | ||
}; | ||
const registrationResponse = await exports.sipRegister(registerRequest); | ||
console.log("registrationResponse", registrationResponse); |
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.
Please use our logging functionality instead of console.log as console.log cannot be filtered
proxyAuthenticateHeader | ||
); | ||
|
||
const secondResponse = await exports.sipRegister(authorizedRegisterRequest); |
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.
This seems weird.
Would it not be better to always supply the pw if supplied?
exports.sipRegister = function (registerRequest) { | ||
const server = sip.create({ | ||
logger: "console", | ||
port: 25060, |
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 this not be sipPort?
timeoutID = setTimeout(() => { | ||
console.error("SIP Register request timed out."); | ||
reject(new Error("SIP Register request timed out.")); | ||
cleanup(); |
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.
Cleanup after rejection seems strange.. does this work?
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma
Tick the checkbox if you understand [x]:
Description
@louislam ,
This SIP module is able to process both a failure to receive OPTIONS requests, as well as a failure to REGISTER as a valid endpoint. It supports UDP, TCP, and TLS on a user-selectable port (not just fixed to 5060/5061), and supports either No Authentication or Basic Authentication. The monitor's history shows up/down events, the reason behind them, and response latency. Additionally, there is an option to process 503 responses from the SIP server (or monitored SIP device), as "Maintenance", meaning if a 503 is received, the monitor is immediately placed into an adhoc "maintenance" rather than shown as down (upon restore of normal SIP service, the maintenance flag is removed from the monitor).
Could we talk about it further? it will be a great addition.
Fixes #(issue)
Type of change
Please delete any options that are not relevant.
Checklist
Screenshots (if any)
Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.