<h4 dir="auto">Pre-Submission Checklist</h4>



<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commit message has the format required by CONTRIBUTING guide</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commits are split per component (core, individual modules, libs, utils, ...)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Each component has a single commit (if not, squash them into one commit)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> No commits to README files for modules (changes must be done to docbook files<br>
in <code>doc/</code> subfolder, the README file is autogenerated)</li>
</ul>
<h4 dir="auto">Type Of Change</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Small bug fix (non-breaking change which fixes an issue)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> New feature (non-breaking change which adds new functionality)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Breaking change (fix or feature that would change existing functionality)</li>
</ul>
<h4 dir="auto">Checklist:</h4>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> PR should be backported to stable branches</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Tested changes locally</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Related to issue #XXXX (replace XXXX with an open issue number)</li>
</ul>
<h4 dir="auto">Description</h4>
<p dir="auto">I've marked this as a "breaking change" only because it slightly alters the error handling of the RPC dlg.list_match command, to draw attention to it. But the actual functionality is unchanged.</p>
<p dir="auto">This PR adds a new script function to the dialog module: <code>dlg_get_matches</code>. This has the same behaviour as the RPC <code>dlg.list_match</code> command, but allows use in scripts. The results are returned in an XAVP of a specified name, as an array of fields.</p>
<div class="snippet-clipboard-content position-relative overflow-auto" data-snippet-clipboard-copy-content="dlg_get_matches(mkey, mop, mval, xavp_name[, max_results]);

Returns number of matches found. Or -1 if there's an error."><pre><code>dlg_get_matches(mkey, mop, mval, xavp_name[, max_results]);

Returns number of matches found. Or -1 if there's an error.
</code></pre></div>
<p dir="auto">An example of use would be:</p>
<div class="snippet-clipboard-content position-relative overflow-auto" data-snippet-clipboard-copy-content="        xlog("Extension is: $var(ext)\n");

        $avp(dlg_count) = dlg_get_matches("turi", "sw", "sip:nexusone$var(ext)@", "dlg_matches");

        xlog("Got $avp(dlg_count) matches.\n");
        $var(i) = 0;
        $var(matched) = 0;
        while ($var(i) < $avp(dlg_count))
        {
                //Skip dialogs that are not early state
                if ($xavp(dlg_matches[$var(i)]=>state) == 2)
                {
                        xlog("Found matching dlg[$var(i)]: $xavp(dlg_matches[$var(i)]=>from_uri)\n");
                }
        }"><pre><code>        xlog("Extension is: $var(ext)\n");

        $avp(dlg_count) = dlg_get_matches("turi", "sw", "sip:nexusone$var(ext)@", "dlg_matches");

        xlog("Got $avp(dlg_count) matches.\n");
        $var(i) = 0;
        $var(matched) = 0;
        while ($var(i) < $avp(dlg_count))
        {
                //Skip dialogs that are not early state
                if ($xavp(dlg_matches[$var(i)]=>state) == 2)
                {
                        xlog("Found matching dlg[$var(i)]: $xavp(dlg_matches[$var(i)]=>from_uri)\n");
                }
        }
</code></pre></div>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/kamailio/kamailio/pull/3005'>https://github.com/kamailio/kamailio/pull/3005</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/kamailio/kamailio/pull/3005/commits/55c332bc99de43d0deabb59a44630f3e4d9d72bc" class="commit-link">55c332b</a>  dialog: Adding dlg_get_matches function based on RPC dlg.list_match command.</li>
  <li><a href="https://github.com/kamailio/kamailio/pull/3005/commits/365f5be2eb6f8dce9b4163f7365756f390afebf8" class="commit-link">365f5be</a>  dialog: Adding documentation for dlg_get_matches function.</li>
  <li><a href="https://github.com/kamailio/kamailio/pull/3005/commits/8c9a249f9c14322d68b7c45199d0972cc2dc3683" class="commit-link">8c9a249</a>  dialog: Refactored dlg_get_matches and dlg.list_match RPC command to use a shared dlg_list_matches function.</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/kamailio/kamailio/pull/3005/files">2 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/3005/files#diff-d8b3fcdc2ab936f8c3ede8501220c058ae0e8629da49c92a8278841e1e2e1e8c">src/modules/dialog/dialog.c</a>
    (793)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/3005/files#diff-a8b2341d40db283cecb3035f8a33abff977ea4b5eb2f48bb204910b8b74a1284">src/modules/dialog/doc/dialog_admin.xml</a>
    (92)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/kamailio/kamailio/pull/3005.patch'>https://github.com/kamailio/kamailio/pull/3005.patch</a></li>
  <li><a href='https://github.com/kamailio/kamailio/pull/3005.diff'>https://github.com/kamailio/kamailio/pull/3005.diff</a></li>
</ul>

<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">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZIMQHCR46RDYLV3WCDUXELYNANCNFSM5MO46NXA">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/ABO7UZMB2HB2O45RZEVGLB3UXELYNA5CNFSM5MO46NXKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4QRMJU5A.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</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",
"url": "https://github.com/kamailio/kamailio/pull/3005",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>