Tests Reference

This section lists the tests available for custom call merging algorithms.

call_id ([suffix])

Returns #t if the Call-ID headers of the two call legs are equal.

Parameters:

suffix - If this parameter is provided and it is non-zero, then only the last suffix characters are compared from the two Call-ID headers, and if they are equal, it returns #t.

Example:

(call_id 12)
  

returns #t if the last 12 characters from the Call-ID headers are equal.

hf_equals (header)

Returns #t if the values of the header whose name is given as a parameters are equal in the two call legs. The header name is case-insensitive.

For example, the following snippet returns #t, if the INVITE messages from both call legs contain a header named Session-ID and their values are equal:

(hf_equals "Session-ID")

hf_any_equals (headers)

Like hf_equals, but compares any header value in headers list with any header value from the second call; for a more complete example what this means see also uri_user.

hf_any_equals_all (headers)

This function is like hf_any_equals, but differs in the way that it treats the case where a header field contains a list of values, either separated by commas or in several header field rows with the same field name. In that case hf_any_equals will use only the first header field row with a given field name and use the entire row as one value, whereas hf_any_equals_all will try to match each individual element of the list.

hf_equals_prefix (length, header)

Limits the comparison performed by hf_equals to length characters from the beginning of the header value.

hf_param_equals (header, param)

Works like hf_equals but compares only the value of the named param.

hf_uri_param_equals (header, param)

Returns #t if the values of the named URI parameter of the specified header are equal in the two call legs. The header name is case-insensitive.

Example 8-1 Example

(hf_uri_param_equals "From" "x-to")
From: <sip:7788864164@10.0.0.8:5060;x-to=0702>;tag=00511620-9759-194F-A7CD-0DC114A3AA77-9534047

Here x-to is a URI parameter so we have to use the hf_uri_param_equals algorithm in order to correlate the two call legs.

sdp_media_ip_port ()

Returns #t if the SDP bodies from the initial INVITE messages of the two call legs contain the same media IP address and UDP port number in the first media description.

This is usually a good indicator, if the B2BUA device does not relay media.

sdp_session_id ()

Returns #t if the SDP bodies from the initial INVITE messages of the two call legs contain the same non-zero session ID.

time_diff (interval1, interval2)

Returns #t if the time difference between the two legs is smaller than the accepted intervals.

Parameters:

  • interval1 - The maximum time difference between the initial INVITE message of incoming call leg and the initial INVITE of the outgoing call leg.

  • interval2 - The maximum time difference between the initial INVITE message of outgoing call leg and the initial INVITE of the incoming call leg.

For example, the following code returns #t if the outgoing leg comes after the incoming leg with more than 15 seconds, or if the incoming leg comes after the outgoing leg with more than 2 seconds:

(time_diff 15000 2000)

Note:

The maximum value that you can use for the time_diff function is the same as the Operations Monitor system settings. Where,

  • The maximum value for B2B incoming backlog search for merging is 5 seconds.

  • The maximum value for B2B outgoing backlog search for merging is 1800 seconds.

If you do not include the time_diff function in your algorithm, your Operations Monitor B2B incoming backlog search for merging and B2B outgoing backlog search for merging system settings are used.

Note:

The time_diff function is treated differently than the others within the call correlation algorithm. It is considered for each correlation regardless of its position inside the algorithm.

uri_user (suffix, list_of_headers)

Returns #t if the user part of any of the URIs is specified in the list_of_headers matches.

Parameters:

  • suffix - If non-zero, only the last suffix characters from each URI is compared with the rest. URI length must be at least this size.

  • list_of_headers - A list containing the headers from which to extract the URI usernames to compare. A set of shortcuts are defined:

    • ruri - Request-URI.

    • from - From header URI.

    • to - To header URI.

    • diversion - Diversion header URI.

    • pai - P-Asserted-Identity URI.

    • ppid - P-Preferred-Identity URI.

    • rpid - Remote-Party-ID URI.

The URIs are compared in all possible permutations. For example, this snippet:

(uri_user 6 ("from" "pai"))
  

compares:

  • The From user from leg 1, with the From user from leg 2.

  • The From user from leg 1, with the P-Asserted-Identity user from leg 2.

  • The P-Asserted-Identity user from leg 1, with the From user from leg 2.

  • The P-Asserted-Identity user from leg 1, with the P-Asserted-Identity user from leg 2.

Similarly, the following snippet makes at most 9 comparisons:

(uri_user 6 ("to" "ruri" "diversion"))
  

In addition to the specified shortcut header names, URIs can be also specified by the name of the header containing them.

For example, the following expression returns #t if the last 7 characters from the username of the first Contact header from both calls are equal:

(uri_user 7 ("Contact"))
  

The header name is case-insensitive.

uri_user_max (suffix, list_of_headers)

The same as uri_user function, but it tries to match the call if a string is shorter than the suffix. For example, phone numbers 5551234 and 1234 will match, even if the suffix is 6.

uri_user_all (suffix, list_of_headers)

This function behaves in the same way as uri_user , except that if one of the relevant headers of one the call legs contains more than one URI, then all of these URIs are used for comparison, whereas uri_user would only use the first. Therefore if in the example:

(uri_user 6 ("from" "pai"))
  

one leg contains one P-Asserted-Identity and the other three, then up to 8 comparisons will be performed.

uri_user_all_max (suffix, list_of_headers)

As uri_user_max , but treats lists in header fields in the same way as uri_user_all.

cxpn_uri (suffix, list_of_headers)

Matches an in- with an out-going call comparing all possible header permutations like uri_user. It also supports ISUP cdpn and cgpn and allows for cross matching of SIP and ISUP calls.

Parameters:

  • suffix - If non-zero, only the last suffix characters from each URI is compared with the rest. URI length must be at least this size.

  • list_of_headers - In addition to the values supported by uri_user, cxpn_uri also supports:

    • cdpn - Matching on the callee.

    • cgpn - Matching on the caller.

cxpn_uri_max (suffix, list_of_headers)

The same as cxpn_uri function, but it tries to match the call if a string is shorter than the suffix. For example, phone numbers 5551234 and 1234 will match, even if suffix is 6.

cxpn_uri_all (suffix,list_of_headers)

Variants of cxpn_uri that use all URIs if a header of the SIP leg contains several, just as uri_user_all.

cxpn_uri_all_max (suffix,list_of_headers)

Same as cxpn_uri_max, but treats lists in header fields in the same way as uri_user_all.

cdpn (suffix)

Like uri_user, but matches only on the callee.

cgpn (suffix)

Like uri_user, but matches only on the caller.