diff --git a/scripts/ngcp-dlgcnt-check b/scripts/ngcp-dlgcnt-check index 796e23a..64261a1 100755 --- a/scripts/ngcp-dlgcnt-check +++ b/scripts/ngcp-dlgcnt-check @@ -31,7 +31,7 @@ if ! ngcp-check_active -q ; then fi # read kamailio.proxy.dlgcnt.pair_redis_db -REDIS_DB="$(ngcp-dlgcnt-clean -c|| echo 4)" +REDIS_DB="$(ngcp-dlgcnt-clean -c 2>/dev/null|| echo 4)" # full list REDIS_CALLIDS=$(mktemp) @@ -42,7 +42,7 @@ egrep -v '^list:' "$REDIS_CALLIDS" > "$REDIS_CALLIDS_FILTER" || true # list of dialogs known by kamailio KAM_CALLIDS=$(mktemp) -ngcp-sercmd proxy dlg.list | awk -F: '/call-id:/ { print $2}' > "$KAM_CALLIDS" +ngcp-sercmd proxy dlg.list | awk -F' ' '/call-id:/ { print $2}' > "$KAM_CALLIDS" while read -r i ; do if ! grep -q "$i" "$KAM_CALLIDS" ; then diff --git a/scripts/ngcp-dlgcnt-clean b/scripts/ngcp-dlgcnt-clean index 9631ea6..c368cfd 100755 --- a/scripts/ngcp-dlgcnt-clean +++ b/scripts/ngcp-dlgcnt-clean @@ -13,7 +13,7 @@ local function get_config() local ok,e = pcall(dofile,config) if not ok then io.stderr:write(e..'\n') - print("using defaults\n") + io.stderr:write("using defaults\n") end end diff --git a/scripts/ngcp-dlglist-clean b/scripts/ngcp-dlglist-clean index 3bfaab7..074dbcd 100644 --- a/scripts/ngcp-dlglist-clean +++ b/scripts/ngcp-dlglist-clean @@ -13,7 +13,7 @@ local function get_config() local ok,e = pcall(dofile,config) if not ok then io.stderr:write(e..'\n') - print("using defaults\n") + io.stderr:write("using defaults\n") end end diff --git a/t/Dockerfile b/t/Dockerfile index aa4144f..5f72046 100644 --- a/t/Dockerfile +++ b/t/Dockerfile @@ -5,7 +5,7 @@ FROM docker.mgm.sipwise.com/sipwise-jessie:latest # is updated with the current date. It will force refresh of all # of the base images and things like `apt-get update` won't be using # old cached versions when the Dockerfile is built. -ENV REFRESHED_AT 2016-12-1 +ENV REFRESHED_AT 2016-12-2 # TODO - the release-trunk-jessie is too dynamic yet, though required for lua-unit backport RUN echo "deb https://deb.sipwise.com/autobuild/ release-trunk-jessie main" >>/etc/apt/sources.list diff --git a/tests/fixtures/koredis.cmd b/tests/fixtures/koredis.cmd index e14f3bb..96bf4d3 100644 --- a/tests/fixtures/koredis.cmd +++ b/tests/fixtures/koredis.cmd @@ -1,3 +1,3 @@ -ngcp-dlgcnt-clean f81f8a33-2dbd-1235-018c-0090fb484030-pbx_1 -ngcp-dlgcnt-clean f81f8a33-2dbd-1235-018c-0090fb484030 -ngcp-dlglist-clean f81f8a33-2dbd-1235-018c-0090fb484030 +ngcp-dlgcnt-clean f81f8a33-2dbd-1235-018c-0090fb484030:5060-pbx_1 +ngcp-dlgcnt-clean f81f8a33-2dbd-1235-018c-0090fb484030:5060 +ngcp-dlglist-clean f81f8a33-2dbd-1235-018c-0090fb484030:5060 diff --git a/tests/fixtures/koredis.dlg b/tests/fixtures/koredis.dlg index dcecfdf..2e7fdb4 100644 --- a/tests/fixtures/koredis.dlg +++ b/tests/fixtures/koredis.dlg @@ -1,7 +1,7 @@ { h_entry: 51 h_id: 3315 - call-id: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107 + call-id: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5080 from_uri: sip:390649904073@voxbone.com to_uri: sip:390240708163@46.29.177.34 state: 4 @@ -45,7 +45,7 @@ recent_calls_key: 38de282f-5c5c-4d71-8a0d-b300a68d86ec } { - lua_dlg_callid: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107 + lua_dlg_callid: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5080 } } } diff --git a/tests/fixtures/koredis.redis b/tests/fixtures/koredis.redis index 4868f23..e9d3977 100644 --- a/tests/fixtures/koredis.redis +++ b/tests/fixtures/koredis.redis @@ -1,4 +1,4 @@ -WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107 -f81f8a33-2dbd-1235-018c-0090fb484030-pbx_1 -f81f8a33-2dbd-1235-018c-0090fb484030 -list:f81f8a33-2dbd-1235-018c-0090fb484030 +WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5080 +f81f8a33-2dbd-1235-018c-0090fb484030:5060-pbx_1 +f81f8a33-2dbd-1235-018c-0090fb484030:5060 +list:f81f8a33-2dbd-1235-018c-0090fb484030:5060 diff --git a/tests/fixtures/okredis.dlg b/tests/fixtures/okredis.dlg index 8173776..604bcbe 100644 --- a/tests/fixtures/okredis.dlg +++ b/tests/fixtures/okredis.dlg @@ -1,7 +1,7 @@ { h_entry: 51 h_id: 3315 - call-id: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107 + call-id: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5060 from_uri: sip:390649904073@voxbone.com to_uri: sip:390240708163@46.29.177.34 state: 4 @@ -45,14 +45,14 @@ recent_calls_key: 38de282f-5c5c-4d71-8a0d-b300a68d86ec } { - lua_dlg_callid: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107 + lua_dlg_callid: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5060 } } } { h_entry: 52 h_id: 3316 - call-id: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107-pbx_1 + call-id: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5060-pbx_1 from_uri: sip:390649904073@voxbone.com to_uri: sip:390240708163@46.29.177.34 state: 4 @@ -96,7 +96,7 @@ recent_calls_key: 38de282f-5c5c-4d71-8a0d-b300a68d86ec } { - lua_dlg_callid: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107-pbx_1 + lua_dlg_callid: WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5060-pbx_1 } } } diff --git a/tests/fixtures/okredis.redis b/tests/fixtures/okredis.redis index b40b325..f597318 100644 --- a/tests/fixtures/okredis.redis +++ b/tests/fixtures/okredis.redis @@ -1,3 +1,3 @@ -WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107-pbx_1 -WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107 -list:WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107 +WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5060-pbx_1 +WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5060 +list:WSGH2SB52VHYLPX4VQQ6N4B2ZM@81.201.82.107:5060 diff --git a/tests/test_dlgcnt.py b/tests/test_dlgcnt.py index 158c953..5c42680 100755 --- a/tests/test_dlgcnt.py +++ b/tests/test_dlgcnt.py @@ -108,6 +108,17 @@ class TestDlgCnt(unittest.TestCase): self.assertEqual(res[0], 3, res[1]) self.checkNotCmd() + def test_noredisconf(self): + create_prog(os.path.join(FAKE_BIN, 'ngcp-dlgcnt-clean'), + 'echo "error" >&2; false') + create_prog(os.path.join(FAKE_BIN, 'ngcp-sercmd'), + "true") + create_prog(os.path.join(FAKE_BIN, 'ngcp-redis-helper'), + "%s; true" % FAKE_REDIS_HELPER) + res = executeAndReturnOutput(self.command) + self.assertEqual(res[0], 0, res[1]) + self.checkNotCmd() + def test_redisconf(self): create_prog(os.path.join(FAKE_BIN, 'ngcp-sercmd'), "true")