int codec_move_down_re (struct sip_msg* msg, char* str1) { if( do_for_all_streams( msg, NULL, NULL, (regex_t*)str1, ADD_TO_BACK, DESC_REGEXP) == 0) return -1; return 1; }
int codec_delete_except_re (struct sip_msg* msg, char* str1 ) { if( do_for_all_streams( msg, NULL, NULL, (regex_t*) str1, DELETE, DESC_REGEXP_COMPLEMENT) == 0) return -1; return 1; }
int codec_find_clock (struct sip_msg* msg, char* str1,char * str2 ) { str codec = {0,0},clock = {0,0}; if(fixup_get_svalue(msg, (gparam_p)str1, &codec)!=0) { LM_ERR("no mode value\n"); return -1; } if(fixup_get_svalue(msg, (gparam_p)str2, &clock)!=0) { LM_ERR("no mode value\n"); return -1; } LM_DBG("searching for codec <%.*s> with clock <%.*s> \n", codec.len,codec.s,clock.len,clock.s); if( do_for_all_streams( msg, &codec, &clock, NULL, FIND, DESC_NAME_AND_CLOCK) == 0) return -1; return 1; }
int codec_find_re (struct sip_msg* msg, char* str1 ) { if( do_for_all_streams(msg, NULL, NULL, (regex_t*)str1, FIND, DESC_REGEXP) == 0) return -1; return 1; }
int codec_move_down (struct sip_msg* msg, char* str1) { str res = {0,0}; if(fixup_get_svalue(msg, (gparam_p)str1, &res)!=0) { LM_ERR("no mode value\n"); return -1; } LM_DBG("moving down codec <%.*s> \n",res.len,res.s); return do_for_all_streams( msg, &res, NULL, NULL, ADD_TO_BACK, DESC_NAME); }
int codec_delete (struct sip_msg* msg, char* str1 ) { str res = {0,0}; if(fixup_get_svalue(msg, (gparam_p)str1, &res)!=0) { LM_ERR("no mode value\n"); return -1; } LM_DBG("deleting codec <%.*s> \n",res.len,res.s); return do_for_all_streams( msg, &res, NULL, NULL, DELETE, DESC_NAME); }
int codec_move_down_re (struct sip_msg* msg, char* str1) { regex_t *re; int do_free; int ret; re = fixup_get_regex(msg,(gparam_p)str1,&do_free); if (!re) { LM_ERR("Failed to get regular expression \n"); return -1; } ret = do_for_all_streams( msg, NULL, NULL, re, ADD_TO_BACK, DESC_REGEXP); if (do_free) fixup_free_regexp((void **)&re); return ret; }
int codec_delete_except_re (struct sip_msg* msg, char* str1 ) { regex_t *re; int do_free; int ret; re = fixup_get_regex(msg,(gparam_p)str1,&do_free); if (!re) { LM_ERR("Failed to get regular expression \n"); return -1; } ret = do_for_all_streams( msg, NULL, NULL, re, DELETE, DESC_REGEXP_COMPLEMENT); if (do_free) fixup_free_regexp((void **)&re); return ret; }
int codec_find (struct sip_msg* msg, char* str1 ) { str res = {0,0}; if(fixup_get_svalue(msg, (gparam_p)str1, &res)!=0) { LM_ERR("no mode value\n"); return -1; } LM_DBG("searching for codec <%.*s> \n",res.len,res.s); if( do_for_all_streams( msg, &res, NULL, NULL, FIND, DESC_NAME) == 0) return -1; return 1; }
int codec_move_down_clock (struct sip_msg* msg, char* str1 ,char * str2) { str codec = {0,0},clock = {0,0}; if(fixup_get_svalue(msg, (gparam_p)str1, &codec)!=0) { LM_ERR("no mode value\n"); return -1; } if(fixup_get_svalue(msg, (gparam_p)str2, &clock)!=0) { LM_ERR("no mode value\n"); return -1; } LM_DBG("moving down codec <%.*s> with clock <%.*s> \n", codec.len,codec.s,clock.len,clock.s); return do_for_all_streams( msg, &codec, &clock, NULL, ADD_TO_BACK, DESC_NAME_AND_CLOCK); }