MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / do_routing

Function do_routing

modules/drouting/drouting.c:3218–3736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3216
3217
3218static int do_routing(struct sip_msg* msg, struct head_db *part, int grp,
3219 int flags, str* whitelist)
3220{
3221 static unsigned short *dsts_idx = NULL;
3222 static unsigned short dsts_idx_size = 0;
3223 static unsigned short *carrier_idx = NULL;
3224 static unsigned short carrier_idx_size = 0;
3225 struct to_body *from;
3226 struct sip_uri uri;
3227 rt_info_t *rt_info;
3228 pv_value_t pv_val;
3229 struct usr_avp *avp_prefix=NULL, *avp_index=NULL;
3230 pgw_list_t *dst, *cdst;
3231 pgw_list_t *wl_list;
3232 unsigned int prefix_len;
3233 int rule_idx;
3234 struct head_db *current_partition=NULL;
3235 unsigned short wl_len;
3236 str username;
3237 int i, j, n;
3238 int_str val;
3239 str ruri;
3240 str next_carrier_attrs = {NULL, 0};
3241 str next_gw_attrs = {NULL, 0};
3242 int ret, fret;
3243 char tmp;
3244 char *ruri_buf;
3245
3246 ret = -1;
3247 ruri_buf = NULL;
3248 wl_list = NULL;
3249 rt_info = NULL;
3250
3251 if (use_partitions && part==NULL) {
3252 /* WILDCARD partition */
3253 for (current_partition = head_db_start;
3254 current_partition; current_partition = current_partition->next) {
3255 ret=do_routing( msg, current_partition, grp, flags, whitelist);
3256 if (ret > 0) {
3257 if (partition_pvar.s) {
3258 pv_val.rs = current_partition->partition;
3259 pv_val.flags = PV_VAL_STR;
3260 if (pv_set_value(msg, &partition_spec, 0, &pv_val) != 0) {
3261 LM_ERR("cannot print the PV-formatted"
3262 " partition string\n");
3263 return -1;
3264 }
3265 }
3266 break;
3267 }
3268 }
3269
3270 /* ret must be less than 0 here if nothing found */
3271 return ret;
3272 } else {
3273 current_partition = part;
3274 }
3275

Callers 2

w_do_routingFunction · 0.85
use_next_gwFunction · 0.85

Calls 14

pv_set_valueFunction · 0.85
destroy_avpsFunction · 0.85
parse_from_headerFunction · 0.85
parse_uriFunction · 0.85
get_group_idFunction · 0.85
search_first_avpFunction · 0.85
get_prefixFunction · 0.85
_check_rtFunction · 0.85
run_top_routeFunction · 0.85
sort_rt_dstFunction · 0.85
parse_destination_listFunction · 0.85
is_dst_in_listFunction · 0.85

Tested by

no test coverage detected