... | ... |
@@ -2932,6 +2932,8 @@ static void rpc_dlg_list_match_ex(rpc_t *rpc, void *c, int with_context) |
2932 | 2932 |
str mop = {NULL, 0}; |
2933 | 2933 |
str mval = {NULL, 0}; |
2934 | 2934 |
str sval = {NULL, 0}; |
2935 |
+ unsigned int ival = 0; |
|
2936 |
+ unsigned int mival = 0; |
|
2935 | 2937 |
int n = 0; |
2936 | 2938 |
int m = 0; |
2937 | 2939 |
int vkey = 0; |
... | ... |
@@ -2960,6 +2962,8 @@ static void rpc_dlg_list_match_ex(rpc_t *rpc, void *c, int with_context) |
2960 | 2962 |
vkey = 2; |
2961 | 2963 |
} else if(mkey.len==6 && strncmp(mkey.s, "callid", mkey.len)==0) { |
2962 | 2964 |
vkey = 3; |
2965 |
+ } else if(mkey.len==8 && strncmp(mkey.s, "start_ts", mkey.len)==0) { |
|
2966 |
+ vkey = 4; |
|
2963 | 2967 |
} else { |
2964 | 2968 |
LM_ERR("invalid key %.*s\n", mkey.len, mkey.s); |
2965 | 2969 |
rpc->fault(c, 500, "Invalid matching key parameter"); |
... | ... |
@@ -2983,6 +2987,10 @@ static void rpc_dlg_list_match_ex(rpc_t *rpc, void *c, int with_context) |
2983 | 2987 |
} |
2984 | 2988 |
} else if(strncmp(mop.s, "sw", 2)==0) { |
2985 | 2989 |
vop = 2; |
2990 |
+ } else if(strncmp(mop.s, "gt", 2)==0) { |
|
2991 |
+ vop = 3; |
|
2992 |
+ } else if(strncmp(mop.s, "lt", 2)==0) { |
|
2993 |
+ vop = 4; |
|
2986 | 2994 |
} else { |
2987 | 2995 |
LM_ERR("invalid matching operator %.*s\n", mop.len, mop.s); |
2988 | 2996 |
rpc->fault(c, 500, "Invalid matching operator parameter"); |
... | ... |
@@ -2992,6 +3000,18 @@ static void rpc_dlg_list_match_ex(rpc_t *rpc, void *c, int with_context) |
2992 | 3000 |
n = 0; |
2993 | 3001 |
} |
2994 | 3002 |
|
3003 |
+ if (vkey == 4 && vop <= 2) { |
|
3004 |
+ LM_ERR("Matching operator %.*s not supported with start_ts key\n", mop.len, mop.s); |
|
3005 |
+ rpc->fault(c, 500, "Matching operator not supported with start_ts key"); |
|
3006 |
+ return; |
|
3007 |
+ } |
|
3008 |
+ |
|
3009 |
+ if (vkey != 4 && vop >= 3) { |
|
3010 |
+ LM_ERR("Matching operator %.*s not supported with key %.*s\n", mop.len, mop.s, mkey.len, mkey.s); |
|
3011 |
+ rpc->fault(c, 500, "Matching operator not supported"); |
|
3012 |
+ return; |
|
3013 |
+ } |
|
3014 |
+ |
|
2995 | 3015 |
for(i=0; i<d_table->size; i++) { |
2996 | 3016 |
dlg_lock(d_table, &(d_table->entries[i])); |
2997 | 3017 |
for(dlg=d_table->entries[i].first; dlg!=NULL; dlg=dlg->next) { |
... | ... |
@@ -3009,6 +3029,9 @@ static void rpc_dlg_list_match_ex(rpc_t *rpc, void *c, int with_context) |
3009 | 3029 |
case 3: |
3010 | 3030 |
sval = dlg->callid; |
3011 | 3031 |
break; |
3032 |
+ case 4: |
|
3033 |
+ ival = dlg->start_ts; |
|
3034 |
+ break; |
|
3012 | 3035 |
} |
3013 | 3036 |
switch(vop) { |
3014 | 3037 |
case 0: |
... | ... |
@@ -3031,6 +3054,17 @@ static void rpc_dlg_list_match_ex(rpc_t *rpc, void *c, int with_context) |
3031 | 3054 |
matched = 1; |
3032 | 3055 |
} |
3033 | 3056 |
break; |
3057 |
+ case 3: |
|
3058 |
+ /* greater than */ |
|
3059 |
+ if (str2int(&mval, &mival) == 0 && ival > mival) { |
|
3060 |
+ matched = 1; |
|
3061 |
+ } |
|
3062 |
+ break; |
|
3063 |
+ case 4: |
|
3064 |
+ if (str2int(&mval, &mival) == 0 && ival < mival) { |
|
3065 |
+ matched = 1; |
|
3066 |
+ } |
|
3067 |
+ break; |
|
3034 | 3068 |
} |
3035 | 3069 |
if (matched==1) { |
3036 | 3070 |
m++; |