Skip to content
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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

msaleemCinnova
Copy link

@msaleemCinnova msaleemCinnova commented Nov 26, 2024

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
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]:

  • I have read and understand the pull request rules.

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.

  • User interface (UI)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
  • My changes generate no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

image (5)

image (3)
image (1)

image (2)
image (1)
image (3)
image (6)

image

image (1)
image (2)
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.

This was referenced Nov 26, 2024
@msaleemCinnova
Copy link
Author

@louislam , @thomasleveil , Lets give it a try . I'm open for discussion.

@msaleemCinnova
Copy link
Author

@CommanderStorm ,
My request to become contributor.

@edman80
Copy link

edman80 commented Dec 2, 2024

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 ?

@msaleemCinnova
Copy link
Author

@louislam, @CommanderStorm, Please review the changes. The code is ready for merging. Kindly merge it so I can incorporate the latest updates you make.

@msaleemCinnova
Copy link
Author

@laupse ?

Copy link
Collaborator

@CommanderStorm CommanderStorm left a 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;
Copy link
Collaborator

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
*/

Copy link
Collaborator

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 {
Copy link
Collaborator

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 = [
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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,
Copy link
Collaborator

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();
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants