Module: kamailio
Branch: master
Commit: ab346e80647228afdbcaf6884a8573c9221ca38b
URL: 
https://github.com/kamailio/kamailio/commit/ab346e80647228afdbcaf6884a8573c9221ca38b

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2017-05-15T14:31:17+02: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

---

Modified: src/modules/kazoo/kz_amqp.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/ab346e80647228afdbcaf6884a8573c9221ca38b.diff
Patch: 
https://github.com/kamailio/kamailio/commit/ab346e80647228afdbcaf6884a8573c9221ca38b.patch

---

diff --git a/src/modules/kazoo/kz_amqp.c b/src/modules/kazoo/kz_amqp.c
index f7fc8c1..da31089 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);
 }


_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to