<p></p>
<p dir="auto">For some reason I had totally ignored that dlg vars, profiles and callbacks are all referenced by the RPC command (and probably should be by my function). Given I don't know what the call backs might be doing to the original dialogs, it doesn't seem safe anymore to make copies of the original dialogs.</p>
<p dir="auto">I just tried re-writing the code to return an array of pointers to the original dialogs, to avoid copying them. This would mean I need to perform locking around any results of <code>dlg_list_matches</code>. However I've realised that I won't know what "table entry" to lock as this could be different for each match.</p>
<p dir="auto">I'm feeling a bit stuck right now - I suppose I could use a struct that tracks each dlg ptr match and what table index it belongs to, when returning results. I was trying to avoid creating extra things just for this small bit of code, though.</p>
<p dir="auto">Any suggestions on this would be appreciated. Maybe it's just easier to not share the matching logic and keep it simple and just duplicate all the matching logic?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/3005#issuecomment-1019676282">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZN5INVZDFMWMNP6GA3UXTAIFANCNFSM5MO46NXA">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/ABO7UZPMQ7TJVFIEYMZLYSTUXTAIFA5CNFSM5MO46NXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOHTDQM6Q.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><kamailio/kamailio/pull/3005/c1019676282</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/3005#issuecomment-1019676282",
"url": "https://github.com/kamailio/kamailio/pull/3005#issuecomment-1019676282",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>