fetch the value of a static/dynamic index */
| 52 | |
| 53 | /* fetch the value of a static/dynamic index */ |
| 54 | static inline int IDX(struct sip_msg *msg, struct sdp_pv_idx *idx) |
| 55 | { |
| 56 | pv_value_t val; |
| 57 | |
| 58 | if (!idx->is_pv_idx) |
| 59 | return idx->idx; |
| 60 | |
| 61 | if (pv_get_spec_value(msg, &idx->idx_pv, &val) != 0) { |
| 62 | LM_ERR("failed to get idx spec value\n"); |
| 63 | return -1; |
| 64 | } |
| 65 | |
| 66 | if (!(val.flags & PV_VAL_INT)) { |
| 67 | LM_ERR("SDP idx spec contains non-INT value ('%.*s')\n", |
| 68 | val.rs.len, val.rs.s); |
| 69 | return -1; |
| 70 | } |
| 71 | |
| 72 | return val.ri; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | /* returns a string representation of the index (useful for debugging) */ |
no test coverage detected