| 2591 | |
| 2592 | |
| 2593 | static int use_next_gw(struct sip_msg* msg, |
| 2594 | pv_spec_t* rule_att, pv_spec_t* gw_att, pv_spec_t* carr_att, |
| 2595 | struct head_db *part) |
| 2596 | { |
| 2597 | struct head_db * current_partition; |
| 2598 | struct usr_avp *avp, *avp_ru, *avp_sk; |
| 2599 | struct dr_acc_call_params *acp; |
| 2600 | unsigned int flags; |
| 2601 | int grp; |
| 2602 | str *wl_list; |
| 2603 | int_str val; |
| 2604 | pv_value_t pv_val; |
| 2605 | str ruri; |
| 2606 | int ok = 0; |
| 2607 | pgw_t * dst; |
| 2608 | const struct socket_info *sock; |
| 2609 | |
| 2610 | if(part==NULL) { |
| 2611 | LM_ERR("Partition is mandatory for use_next_gw.\n"); |
| 2612 | return -1; |
| 2613 | } |
| 2614 | current_partition = part; |
| 2615 | |
| 2616 | rule_attrs_spec = (pv_spec_p)rule_att; |
| 2617 | gw_attrs_spec = (pv_spec_p)gw_att; |
| 2618 | carrier_attrs_spec = (pv_spec_p)carr_att; |
| 2619 | |
| 2620 | /* |
| 2621 | * pop a value from each AVP |
| 2622 | * (also remove all bogus non-STR top-most values) |
| 2623 | */ |
| 2624 | while(1) |
| 2625 | { |
| 2626 | if (rule_attrs_spec) { |
| 2627 | avp = search_first_avp(0, current_partition->rule_attrs_avp, |
| 2628 | &val, NULL); |
| 2629 | if (avp) { |
| 2630 | pv_val.flags = PV_VAL_STR; |
| 2631 | pv_val.rs = val.s; |
| 2632 | if (pv_set_value(msg, rule_attrs_spec, 0, &pv_val) != 0) |
| 2633 | LM_ERR("failed to set value for rule attrs pvar\n"); |
| 2634 | } |
| 2635 | } |
| 2636 | |
| 2637 | /* remove the old attrs */ |
| 2638 | if (gw_attrs_spec) { |
| 2639 | avp = NULL; |
| 2640 | do { |
| 2641 | if (avp) destroy_avp(avp); |
| 2642 | avp = search_first_avp( 0, current_partition->gw_attrs_avp, |
| 2643 | NULL, NULL); |
| 2644 | }while (avp && (avp->flags&AVP_VAL_STR)==0 ); |
| 2645 | if (avp) destroy_avp(avp); |
| 2646 | |
| 2647 | avp = search_first_avp(0, current_partition->gw_attrs_avp, &val, |
| 2648 | NULL); |
| 2649 | if (avp) { |
| 2650 | pv_val.flags = PV_VAL_STR; |
nothing calls this directly
no test coverage detected