From 590189ef29c716df9d3d114f7e542233e1bdbd51 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 20 Jul 2021 14:36:27 -0400 Subject: [PATCH] TT#14008 don't delete calls from foreign DB during restore If a keyspace notification SET is received and the call already exists as a foreign call, the call is first destroyed before being re-restored. The call destruction involves a DEL from Redis on the "hosted DB" number, which points to the foreign DB. This makes it impossible to then restore the call because it's just been deleted. closes #1308 closes #1334 Change-Id: Ie895b021441b2d299f8ebb5bde1824b01e12633c --- daemon/redis.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/daemon/redis.c b/daemon/redis.c index baf6ef4f5..9391da60f 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -372,13 +372,17 @@ void on_redis_notification(redisAsyncContext *actx, void *reply, void *privdata) c = call_get(&callid); if (c) { rwlock_unlock_w(&c->master_lock); - if (IS_FOREIGN_CALL(c)) + if (IS_FOREIGN_CALL(c)) { + c->redis_hosted_db = rtpe_redis_write->db; // don't delete from foreign DB call_destroy(c); + } else { rlog(LOG_WARN, "Redis-Notifier: Ignoring SET received for OWN call: " STR_FORMAT "\n", STR_FMT(&callid)); goto err; } } + + redis_select_db(r, r->db); mutex_unlock(&r->lock); // unlock before restoring calls to avoid deadlock in case err happens