Thank for digging into it and coming with a fix. Can you reformat the commit message so it matches the contributions guide:
* https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md#com...
So, the it should be like:
``` dialog: fix to get CDRs after restart
[more details here] ```
If you don't get the chance to do it soon, no worries, I can apply the patch manually, just have it in mind for future pull requests. It makes life easier by merging with one click here, instead of editing/patching source manually.