fonoster / routr

⚡ The future of programmable SIP servers.
https://routr.io
MIT License
1.42k stars 147 forks source link

Use routr for a close group #48

Closed plague-doctor closed 4 years ago

plague-doctor commented 5 years ago

Guys, I am so happy I have found your project that I cannot express in words. :clap: I just need some hand-holding and maybe a help with config files, etc. We have a close group of users (6 people) and we would like to be able to communicate using VoIP. We do not need conference calls or calls outside of the group. We have a mixture of VoIP devices ranges from SoftPhones (LinPhone, CSIPSimple) to Yealink VoIP devices. I would like to host routr.io on my Docker server. Can you guys give me some suggestions on how to configure routr to cater to what we are looking for? What ports should I open on the firewall? Any help would be highly appreciated.

psanders commented 5 years ago

For your specific use case, I recommend looking into the docker/compose guide and basic-setup guide. Those two guides will help you run Routr in your local network using Docker.

The next challenge is making Routr available outside of your network. Since you are running the service behind a NAT you will need to tell Routr to use your outside-facing IP. Also, You can use port 5060 unless is blocked by your ISP.

Finally, I recommend looking into a service like no-ip to make your setup more user friendly.

plague-doctor commented 5 years ago

Thank you very much for your prompt reply, @psanders. I have configured my setup according to your suggestions, but few problems came up:

My config files look like this:

--------------------------------------------------------------- config.yml 
apiVersion: v1beta1
spec:
  externAddr: 203.xxx.xxx.xxx
  localnets: [192.168.1.0/24,192.168.10.0/24]

  transport:
    - protocol: udp
      port: 5060
    - protocol: tcp
      port: 5060
    - protocol: tls
      port: 5061
--------------------------------------------------------------- domains.yml
- apiVersion: v1beta1
  kind: Domain
  metadata:
    name: My SIP Server
  spec:
    context:
      domainUri: sip.my-domain.net
--------------------------------------------------------------- gateways.yml
- apiVersion: v1beta1
  kind: Gateway
  metadata:
    name: SIP-PROVIDER
    ref: GW01
  spec:
    host: my-sip-provider.com
    transport: tls
    credentials:
      username: 'username'
      secret: password
--------------------------------------------------------------- numbers.yml
- apiVersion: v1beta1
  kind: Number
  metadata:
    gwRef: GW01
    geoInfo:
      city: My-City
      country: My-Country
      countryISOCode: My-Country-Code
  spec:
    location:
      telUrl: 'tel:0000000000'
      aorLink: 'sip:1001@sip.my-domain.net'
--------------------------------------------------------------- agents.yml
- apiVersion: v1beta1
  kind: Agent
  metadata:
    name: Yealink
  spec:
    credentials:
      username: '1000'
      secret: '12345'
    domains: [sip.my-domain.net]

- apiVersion: v1beta1
  kind: Agent
  metadata:
    name: Mobile
  spec:
    credentials:
      username: '1001'
      secret: '12345'
    domains: [sip.my-domain.net]
--------------------------------------------------------------- peers.yml
- apiVersion: v1beta1
  kind: Peer
  metadata:
    name: Asterisk PBX
  spec:
    credentials:
      username: ast
      secret: '1234'
--------------------------------------------------------------- users.yml
- apiVersion: v1beta1
  kind: User
  metadata:
    name: Admin
  spec:
    credentials:
      username: 'admin'
      secret: 'changeit'

Router configuration:

Case 1: Using 1.0.0-rc3 release:

Case 2: Using previous 1.0.0-rc2 release:

Questions:

  1. Please help with the configuration, so I can use external devices (mobiles, other group members devices).
  2. Is there a problem with latest 1.0.0-rc3 release? [ERROR] TypeError: v.includes is not a function ?
  3. In my use case I do not need to use any gateway. However I still need to provide files gateways.yml, numbers.yml... Routr fails without those files... Is there a way to ignore this requirement?
  4. I do not have any Asterisk PBX. Do I still need to provide peers.yml configuration? How to disable it?
psanders commented 5 years ago

@plague-doctor

I'm sorry you are having this many issues. I appreciate the detail report.

Case 1: Using 1.0.0-rc3 release: Both my devices can successfully register with routr server (over TCP or TLS. UDP doesn't work). When trying to call, I get this error: [ERROR] TypeError: v.includes is not a function

I successfully reproduced this issues and will work on fixing this in the next release. This TypeError seems to be related to the default JS engine. Try setting the environment variable ROUTR_JS_ENGINE to graal.js and let me know how it goes.

  1. Please help with the configuration, so I can use external devices (mobiles, other group members devices).

Are you using a softphone on your mobile? If yes, which software are you using? I'm going to try to reproduce this issue tonight.

  1. In my use case I do not need to use any gateway. However I still need to provide files gateways.yml, numbers.yml... Routr fails without those files... Is there a way to ignore this requirement?
  2. I do not have any Asterisk PBX. Do I still need to provide peers.yml configuration? How to disable it?

Unfortunately there is no way to disable this requirement. I can see how this is a pain, and will remove the requirement in the next version

plague-doctor commented 5 years ago

@psanders

I'm sorry you are having this many issues. I appreciate the detail report.

No worries at all. I am happy to be your guinea pig. :smile:

[...] Try setting the environment variable ROUTR_JS_ENGINE to graal.js and let me know how it goes.

Done. The 1.0.0-rc3 works fine now and doesn't throw the error it did before. One issue has been addressed :+1:

Unfortunately there is no way to disable this requirement. I can see how this is a pain, and will remove the requirement in the next version

This is another good news. Thanks for understanding. :+1:

However other issues are still holding strong. When both devices are inside my local networks (192.168.1.20 and 192.168.10.20) I can have a connection - everything is fine, the voip quality is great.

When mobile is outside the story is different.

The logs look like this:

Attaching to routr
routr    | [INFO ] Starting Routr
routr    | [INFO ] ExternAddr is 203.xxx.xxx.xxx
routr    | [INFO ] Localnets is 172.25.0.2/16
routr    | [INFO ] using Disabled tls auth policy
routr    | [WARN ] using default tls security policy
routr    | [INFO ] javax.net.ssl.trustStorePassword is null, using the password passed through javax.net.ssl.keyStorePassword
routr    | [WARN ] Using default truststore type pkcs12
routr    | [INFO ] Listening on 172.25.0.2:5060 [udp]
routr    | [INFO ] Listening on 172.25.0.2:5060 [tcp]
routr    | [INFO ] Listening on 172.25.0.2:5061 [tls]
routr    | [INFO ] Starting Registry service
routr    | [INFO ] Starting Restful service (port: 4567, apiPath: /api/v1beta1)
routr    | [INFO ] serving msg on call id FXwPPxI9wLIFBYtxGkIP2g..
routr    | [INFO ] serving msg on call id FXwPPxI9wLIFBYtxGkIP2g..
routr    | [INFO ] serving msg on call id W0yYHogPwOmq20CQiJ7qUA..
routr    | [INFO ] serving msg on call id W0yYHogPwOmq20CQiJ7qUA..
routr    | [INFO ] serving msg on call id W0yYHogPwOmq20CQiJ7qUA..
routr    | [INFO ] serving msg on call id AOXkkKiAyUI6pUQ-0_LNTA..
routr    | [INFO ] serving msg on call id AOXkkKiAyUI6pUQ-0_LNTA..
routr    | [INFO ] serving msg on call id 2_1246923748@192.168.10.20
routr    | [INFO ] serving msg on call id 2_1246923748@192.168.10.20
routr    | [INFO ] serving msg on call id 2_1246923748@192.168.10.20
routr    | [INFO ] serving msg on call id 2_1246923748@192.168.10.20
routr    | [INFO ] serving msg on call id 2_1246923748@192.168.10.20
routr    | [INFO ] serving msg on call id 2_4130068564@192.168.10.20
routr    | [INFO ] serving msg on call id 2_4130068564@192.168.10.20
routr    | [INFO ] serving msg on call id AOXkkKiAyUI6pUQ-0_LNTA..
routr    | [INFO ] serving msg on call id OE99qYc3xTcib2dW3g0Lhw..
routr    | [INFO ] serving msg on call id OE99qYc3xTcib2dW3g0Lhw..
routr    | [INFO ] serving msg on call id OE99qYc3xTcib2dW3g0Lhw..
routr    | [INFO ] serving msg on call id ISnaN5acwhPFKLgMN8C7fg..
routr    | [INFO ] serving msg on call id ISnaN5acwhPFKLgMN8C7fg..
routr    | [INFO ] serving msg on call id ISnaN5acwhPFKLgMN8C7fg..
[...]

The softphones I have tried on my mobile:

If you could suggest any other (preferably privacy oriented) softphone, I will be happy to give it a try.

My architecture:

      /---------- INTERNET (sip.my-domain.net from the config files)
      | 
  pfSense  (VoIP ports forwarded to Docker Server in DMZ)
      |
      |------ LAN (192.168.1.0/24)  # This is where mobile gets connected inside network
      |----------- PRIV (192.168.10.0/24)  # The Yealink is connected permanently
      \----------- DMZ (10.0.0.0/24)  # Docker Server lives here
psanders commented 5 years ago

The good news is that I was able to reproduce your situation. It appears to be a signaling issue due to the NAT. Allow me some time to think about a fix.

jack-movember commented 5 years ago

I have noticed there is a new stable release. Good job @psanders :+1: Should this release fix issues I have got?

psanders commented 5 years ago

Unfortunately thats not the case. I was installing a release workflow in the repo, and created a release by mistake. I'm still working in a solution for this issue.

sosaucily commented 4 years ago

The issues getting SIP to work behind NATs seem quite substantial, at least it seems that way to me as many of the SIP servers I've tried in the past often have the issue of getting one SIP client to be able to forward RTP audio to the other when both are behind a NAT. If routr can find an easy way to configure this, that would be great. I've often seen other services use STUN or something similar to solve this. But I would prefer Routr because of its great clean codebase and simplicity

psanders commented 4 years ago

@sosaucily good point, NAT related issues are the worst. They consume most of my time with the project. It would be ideal to have something like rtpproxy as a plugging for Routr.

sosaucily commented 4 years ago

👍 I also see Coturn STUN/TURN/ICE has a good community. Maybe an easy integration with that.

psanders commented 4 years ago

After taking a more in-depth look at this issue, I noticed that this issue was a combination of your settings in Zoiper and potentially your Mobile network. After configuring my Zoiper using the No audio or one-way audio guide, I was able to get calling to work from Mobile-to-Wifi.

However, to get Wifi-to-Mobile to work, I needed to use a VPN because my service provider blocks VoIP traffic.

I'm closing this issue, but feel free to re-open if you still have problems.