sl_filter_ACK no more exported and called on beginning of every
authorJiri Kuthan <jiri@iptel.org>
Thu, 3 Oct 2002 20:06:10 +0000 (20:06 +0000)
committerJiri Kuthan <jiri@iptel.org>
Thu, 3 Oct 2002 20:06:10 +0000 (20:06 +0000)
script instead

receive.c
script_cb.c
script_cb.h
sr_module.c

index 836e7dc..9cf3a0f 100644 (file)
--- a/receive.c
+++ b/receive.c
@@ -96,7 +96,11 @@ int receive_msg(char* buf, unsigned int len, union sockaddr_union* src_su)
        DBG("After parse_msg...\n");
 
        /* execute pre-script callbacks, if any; -jiri */
-       exec_pre_cb(msg);
+       /* if some of the callbacks said not to continue with
+          script processing, don't do so
+       */
+       if (exec_pre_cb(msg)==0) goto error;
+
        /* ... and clear branches from previous message */
        clear_branches();
 
index 817d7df..5057519 100644 (file)
@@ -67,10 +67,15 @@ int register_script_cb( cb_function f, callback_t t, void *param )
        return 1;
 }
 
-void exec_pre_cb( struct sip_msg *msg)
+int exec_pre_cb( struct sip_msg *msg)
 {
        struct script_cb *i;
-       for (i=pre_cb; i; i=i->next) i->cbf(msg, i->param);
+       for (i=pre_cb; i; i=i->next) {
+               /* stop on error */
+               if (i->cbf(msg, i->param)==0)
+                       return 0;
+       }
+       return 1;
 }
 
 void exec_post_cb( struct sip_msg *msg)
index cb6e376..a8de9bc 100644 (file)
@@ -44,7 +44,7 @@ struct script_cb{
 };
 
 int register_script_cb( cb_function f, callback_t t, void *param );
-void exec_pre_cb( struct sip_msg *msg);
+int exec_pre_cb( struct sip_msg *msg);
 void exec_post_cb( struct sip_msg *msg);
 
 
index 2743572..dda586c 100644 (file)
@@ -60,6 +60,10 @@ struct sr_module* modules=0;
         extern struct module_exports* usrloc_exports();
 #endif
 
+#ifdef STATIC_SL
+        extern struct module_exports* sl_exports();
+#endif
+
 
 /* initializes statically built (compiled in) modules*/
 int register_builtin_modules()
@@ -96,6 +100,11 @@ int register_builtin_modules()
        ret=register_module(usrloc_exports, "built-in", 0);
        if (ret<0) return ret;
 #endif
+
+#ifdef STATIC_SL
+       ret=register_module(sl_exports, "built-in", 0);
+       if (ret<0) return ret;
+#endif
        
        return ret;
 }