Pre-Submission Checklist

Type Of Change

Checklist:

Description

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.

This PR adds a new script function to the dialog module: dlg_get_matches. This has the same behaviour as the RPC dlg.list_match command, but allows use in scripts. The results are returned in an XAVP of a specified name, as an array of fields.

dlg_get_matches(mkey, mop, mval, xavp_name[, max_results]);

Returns number of matches found. Or -1 if there's an error.

An example of use would be:

        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");
                }
        }

You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/3005

Commit Summary

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/pull/3005@github.com>