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

"Error: Caution! IP address is not from sipgate" when using webhooks #28

Open
michaelSchmidMaloon opened this issue Jan 26, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@michaelSchmidMaloon
Copy link

michaelSchmidMaloon commented Jan 26, 2024

Describe the bug
I'm not sure if I understand the usage of webhooks with sipgate.io correctly. I wrote some code, along with the node examples, that reacts on multiple events, e.g. newCallEvent. I host it on a dedicated machine in AWS that is assigned the WEBHOOK_SERVER_ADDRESS. This is also configured in sipgate.io.
The WEBHOOK_URL is set to some Grafana incoming webhook endpoint. When starting the server and calling a number that's configured for the webhook, the log reads

Caution! IP address is not from sipgate

At this point I'm not sure if I'm supposed to host this "webhook relay" myself or if it should somehow be configured / uploaded to sipgate. But if so, I have no idea how. Would be lovely if someone can point me in the right direction.

To Reproduce
Steps to reproduce the behavior.

Expected behavior
Webhook data being transfered from sipgate to the configured outgoing webhook.

Environment (please complete the following information):

  • OS: node:20-buster docker image
  • Node.js Version 20
  • Library Version 2.15.0

Additional context

const { createWebhookModule } = require("sipgateio");
require("dotenv").config();
const axios = require("axios").default;

process.on('SIGINT', function() {
  console.log("Caught interrupt signal");

  if (true)
      process.exit();
});
 
const outgoingWebhookUrl = process.env.OUTGOING_WEBHOOK_URL;
if (!outgoingWebhookUrl) {
  console.error(
    "Please provide a outgoing webhook URL via the environment variable OUTGOING_WEBHOOK_URL"
  );
  return;
}

const serverAddress = process.env.WEBHOOK_SERVER_ADDRESS;
if (!serverAddress) {
  console.error(
    "Please provide a server address via the environment variable WEBHOOK_SERVER_ADDRESS"
  );
  return;
}

const webhookServerOptions = {
  port: process.env.WEBHOOK_SERVER_PORT || 3000,
  serverAddress,
};
 
createWebhookModule()
  .createServer(webhookServerOptions)
  .then((server) => {
    console.log(
      `Server running at ${webhookServerOptions.serverAddress}:${webhookServerOptions.port}\n` + "Ready for calls"
    );
    server.onNewCall((newCallEvent) => {
      console.log(`New call from ${newCallEvent.from} to ${newCallEvent.to}`);
      axios.post(outgoingWebhookUrl, { })
    });
  });
@michaelSchmidMaloon michaelSchmidMaloon added the bug Something isn't working label Jan 26, 2024
@michaelSchmidMaloon
Copy link
Author

Using skipSignatureVerification: true as in https://github.com/sipgate-io/sipgateio-node?tab=readme-ov-file#security ignores the problem. Though I'm not sure why it's logged in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants