Skip to content

Commit

Permalink
siprec: register callbacks even though skip_failover_codes is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Feb 14, 2024
1 parent da20b22 commit fa3471e
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions modules/siprec/siprec_logic.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,6 @@ int src_init(void)
}
#endif

skip_failover_codes.len = strlen(skip_failover_codes.s);
if (!skip_failover_codes.len)
return 0;

/* here skip_failover_codes.s is always NULL terminated! */
if (regcomp(&skip_codes_regex, skip_failover_codes.s, (REG_EXTENDED|REG_ICASE|REG_NOSUB))) {
LM_ERR("cannot compile skip_failover_codes regex [%.*s]!\n",
skip_failover_codes.len, skip_failover_codes.s);
return -1;
}

if (srec_b2b.register_cb(src_event_received,
B2BCB_RECV_EVENT, &mod_name) < 0) {
LM_ERR("could not register SIPREC event receive callback!\n");
Expand All @@ -75,6 +64,16 @@ int src_init(void)
return -1;
}

skip_failover_codes.len = strlen(skip_failover_codes.s);
if (!skip_failover_codes.len)
return 0;

/* here skip_failover_codes.s is always NULL terminated! */
if (regcomp(&skip_codes_regex, skip_failover_codes.s, (REG_EXTENDED|REG_ICASE|REG_NOSUB))) {
LM_ERR("cannot compile skip_failover_codes regex [%.*s]!\n",
skip_failover_codes.len, skip_failover_codes.s);
return -1;
}

return 0;
}
Expand Down

0 comments on commit fa3471e

Please sign in to comment.