| 2986 | |
| 2987 | |
| 2988 | static int engage_force_rtpproxy(struct dlg_cell *dlg, struct sip_msg *msg) |
| 2989 | { |
| 2990 | int offer = 1; |
| 2991 | int setid; |
| 2992 | str param1_val,param2_val; |
| 2993 | int method_id, has_sdp, alloc = 0; |
| 2994 | int moved; |
| 2995 | static nh_set_param_t param = { .t = NH_VAL_SET_UNDEF }; |
| 2996 | int_str value; |
| 2997 | int val_type; |
| 2998 | |
| 2999 | LM_DBG("engage callback called\n"); |
| 3000 | |
| 3001 | if (!msg) |
| 3002 | goto done; |
| 3003 | |
| 3004 | if (dlg_api.get_dlg && !dlg) { |
| 3005 | dlg = dlg_api.get_dlg(); |
| 3006 | if (!dlg) { |
| 3007 | LM_DBG("dialog not found - cannot engage rtpproxy\n"); |
| 3008 | goto done; |
| 3009 | } |
| 3010 | } |
| 3011 | |
| 3012 | if (!dlg) { |
| 3013 | LM_ERR("null dialog\n"); |
| 3014 | goto error; |
| 3015 | } |
| 3016 | |
| 3017 | /* parse cseq header */ |
| 3018 | if(parse_headers(msg,HDR_CSEQ_F,0) < 0) { |
| 3019 | LM_ERR("cannot parse cseq header\n"); |
| 3020 | goto error; |
| 3021 | } |
| 3022 | |
| 3023 | if(msg->cseq==NULL || msg->cseq->body.s==NULL) { |
| 3024 | LM_ERR("cseq header empty\n"); |
| 3025 | goto error; |
| 3026 | } |
| 3027 | |
| 3028 | /* check to see if this is a late negotiation */ |
| 3029 | if (dlg_api.fetch_dlg_value(dlg, &late_name, &val_type, &value, 0) < 0) |
| 3030 | offer = 0; |
| 3031 | has_sdp = has_body_part(msg, TYPE_APPLICATION, SUBTYPE_SDP); |
| 3032 | |
| 3033 | method_id = get_cseq(msg)->method_id; |
| 3034 | LM_DBG("method id is %d SDP: %d\n", method_id, has_sdp); |
| 3035 | if (method_id == METHOD_ACK) { |
| 3036 | /* normal negotiation - ACK cannot have SDP */ |
| 3037 | if (!offer && has_sdp) { |
| 3038 | LM_ERR("not a late negotiation - ACK cannot have SDP body\n"); |
| 3039 | goto error; |
| 3040 | } |
| 3041 | /* late negotiation without SDP */ |
| 3042 | if (offer && !has_sdp) { |
| 3043 | LM_ERR("ACK of a late negotiation that doesn't have SDP body\n"); |
| 3044 | goto error; |
| 3045 | } |
no test coverage detected