I have fixed dialog saving with folowing change: https://github.com/Den4t/kamailio/commit/0ff12a0a0ab62123c7a37acb1c8f2f81d63...
Look like work as expected.
I haven't tested DMQ, but having studied the code in detail, i don't think this change will affect it in any way. So, if the authors have no objections, I will do a PR.