[sr-dev] [kamailio/kamailio] Kazoo: added basic kemi support (#2324)

tao-communications notifications at github.com
Wed May 20 18:41:44 CEST 2020


@tao-communications commented on this pull request.



> -	rt = route_get(&event_rt, "kazoo:mod-init");
-	if(rt>=0 && event_rt.rlist[rt]!=NULL) {
-		LM_DBG("executing event_route[kazoo:mod-init] (%d)\n", rt);
-		if(faked_msg_init()<0)
-			return -1;
-		fmsg = faked_msg_next();
-		rtb = get_route_type();
-		set_route_type(REQUEST_ROUTE);
-		init_run_actions_ctx(&ctx);
-		run_top_route(event_rt.rlist[rt], fmsg, &ctx);
-		if(ctx.run_flags&DROP_R_F)
-		{
-			LM_ERR("exit due to 'drop' in event route\n");
-			return -1;
+	if (kazoo_route_no>=0) {
+		rt = route_get(&event_rt, "kazoo:mod-init");
+        if(rt>=0 && event_rt.rlist[rt]!=NULL) {
+			LM_DBG("executing event_route[kazoo:mod-init] (%d)\n", rt);
+			if(faked_msg_init()<0)
+				return -1;
+			fmsg = faked_msg_next();
+			rtb = get_route_type();
+			set_route_type(REQUEST_ROUTE);
+			init_run_actions_ctx(&ctx);
+			run_top_route(event_rt.rlist[rt], fmsg, &ctx);
+			if(ctx.run_flags&DROP_R_F)
+			{
+				LM_ERR("exit due to 'drop' in event route\n");
+				return -1;
+			}
+			set_route_type(rtb);
+		}
+	} 
+  else {
+		keng = sr_kemi_eng_get();
+		if(keng!=NULL) {
+			sip_msg_t *msg;
+			str evrtname = str_init("kazoo:mod-init");
+			rtb = get_route_type();
+			msg = faked_msg_next();
+			if(sr_kemi_route(keng, msg, EVENT_ROUTE, &kazoo_event_callback, &evrtname)<0) {
+				LM_ERR("error running event route kemi callback\n");
+		  }
+		  set_route_type(rtb);
+		} 
+    else {
+			LM_ERR("no event route or kemi callback found for execution\n");

    Now depending on using cfg or kemi:
     - fire_init_event() calls fire_init_event_cfg() or fire_init_event_kemi()


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2324#discussion_r428156739
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20200520/e220bf29/attachment.html>


More information about the sr-dev mailing list