Browse code

- added @sys.server_id select, this select will obtain the ID of the SER server.

Jan Janak authored on 16/04/2008 11:19:05
Showing 2 changed files
... ...
@@ -39,6 +39,7 @@
39 39
 #include "dprint.h"
40 40
 #include "trim.h"
41 41
 #include "ut.h"
42
+#include "globals.h"
42 43
 #include "parser/parser_f.h"
43 44
 #include "parser/hf.h"
44 45
 #include "parser/parse_from.h"
... ...
@@ -1289,6 +1290,10 @@ int select_sys_pid(str* res, select_t* s, struct sip_msg* msg) {
1289 1290
 	return uint_to_static_buffer(res, getpid());
1290 1291
 }
1291 1292
 
1293
+int select_sys_server_id(str* res, select_t* s, struct sip_msg* msg) {
1294
+	return int_to_static_buffer(res, server_id);
1295
+}
1296
+
1292 1297
 int select_sys_unique(str* res, select_t* s, struct sip_msg* msg) {
1293 1298
 	#define UNIQUE_ID_PID_LEN 4
1294 1299
 	#define UNIQUE_ID_TIME_LEN 8
... ...
@@ -194,6 +194,7 @@ SELECT_F(select_sip_if_match)
194 194
 
195 195
 SELECT_F(select_sys)
196 196
 SELECT_F(select_sys_pid)
197
+SELECT_F(select_sys_server_id)
197 198
 SELECT_F(select_sys_unique)
198 199
 SELECT_F(select_sys_now)
199 200
 SELECT_F(select_sys_now_fmt)
... ...
@@ -384,6 +385,7 @@ static select_row_t select_core[] = {
384 385
 	{ select_sys_now, SEL_PARAM_STR, STR_STATIC_INIT("local"), select_sys_now_fmt, OPTIONAL | CONSUME_NEXT_STR | DIVERSION | SEL_NOW_LOCAL},
385 386
 	{ select_sys_now, SEL_PARAM_STR, STR_STATIC_INIT("gmt"), select_sys_now_fmt, OPTIONAL | CONSUME_NEXT_STR | DIVERSION | SEL_NOW_GMT},
386 387
 	{ select_sys_now, SEL_PARAM_STR, STR_STATIC_INIT("utc"), select_sys_now_fmt, OPTIONAL | CONSUME_NEXT_STR | DIVERSION | SEL_NOW_GMT},
388
+	{ select_sys, SEL_PARAM_STR, STR_STATIC_INIT("server_id"), select_sys_server_id, 0},
387 389
 
388 390
 	{ NULL, SEL_PARAM_STR, STR_STATIC_INIT("branch"), select_branch, SEL_PARAM_EXPECTED},
389 391
 	{ select_branch, SEL_PARAM_STR, STR_STATIC_INIT("count"), select_branch_count, 0},