From a1e5813843152106f91adb73ae1a8988a8e9f4c2 Mon Sep 17 00:00:00 2001 From: Pedro Sanders Date: Sun, 14 Mar 2021 16:25:17 -0400 Subject: [PATCH] Fixed bug for removing calls without having ex_rtpEngine enabled --- compliance.yml | 40 +++++++++++++++------------ .env => env_test | 0 mod/core/config.unit.test.js | 1 - mod/core/processor/request_handler.js | 5 +++- nattests.yml | 25 ++++++++++++----- 5 files changed, 44 insertions(+), 27 deletions(-) rename .env => env_test (100%) diff --git a/compliance.yml b/compliance.yml index 0de6bd245..17131bf0f 100644 --- a/compliance.yml +++ b/compliance.yml @@ -1,13 +1,16 @@ version: '3.7' services: + redis: - image: redis:4.0.5-alpine + image: redis:6.0.3-alpine command: ["redis-server", "--appendonly", "yes"] expose: [6379] + routr-eet: image: fonoster/routr-eet:latest expose: [5061, 5062] - env_file: .env + env_file: env_test + routr: links: - "routr-eet:sip.provider.net" @@ -15,22 +18,23 @@ services: context: . image: fonoster/routr:latest environment: - ROUTR_EXTERN_ADDR: 127.0.0.1 - ROUTR_DS_PROVIDER: redis_data_provider - ROUTR_DS_PARAMETERS: host=redis,port=6379 + EXTERN_ADDR: 127.0.0.1 + DATA_SOURCE_PROVIDER: redis_data_provider + DATA_SOURCE_PARAMETERS: host=redis,port=6379 expose: [4567, 5060] + provisioner: - build: - context: .rctl - entrypoint: | - sh -c ' - while ! nc -z routr 4567; do sleep 5; done - rctl login https://routr:4567/api/v1beta1 -u admin -p changeit - rctl create -f /opt/routr/config/gateways.yml - rctl create -f /opt/routr/config/numbers.yml - rctl create -f /opt/routr/config/domains.yml - rctl create -f /opt/routr/config/agents.yml - while sleep 3600; do :; done - ' + image: fonoster/routr-ctl + entrypoint: > + /bin/sh -c " + set -e; + while ! nc -z routr 4567;do sleep 5; done + rctl login https://routr:4567/api/v1beta1 -u admin -p changeit; + rctl create -f /config/gateways.yml + rctl create -f /config/numbers.yml + rctl create -f /config/domains.yml + rctl create -f /config/agents.yml + exit 0; + " volumes: - - ./config:/opt/routr/config:ro + - ./config:/config:ro diff --git a/.env b/env_test similarity index 100% rename from .env rename to env_test diff --git a/mod/core/config.unit.test.js b/mod/core/config.unit.test.js index 9ae6d8541..c590181d6 100644 --- a/mod/core/config.unit.test.js +++ b/mod/core/config.unit.test.js @@ -9,7 +9,6 @@ const sinon = require('sinon') const sinonChai = require('sinon-chai') chai.use(sinonChai) const expect = chai.expect -var sandbox = sinon.createSandbox() const defaults = require('@routr/core/config/config_defaults')(new Date()) const configFromEnv = require('@routr/core/config/config_from_env') diff --git a/mod/core/processor/request_handler.js b/mod/core/processor/request_handler.js index 41cbde25f..e6de93bc2 100644 --- a/mod/core/processor/request_handler.js +++ b/mod/core/processor/request_handler.js @@ -190,7 +190,10 @@ class RequestHandler { ) } - if (request.getMethod() === Request.BYE) { + if ( + request.getMethod() === Request.BYE && + config.spec.ex_rtpEngine.enabled + ) { const callId = request.getHeader(CallIdHeader.NAME).getCallId() const fromTag = request.getHeader(FromHeader.NAME).getTag() await this.rtpeConnector.delete(callId, fromTag) diff --git a/nattests.yml b/nattests.yml index f5f0612ac..88bc9f617 100644 --- a/nattests.yml +++ b/nattests.yml @@ -9,6 +9,7 @@ services: ipv4_address: $REDIS_PUBLIC_IP private_net: ipv4_address: $REDIS_PRIVATE_IP + proxy_a: links: - "phone_s1:sip.provider.net" @@ -27,6 +28,7 @@ services: ipv4_address: $PROXY_A_PUBLIC_IP private_net: ipv4_address: $PROXY_A_PRIVATE_IP + proxy_b: links: - "phone_s1:sip.provider.net" @@ -43,8 +45,9 @@ services: networks: public_net: ipv4_address: $PROXY_B_PUBLIC_IP + phone_e1: - env_file: .env + env_file: env_test image: fonoster/routr-eet:latest expose: [5060, 9330] networks: @@ -55,8 +58,9 @@ services: while ! nc -z $PROXY_A_PRIVATE_IP 4567; do sleep 0.1; done node eet/ua_srv.js ' + phone_e2: - env_file: .env + env_file: env_test image: fonoster/routr-eet:latest expose: [5060, 9330] networks: @@ -67,34 +71,39 @@ services: while ! nc -z $PROXY_A_PRIVATE_IP 4567; do sleep 0.1; done node eet/ua_srv.js ' + phone_e3: - env_file: .env + env_file: env_test image: fonoster/routr-eet:latest expose: [5060] networks: public_net: ipv4_address: $PHONE_E3_IP + phone_e4: - env_file: .env + env_file: env_test image: fonoster/routr-eet:latest expose: [5060, 9330] networks: public_net: ipv4_address: $PHONE_E4_IP + phone_s1: - env_file: .env + env_file: env_test image: fonoster/routr-eet:latest expose: [5060, 9330] networks: public_net: ipv4_address: $PHONE_S1_IP + phone_s2: - env_file: .env + env_file: env_test image: fonoster/routr-eet:latest expose: [5060, 9330] networks: public_net: ipv4_address: $PHONE_S2_IP + provisioner: build: context: .rctl @@ -115,8 +124,9 @@ services: ' volumes: - ./config:/opt/routr/config:ro + controller: - env_file: .env + env_file: env_test image: fonoster/routr-eet:latest networks: public_net: @@ -129,6 +139,7 @@ services: while ! nc -z $PHONE_E2_IP $UA_SRV_DEFAULT_PORT; do sleep 0.1; done node eet/ua_ctl.js ' + networks: public_net: driver: "bridge"