Skip to content

Commit

Permalink
kazoo: avoid creating an empty route block structure
Browse files Browse the repository at this point in the history
- use route_lookup() instead of route_get(), so the empty route block is
  not created if the route is not defined in the kamailio.cfg
  • Loading branch information
miconda committed May 15, 2017
1 parent bc336bf commit ab346e8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/modules/kazoo/kz_amqp.c
Expand Up @@ -2401,14 +2401,22 @@ void kz_amqp_fire_connection_event(char *event, char* host, char* zone)

void kz_amqp_cb_ok(kz_amqp_cmd_ptr cmd)
{
int n = route_get(&main_rt, cmd->cb_route);
int n = route_lookup(&main_rt, cmd->cb_route);
if(n==-1) {
/* route block not found in the configuration file */
return;
}
struct action *a = main_rt.rlist[n];
tmb.t_continue(cmd->t_hash, cmd->t_label, a);
}

void kz_amqp_cb_error(kz_amqp_cmd_ptr cmd)
{
int n = route_get(&main_rt, cmd->err_route);
int n = route_lookup(&main_rt, cmd->err_route);
if(n==-1) {
/* route block not found in the configuration file */
return;
}
struct action *a = main_rt.rlist[n];
tmb.t_continue(cmd->t_hash, cmd->t_label, a);
}
Expand Down

0 comments on commit ab346e8

Please sign in to comment.