|
@@ -139,6 +139,7 @@ static int starts_with_f(struct sip_msg *msg, char *str1, char *str2 );
|
|
static int ends_with_f(struct sip_msg *msg, char *str1, char *str2 );
|
|
static int ends_with_f(struct sip_msg *msg, char *str1, char *str2 );
|
|
static int str_find_f(sip_msg_t *msg, char *str1, char *str2 );
|
|
static int str_find_f(sip_msg_t *msg, char *str1, char *str2 );
|
|
static int str_ifind_f(sip_msg_t *msg, char *str1, char *str2 );
|
|
static int str_ifind_f(sip_msg_t *msg, char *str1, char *str2 );
|
|
|
|
+static int str_any_in_f(sip_msg_t *msg, char *str1, char *str2 );
|
|
static int remove_hf_re_f(struct sip_msg* msg, char* key, char* foo);
|
|
static int remove_hf_re_f(struct sip_msg* msg, char* key, char* foo);
|
|
static int remove_hf_exp_f(sip_msg_t* msg, char* ematch, char* eskip);
|
|
static int remove_hf_exp_f(sip_msg_t* msg, char* ematch, char* eskip);
|
|
static int is_present_hf_re_f(struct sip_msg* msg, char* key, char* foo);
|
|
static int is_present_hf_re_f(struct sip_msg* msg, char* key, char* foo);
|
|
@@ -340,6 +341,9 @@ static cmd_export_t cmds[]={
|
|
{"str_ifind", (cmd_function)str_ifind_f, 2,
|
|
{"str_ifind", (cmd_function)str_ifind_f, 2,
|
|
fixup_spve_spve, 0,
|
|
fixup_spve_spve, 0,
|
|
ANY_ROUTE},
|
|
ANY_ROUTE},
|
|
|
|
+ {"str_any_in", (cmd_function)str_any_in_f, 2,
|
|
|
|
+ fixup_spve_spve, 0,
|
|
|
|
+ ANY_ROUTE},
|
|
{"is_audio_on_hold", (cmd_function)is_audio_on_hold_f, 0,
|
|
{"is_audio_on_hold", (cmd_function)is_audio_on_hold_f, 0,
|
|
0, 0,
|
|
0, 0,
|
|
ANY_ROUTE},
|
|
ANY_ROUTE},
|
|
@@ -4633,6 +4637,42 @@ static int str_ifind_f(sip_msg_t *msg, char *str1, char *str2 )
|
|
return ki_str_ifind(msg, &s1, &s2);
|
|
return ki_str_ifind(msg, &s1, &s2);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int ki_str_any_in(sip_msg_t *msg, str *txt, str *clist)
|
|
|
|
+{
|
|
|
|
+ int i,j;
|
|
|
|
+
|
|
|
|
+ if(txt==NULL || txt->len<=0 || clist==NULL || clist->len<=0) {
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for(i=0; i<txt->len; i++) {
|
|
|
|
+ for(j=0; j<clist->len; j++) {
|
|
|
|
+ if(txt->s[i] == clist->s[j]) {
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return -1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static int str_any_in_f(struct sip_msg *msg, char *str1, char *str2 )
|
|
|
|
+{
|
|
|
|
+ str s1;
|
|
|
|
+ str s2;
|
|
|
|
+
|
|
|
|
+ if(fixup_get_svalue(msg, (gparam_p)str1, &s1)!=0) {
|
|
|
|
+ LM_ERR("cannot get first parameter\n");
|
|
|
|
+ return -8;
|
|
|
|
+ }
|
|
|
|
+ if(fixup_get_svalue(msg, (gparam_p)str2, &s2)!=0) {
|
|
|
|
+ LM_ERR("cannot get second parameter\n");
|
|
|
|
+ return -8;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return ki_str_any_in(msg, &s1, &s2);
|
|
|
|
+}
|
|
|
|
+
|
|
static int ki_is_audio_on_hold(sip_msg_t *msg)
|
|
static int ki_is_audio_on_hold(sip_msg_t *msg)
|
|
{
|
|
{
|
|
int sdp_session_num = 0, sdp_stream_num;
|
|
int sdp_session_num = 0, sdp_stream_num;
|
|
@@ -5405,6 +5445,11 @@ static sr_kemi_t sr_kemi_textops_exports[] = {
|
|
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
|
|
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
|
|
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
|
|
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
|
|
},
|
|
},
|
|
|
|
+ { str_init("textops"), str_init("str_any_in"),
|
|
|
|
+ SR_KEMIP_INT, ki_str_any_in,
|
|
|
|
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
|
|
|
|
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
|
|
|
|
+ },
|
|
{ str_init("textops"), str_init("is_audio_on_hold"),
|
|
{ str_init("textops"), str_init("is_audio_on_hold"),
|
|
SR_KEMIP_INT, ki_is_audio_on_hold,
|
|
SR_KEMIP_INT, ki_is_audio_on_hold,
|
|
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
|
|
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
|