... | ... |
@@ -96,7 +96,11 @@ int receive_msg(char* buf, unsigned int len, union sockaddr_union* src_su) |
96 | 96 |
DBG("After parse_msg...\n"); |
97 | 97 |
|
98 | 98 |
/* execute pre-script callbacks, if any; -jiri */ |
99 |
- exec_pre_cb(msg); |
|
99 |
+ /* if some of the callbacks said not to continue with |
|
100 |
+ script processing, don't do so |
|
101 |
+ */ |
|
102 |
+ if (exec_pre_cb(msg)==0) goto error; |
|
103 |
+ |
|
100 | 104 |
/* ... and clear branches from previous message */ |
101 | 105 |
clear_branches(); |
102 | 106 |
|
... | ... |
@@ -67,10 +67,15 @@ int register_script_cb( cb_function f, callback_t t, void *param ) |
67 | 67 |
return 1; |
68 | 68 |
} |
69 | 69 |
|
70 |
-void exec_pre_cb( struct sip_msg *msg) |
|
70 |
+int exec_pre_cb( struct sip_msg *msg) |
|
71 | 71 |
{ |
72 | 72 |
struct script_cb *i; |
73 |
- for (i=pre_cb; i; i=i->next) i->cbf(msg, i->param); |
|
73 |
+ for (i=pre_cb; i; i=i->next) { |
|
74 |
+ /* stop on error */ |
|
75 |
+ if (i->cbf(msg, i->param)==0) |
|
76 |
+ return 0; |
|
77 |
+ } |
|
78 |
+ return 1; |
|
74 | 79 |
} |
75 | 80 |
|
76 | 81 |
void exec_post_cb( struct sip_msg *msg) |
... | ... |
@@ -60,6 +60,10 @@ struct sr_module* modules=0; |
60 | 60 |
extern struct module_exports* usrloc_exports(); |
61 | 61 |
#endif |
62 | 62 |
|
63 |
+#ifdef STATIC_SL |
|
64 |
+ extern struct module_exports* sl_exports(); |
|
65 |
+#endif |
|
66 |
+ |
|
63 | 67 |
|
64 | 68 |
/* initializes statically built (compiled in) modules*/ |
65 | 69 |
int register_builtin_modules() |
... | ... |
@@ -96,6 +100,11 @@ int register_builtin_modules() |
96 | 100 |
ret=register_module(usrloc_exports, "built-in", 0); |
97 | 101 |
if (ret<0) return ret; |
98 | 102 |
#endif |
103 |
+ |
|
104 |
+#ifdef STATIC_SL |
|
105 |
+ ret=register_module(sl_exports, "built-in", 0); |
|
106 |
+ if (ret<0) return ret; |
|
107 |
+#endif |
|
99 | 108 |
|
100 | 109 |
return ret; |
101 | 110 |
} |