OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.26k stars 577 forks source link

[BUG] Fraud Detection 3.2.6 return 1 in/out of time range #2870

Open Integration-IT opened 2 years ago

Integration-IT commented 2 years ago

Hi Everyone,

The fraud detection module probably returns an unintended function value inside a rule when the time range is out of bounds.

RULE:

select * from fraud_detection\G;
*************************** 1. row ***************************
                   ruleid: 1
                profileid: 1
                   prefix: 33
               start_hour: 00:00
                 end_hour: 23:59
            daysoftheweek: Mon-Sun
              cpm_warning: 10
             cpm_critical: 20
    call_duration_warning: 10
   call_duration_critical: 20
      total_calls_warning: 10
     total_calls_critical: 20
 concurrent_calls_warning: 10
concurrent_calls_critical: 20
 sequential_calls_warning: 10
sequential_calls_critical: 20

Opensips CFG check part:

    if ( check_fraud($fU, $rU, 1) ) {
    $var(ret_code) = $rc;

    switch ($var(ret_code)) {
        case 1:
            xlog("SCRIPT:DBG: [FRAUD DETECTION] | A matching rule was found, but there is no parameter above the rule's threshlod - everything is ok\n");
            break;
        case 2:
            xlog("SCRIPT:DBG: [FRAUD DETECTION] | No matching fraud rule was found\n");
            send_reply(503,"No Matching Fraud Rule");
            exit;
            break;
        case -1:
            xlog("SCRIPT:DBG: [FRAUD DETECTION] | There is a parameter above the warning threshold value.\n");
            break;
        case -2:
            xlog("SCRIPT:DBG: [FRAUD DETECTION] | There is a parameter above the critical threshold value.\n");
            break;
        case -3:
            xlog("SCRIPT:DBG: [FRAUD DETECTION] | Something went wrong\n");
            send_reply(500,"Internal Error");
            exit;
            break;
        default:
            xlog("SCRIPT:DBG: [FRAUD DETECTION] | Something went wrong\n");
            send_reply(500,"Internal Error");
            exit;
        }
    }

XLOG RESULT with a matched destination during a call:

SCRIPT:DBG: [FRAUD DETECTION] | A matching rule was found, but there is no parameter above the rule's threshlod - everything is ok

DOC: A rule will only match between the indicated hours in the indicated days of the week

PROBLEM: The time was set in db to allow time range 00:00 to 23:59. -> function return 1. The time was set in db to allow time range 00:00 to 00:01. -> function return 1.

In both cases, inside or outside the time range, the uniq rule match for the correct prefix and profile.

ADDITIONAL : out of time range should probably return 2 -> No matching fraud rule was found. ADDITIONAL : out of time range should probably return 3 -> Match a destination out of interval (proposal*).

MonkeyTester.

github-actions[bot] commented 2 years ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

github-actions[bot] commented 2 years ago

Marking as closed due to lack of progress for more than 30 days. If this issue is still relevant, please re-open it with additional details.

github-actions[bot] commented 1 year ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

github-actions[bot] commented 1 year ago

Marking as closed due to lack of progress for more than 30 days. If this issue is still relevant, please re-open it with additional details.