[sr-dev] git:5.0:d75e3635: kazoo: avoid creating an empty route block structure
Luis Azedo
luis at 2600hz.com
Fri May 19 17:09:13 CEST 2017
Module: kamailio
Branch: 5.0
Commit: d75e3635c960ddfb32bb3201feb31c248f8375ea
URL: https://github.com/kamailio/kamailio/commit/d75e3635c960ddfb32bb3201feb31c248f8375ea
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Luis Azedo <luis at 2600hz.com>
Date: 2017-05-19T16:08:32+01:00
kazoo: avoid creating an empty route block structure
- 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
(cherry picked from commit ab346e80647228afdbcaf6884a8573c9221ca38b)
---
Modified: src/modules/kazoo/kz_amqp.c
---
Diff: https://github.com/kamailio/kamailio/commit/d75e3635c960ddfb32bb3201feb31c248f8375ea.diff
Patch: https://github.com/kamailio/kamailio/commit/d75e3635c960ddfb32bb3201feb31c248f8375ea.patch
---
diff --git a/src/modules/kazoo/kz_amqp.c b/src/modules/kazoo/kz_amqp.c
index f7fc8c1ff1..da310893c9 100644
--- a/src/modules/kazoo/kz_amqp.c
+++ b/src/modules/kazoo/kz_amqp.c
@@ -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);
}
More information about the sr-dev
mailing list