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
pull/1346/head
Richard Fuchs 4 years ago
parent d1f320c80f
commit a52c0fecf4

@ -373,13 +373,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

Loading…
Cancel
Save