Bug 824220: Pass constraints through directly through message, deallocate when done r=jesup
authorAdam Roach [:abr] <adam@nostrum.com>
Thu, 27 Dec 2012 14:28:11 -0600
changeset 117181 35a0599d087a817b64c1ac67d550667d6bf6670e
parent 117180 43187d64eea37a80a1ae14195d101c28d983c26f
child 117182 10b47593c4d740146d3bcce087bc134ee42b64d5
push id24087
push usergraememcc_firefox@graeme-online.co.uk
push dateSat, 29 Dec 2012 12:13:53 +0000
treeherdermozilla-central@b5ea211f23a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs824220
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 824220: Pass constraints through directly through message, deallocate when done r=jesup
media/webrtc/signaling/include/CC_Call.h
media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
media/webrtc/signaling/src/sipcc/core/gsm/h/gsm_sdp.h
media/webrtc/signaling/src/sipcc/core/includes/ccapi.h
media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h
media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
media/webrtc/signaling/src/sipcc/include/ccapi_call.h
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
--- a/media/webrtc/signaling/include/CC_Call.h
+++ b/media/webrtc/signaling/include/CC_Call.h
@@ -263,19 +263,19 @@ namespace CSF
            @param [in] video_pref - video direction desired on call
            @param [in] digits - digits to be dialed. can be empty then this API simply goes offhook
            @param [in] ip address - the ip address of the peer to call
 
            @return void
           */
         virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip) = 0;
 
-        virtual void createOffer (const cc_media_constraints_t* constraints) = 0;
+        virtual void createOffer (cc_media_constraints_t* constraints) = 0;
 
-        virtual void createAnswer(const cc_media_constraints_t* constraints) = 0;
+        virtual void createAnswer(cc_media_constraints_t* constraints) = 0;
 
         virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp) = 0;
 
         virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp) = 0;
 
         virtual void setPeerConnection(const std::string& handle) = 0;
 
         virtual void addStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type) = 0;
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
@@ -93,17 +93,17 @@ typedef struct cc_call_info_t_{
     cc_string_t   info_body;
     cc_call_log_t call_log;
     cc_boolean    audio_mute;
     cc_boolean    video_mute;
     cc_call_conference_Info_t call_conference;
     cc_string_t   sdp;
     unsigned int  media_stream_track_id;
     unsigned int  media_stream_id;
-    const cc_media_constraints_t* cc_constraints;
+    cc_media_constraints_t* cc_constraints;
 } session_data_t;
 
 typedef enum {
     NO_ACTION=0,
     RESET_ACTION,
     RESTART_ACTION,
     RE_REGISTER_ACTION,
     STOP_ACTION,
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/cc_call_feature.c
@@ -92,47 +92,36 @@ cc_return_t cc_invokeFeature(cc_call_han
             return CC_FAILURE;
 	}
 	return CC_SUCCESS;
 }
 
 /**
  * Invoke a call feature.
  */
-cc_return_t cc_invokeFeatureSDPMode(cc_call_handle_t call_handle, group_cc_feature_t featureId, cc_jsep_action_t action,
-                                    cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type,
-                                    uint16_t level, const cc_media_constraints_t *constraints, string_t data, string_t data1) {
+cc_return_t cc_invokeFeatureSDPMode(cc_call_handle_t call_handle,
+                                    group_cc_feature_t featureId,
+                                    cc_jsep_action_t action,
+                                    cc_media_stream_id_t stream_id,
+                                    cc_media_track_id_t track_id,
+                                    cc_media_type_t media_type,
+                                    uint16_t level,
+                                    cc_media_constraints_t *constraints,
+                                    string_t data,
+                                    string_t data1) {
     session_feature_t callFeature;
-    session_data_t * sessionData;
     unsigned int session_id = 0;
     callFeature.session_id = (SESSIONTYPE_CALLCONTROL << CC_SID_TYPE_SHIFT) + call_handle;
     callFeature.featureID = featureId;
     callFeature.featData.ccData.action = action;
     callFeature.featData.ccData.media_type = media_type;
     callFeature.featData.ccData.stream_id = stream_id;
     callFeature.featData.ccData.track_id = track_id;
     callFeature.featData.ccData.level = level;
-    callFeature.featData.ccData.has_constraints = FALSE;
-
-    /* If constraints exist add to session hash */
-    if (constraints) {
-        if (constraints->constraint_count > 0 &&
-            (CC_FEATURE_CREATEOFFER == featureId || CC_FEATURE_CREATEANSWER == featureId )) {
-            /* A random number of 5 digits will not conflict with any
-             * other usage of the hash table */
-            session_id = abs(cpr_rand()) % 60000;
-            sessionData = (session_data_t *)findhash(session_id);
-            sessionData = cpr_malloc(sizeof(session_data_t));
-            memset(sessionData, 0, sizeof(session_data_t));
-            sessionData->cc_constraints = constraints;
-            (void) addhash(session_id, sessionData);
-            callFeature.featData.ccData.sessionid = session_id;
-            callFeature.featData.ccData.has_constraints = TRUE;
-        }
-    }
+    callFeature.featData.ccData.constraints = constraints;
 
     CCAPP_DEBUG(DEB_F_PREFIX"cc_invokeFeatureSDPMode:sid=%d, line=%d, cid=%d, fid=%d, video_pref=%s data=%s\n",
                         DEB_F_PREFIX_ARGS("cc_call_feature", "cc_invokeFeatureSDPMode"),
                         callFeature.session_id,
                         GET_LINE_ID(call_handle),
                         GET_CALL_ID(call_handle),
                         featureId,
                         ((featureId == CC_FEATURE_KEYPRESS) ? "...": data));
@@ -290,82 +279,84 @@ cc_return_t CC_CallFeature_dial(cc_call_
 
     if (cpr_strcasecmp(numbers, "DIAL") == 0) {
 	    return cc_invokeFeature(call_handle, CC_FEATURE_DIAL, video_pref, numbers);
     }
 
 	return cc_invokeFeature(call_handle, CC_FEATURE_DIALSTR, video_pref, numbers);
 }
 
-cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints) {
+cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle,
+                                       cc_media_constraints_t *constraints) {
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
                 GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_CREATEOFFER, JSEP_NO_ACTION,
                                    0, 0, NO_STREAM, 0, constraints, NULL, NULL);
 }
 
-cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints) {
+cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle,
+                                        cc_media_constraints_t *constraints) {
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
                 GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_CREATEANSWER, JSEP_NO_ACTION,
                                    0, 0, NO_STREAM, 0, constraints, NULL, NULL);
 }
 
 cc_return_t CC_CallFeature_SetLocalDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, string_t sdp) {
-    const cc_media_constraints_t *constraints = NULL;
+    cc_media_constraints_t *constraints = NULL;
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
             GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_SETLOCALDESC, action,
                                    0, 0, NO_STREAM, 0, constraints, sdp, NULL);
 }
 
 cc_return_t CC_CallFeature_SetRemoteDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, string_t sdp) {
-    const cc_media_constraints_t *constraints = NULL;
+    cc_media_constraints_t *constraints = NULL;
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
             GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_SETREMOTEDESC, action,
                                    0, 0, NO_STREAM, 0, constraints, sdp, NULL);
 }
 
 cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t pc) {
-    const cc_media_constraints_t *constraints = NULL;
+    cc_media_constraints_t *constraints = NULL;
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
                 GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_SETPEERCONNECTION, JSEP_NO_ACTION,
                                    0, 0, NO_STREAM, 0, constraints, pc, NULL);
 }
 
 cc_return_t CC_CallFeature_AddStream(cc_call_handle_t call_handle, cc_media_stream_id_t stream_id,
                                             cc_media_track_id_t track_id, cc_media_type_t media_type) {
-    const cc_media_constraints_t *constraints = NULL;
+    cc_media_constraints_t *constraints = NULL;
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
             GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_ADDSTREAM, JSEP_NO_ACTION,
                                    stream_id, track_id, media_type, 0, constraints, NULL, NULL);
 }
 
 cc_return_t CC_CallFeature_RemoveStream(cc_call_handle_t call_handle, cc_media_stream_id_t stream_id,
                                                cc_media_track_id_t track_id, cc_media_type_t media_type) {
 
-    const cc_media_constraints_t *constraints = NULL;
+    cc_media_constraints_t *constraints = NULL;
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
                 GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_REMOVESTREAM, JSEP_NO_ACTION,
                                    stream_id, track_id, media_type, 0, constraints, NULL, NULL);
 }
 
 cc_return_t CC_CallFeature_AddICECandidate(cc_call_handle_t call_handle, const char* candidate, const char *mid, cc_level_t level) {
-    const cc_media_constraints_t *constraints = NULL;
+    cc_media_constraints_t *constraints = NULL;
     CCAPP_DEBUG(DEB_L_C_F_PREFIX, DEB_L_C_F_PREFIX_ARGS(SIP_CC_PROV, GET_CALL_ID(call_handle),
             GET_LINE_ID(call_handle), __FUNCTION__));
 
     return cc_invokeFeatureSDPMode(call_handle, CC_FEATURE_ADDICECANDIDATE, JSEP_NO_ACTION,
                                    0, 0, NO_STREAM, (uint16_t)level, constraints, candidate, mid);
 }
 
 /**
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapi_call.c
@@ -85,21 +85,23 @@ cc_lineid_t CCAPI_Call_getLine(cc_call_h
  * @param [in] video_pref - video direction desired on call
  * @param [in] digits - digits to be dialed
  * @return SUCCESS or FAILURE
  */
 cc_return_t CCAPI_Call_originateCall(cc_call_handle_t handle, cc_sdp_direction_t video_pref, cc_string_t digits){
 	return CC_CallFeature_dial(handle, video_pref, digits);
 }
 
-cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, const cc_media_constraints_t *constraints) {
+cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle,
+                              cc_media_constraints_t *constraints) {
 	return CC_CallFeature_CreateOffer(handle, constraints);
 }
 
-cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle, const cc_media_constraints_t *constraints) {
+cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle,
+                               cc_media_constraints_t *constraints) {
 	return CC_CallFeature_CreateAnswer(handle, constraints);
 }
 
 cc_return_t CCAPI_SetLocalDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp) {
 	return CC_CallFeature_SetLocalDescription(handle, action, sdp);
 }
 
 cc_return_t CCAPI_SetRemoteDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp) {
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
@@ -584,23 +584,21 @@ processSessionEvent (line_t line_id, cal
 	     break;
          case CC_FEATURE_KEYPRESS:
              dp_int_update_keypress(line_id, call_id, (unsigned char)*data);
              break;
          case CC_FEATURE_BKSPACE:
              dp_int_update_keypress(line_id, call_id, BKSP_KEY);
              break;
          case CC_FEATURE_CREATEOFFER:
-             featdata.session.sessionid = ccData.sessionid;
-             featdata.session.has_constraints = ccData.has_constraints;
+             featdata.session.constraints = ccData.constraints;
              cc_createoffer (CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_CREATEOFFER, &featdata);
              break;
          case CC_FEATURE_CREATEANSWER:
-             featdata.session.sessionid = ccData.sessionid;
-             featdata.session.has_constraints = ccData.has_constraints;
+             featdata.session.constraints = ccData.constraints;
              cc_createanswer (CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_CREATEANSWER, data, &featdata);
              break;
          case CC_FEATURE_SETLOCALDESC:
              cc_setlocaldesc (CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_SETLOCALDESC, ccData.action, data, &featdata);
              break;
          case CC_FEATURE_SETREMOTEDESC:
              cc_setremotedesc (CC_SRC_UI, CC_SRC_GSM, call_id, (line_t)instance, CC_FEATURE_SETREMOTEDESC, ccData.action, data, &featdata);
              break;
--- a/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
@@ -909,16 +909,38 @@ fsmdef_set_per_media_local_hold_sdp (fsm
         }
         if (FSM_CHK_FLAGS(media->hold, FSM_HOLD_LCL)) {
             /* set local hold to this media entry */
             gsmsdp_set_local_hold_sdp(dcb, media);
         }
     }
 }
 
+/**
+ * This function deallocates a constraints structure
+ *
+ * @param[in]constraints - pointer to cc_media_constraints_t
+ * @return None
+ */
+void
+fsmdef_free_constraints(cc_media_constraints_t *constraints) {
+    int i;
+
+    if (!constraints) {
+       return;
+    }
+
+    for (i = 0; i < constraints->constraint_count; i++) {
+        cpr_free(constraints->constraints[i]->name);
+        cpr_free(constraints->constraints[i]->value);
+    }
+    cpr_free(constraints->constraints);
+    cpr_free(constraints);
+}
+
 void
 fsmdef_init_dcb (fsmdef_dcb_t *dcb, callid_t call_id,
                  fsmdef_call_types_t call_type,
                  string_t called_number, line_t line, fsm_fcb_t *fcb)
 {
     string_t calling_name;
     int      blocking;
     char     name[MAX_LINE_NAME_SIZE];
@@ -2885,27 +2907,20 @@ fsmdef_ev_createoffer (sm_event_t *event
     }
 
     if (dcb == NULL) {
       FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
       return SM_RC_CLEANUP;
     }
     dcb->inbound = FALSE;
 
-    if (msg->data.session.has_constraints) {
-        sess_data_p = (session_data_t *)findhash(msg->data.session.sessionid);
-        if (sess_data_p) {
-            gsmsdp_process_cap_constraints(dcb, sess_data_p->cc_constraints);
-
-            if (0 > delhash(msg->data.session.sessionid)) {
-                FSM_DEBUG_SM (DEB_F_PREFIX"failed to delete hash sessid=0x%08x\n",
-                DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__), msg->data.session.sessionid);
-            }
-            cpr_free(sess_data_p);
-        }
+    if (msg->data.session.constraints) {
+       gsmsdp_process_cap_constraints(dcb, msg->data.session.constraints);
+       fsmdef_free_constraints(msg->data.session.constraints);
+       msg->data.session.constraints = 0;
     }
 
     vcmGetIceParams(dcb->peerconnection, &ufrag, &ice_pwd);
     if (!ufrag || !ice_pwd) {
       ui_create_offer(evCreateOfferError, line, call_id,
           dcb->caller_id.call_instance_id, strlib_empty());
       return (fsmdef_release(fcb, cause, FALSE));
     }
@@ -2999,27 +3014,20 @@ fsmdef_ev_createanswer (sm_event_t *even
     }
 
     if (dcb == NULL) {
         FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
         return SM_RC_CLEANUP;
     }
     dcb->inbound = TRUE;
 
-    if (msg->data.session.has_constraints) {
-        sess_data_p = (session_data_t *)findhash(msg->data.session.sessionid);
-        if (sess_data_p) {
-            gsmsdp_process_cap_constraints(dcb, sess_data_p->cc_constraints);
-
-            if (0 > delhash(msg->data.session.sessionid)) {
-                FSM_DEBUG_SM (DEB_F_PREFIX"failed to delete hash sessid=0x%08x\n",
-                DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__), msg->data.session.sessionid);
-            }
-            cpr_free(sess_data_p);
-        }
+    if (msg->data.session.constraints) {
+       gsmsdp_process_cap_constraints(dcb, msg->data.session.constraints);
+       fsmdef_free_constraints(msg->data.session.constraints);
+       msg->data.session.constraints = 0;
     }
 
     vcmGetIceParams(dcb->peerconnection, &ufrag, &ice_pwd);
     if (!ufrag || !ice_pwd) {
       ui_create_offer(evCreateAnswerError, line, call_id,
           dcb->caller_id.call_instance_id, strlib_empty());
       return (fsmdef_release(fcb, cause, FALSE));
     }
--- a/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/gsm_sdp.c
@@ -203,17 +203,17 @@ void gsmsdp_process_cap_constraint(cc_me
   }
 }
 
 /*
  * Process constraints only related to media capabilities., i.e
  * OfferToReceiveAudio, OfferToReceiveVideo
  */
 void gsmsdp_process_cap_constraints(fsmdef_dcb_t *dcb,
-                                    const cc_media_constraints_t* constraints) {
+                                    cc_media_constraints_t* constraints) {
   int i = 0;
 
   for (i=0; i<constraints->constraint_count; i++) {
     if (strcmp(constraints_table[OfferToReceiveAudio].name,
                constraints->constraints[i]->name) == 0) {
       gsmsdp_process_cap_constraint(&dcb->media_cap_tbl->cap[CC_AUDIO_1],
                                     constraints->constraints[i]->value);
     } else if (strcmp(constraints_table[OfferToReceiveVideo].name,
--- a/media/webrtc/signaling/src/sipcc/core/gsm/h/gsm_sdp.h
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/h/gsm_sdp.h
@@ -126,17 +126,18 @@ extern boolean gsmsdp_handle_media_cap_c
 extern boolean gsmsdp_update_local_sdp_media_capability(fsmdef_dcb_t *dcb_p,
                                               boolean refresh, boolean hold);
 boolean is_gsmsdp_media_ip_updated_to_latest( fsmdef_dcb_t * dcb );
 
 void gsmsdp_add_remote_stream(uint16_t idx, int pc_stream_id, fsmdef_dcb_t * dcb, fsmdef_media_t *media);
 cc_causes_t gsmsdp_install_peer_ice_attributes(fsm_fcb_t *fcb_p);
 cc_causes_t gsmsdp_configure_dtls_data_attributes(fsm_fcb_t *fcb_p);
 cc_causes_t gsmsdp_find_level_from_mid(fsmdef_dcb_t * dcb, const char * mid, uint16_t *level);
-void gsmsdp_process_cap_constraints(fsmdef_dcb_t *dcb, const cc_media_constraints_t* constraints);
+void gsmsdp_process_cap_constraints(fsmdef_dcb_t *dcb,
+                                    cc_media_constraints_t* constraints);
 cc_causes_t
 gsmsdp_get_offered_media_types (fsm_fcb_t *fcb_p, cc_sdp_t *sdp_p, boolean *has_audio, boolean *has_video, boolean *has_data);
 fsmdef_media_t* gsmsdp_find_media_by_media_type(fsmdef_dcb_t *dcb, sdp_media_e 	media_type);
 
 extern void gsmsdp_set_ice_attribute (sdp_attr_e sdp_attr, uint16_t level,
                                       void *sdp_p, char *ice_attrib);
 
 #endif
--- a/media/webrtc/signaling/src/sipcc/core/includes/ccapi.h
+++ b/media/webrtc/signaling/src/sipcc/core/includes/ccapi.h
@@ -830,18 +830,17 @@ typedef struct cc_feature_data_track_t_ 
 
 typedef struct cc_feature_candidate_t_ {
   uint16_t    level;
   char        candidate[CANDIDATE_SIZE];
   char        mid[MID_SIZE];
 } cc_feature_candidate_t;
 
 typedef struct cc_feature_session_t_ {
-  unsigned int  sessionid;
-  cc_boolean    has_constraints;
+  cc_media_constraints_t    *constraints;
 } cc_feature_session_t;
 
 
 typedef union cc_feature_data_t {
     cc_feature_data_newcall_t   newcall;
     cc_feature_data_xfer_t      xfer;
     cc_feature_data_ind_t       indication;
     cc_feature_data_endcall_t   endcall;
--- a/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h
+++ b/media/webrtc/signaling/src/sipcc/core/includes/sessionTypes.h
@@ -42,18 +42,17 @@ typedef struct {
   string_t                  info;
   string_t                  info1;
   unsigned int              state;
   cc_jsep_action_t          action;
   cc_media_stream_id_t      stream_id;
   cc_media_track_id_t       track_id;
   cc_media_type_t           media_type;
   cc_level_t                level;
-  unsigned int              sessionid;
-  cc_boolean                has_constraints;
+  cc_media_constraints_t *  constraints;
 } ccSession_feature_t;
 
 typedef struct {
   int          state;
   int          attr;
   int          inst;
   line_t       line_id;
   int          cause;
--- a/media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
+++ b/media/webrtc/signaling/src/sipcc/include/cc_call_feature.h
@@ -146,19 +146,21 @@ cc_return_t CC_CallFeature_backSpace(cc_
  * Send a dial digit string on an active call, e.g."9191234567".
  * @param call_handle call handle
  * @param video_pref the sdp direction
  * @param numbers dialed string
  * @return SUCCESS or FAILURE
  */
 cc_return_t CC_CallFeature_dial(cc_call_handle_t call_handle, cc_sdp_direction_t video_pref, const cc_string_t numbers);
 
-cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints);
+cc_return_t CC_CallFeature_CreateOffer(cc_call_handle_t call_handle,
+                                       cc_media_constraints_t *constraints);
 
-cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle, const cc_media_constraints_t *constraints);
+cc_return_t CC_CallFeature_CreateAnswer(cc_call_handle_t call_handle,
+                                        cc_media_constraints_t *constraints);
 
 cc_return_t CC_CallFeature_SetLocalDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, const char* sdp);
 
 cc_return_t CC_CallFeature_SetRemoteDescription(cc_call_handle_t call_handle, cc_jsep_action_t action, const char* sdp);
 
 cc_return_t CC_CallFeature_SetPeerConnection(cc_call_handle_t call_handle, cc_peerconnection_t pc);
 
 cc_return_t CC_CallFeature_AddStream(cc_call_handle_t call_handle, cc_media_stream_id_t stream_id, cc_media_track_id_t id, cc_media_type_t media_type);
--- a/media/webrtc/signaling/src/sipcc/include/ccapi_call.h
+++ b/media/webrtc/signaling/src/sipcc/include/ccapi_call.h
@@ -43,19 +43,21 @@ cc_lineid_t CCAPI_Call_getLine(cc_call_h
  * @param [in] handle - call handle
  * @param [in] video_pref - video direction desired on call
  * @param [in] digits - digits to be dialed. can be empty then this API simply goes offhook
  * @return SUCCESS or FAILURE
  */
 cc_return_t CCAPI_Call_originateCall(cc_call_handle_t handle, cc_sdp_direction_t video_pref, cc_string_t digits);
 
 
-cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle, const cc_media_constraints_t *constraints);
+cc_return_t CCAPI_CreateOffer(cc_call_handle_t handle,
+                              cc_media_constraints_t *constraints);
 
-cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle, const cc_media_constraints_t *constraints);
+cc_return_t CCAPI_CreateAnswer(cc_call_handle_t handle,
+                               cc_media_constraints_t *constraints);
 
 cc_return_t CCAPI_SetLocalDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp);
 
 cc_return_t CCAPI_SetRemoteDescription(cc_call_handle_t handle, cc_jsep_action_t action, cc_string_t sdp);
 
 cc_return_t CCAPI_SetPeerConnection(cc_call_handle_t handle, cc_peerconnection_t pc);
 
 cc_return_t CCAPI_AddStream(cc_call_handle_t handle, cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type);
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
@@ -523,23 +523,23 @@ void CC_SIPCCCall::originateP2PCall (cc_
 {
     CCAPI_Config_set_server_address(ip.c_str());
     CCAPI_Call_originateCall(callHandle, video_pref, digits.c_str());
 }
 
 /*
  * This method works asynchronously, is an onCallEvent with the resulting SDP
  */
-void CC_SIPCCCall::createOffer (const cc_media_constraints_t *constraints) {
+void CC_SIPCCCall::createOffer (cc_media_constraints_t *constraints) {
     CCAPI_CreateOffer(callHandle, constraints);
 }
 /*
  * This method works asynchronously, there is onCallEvent with the resulting SDP
  */
-void CC_SIPCCCall::createAnswer (const cc_media_constraints_t *constraints) {
+void CC_SIPCCCall::createAnswer (cc_media_constraints_t *constraints) {
     CCAPI_CreateAnswer(callHandle, constraints);
 
 }
 
 void CC_SIPCCCall::setLocalDescription(cc_jsep_action_t action, const std::string & sdp) {
     CCAPI_SetLocalDescription(callHandle, action, sdp.c_str());
 }
 
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
@@ -105,18 +105,18 @@ namespace CSF
         virtual bool muteAudio();
         virtual bool unmuteAudio();
         virtual bool muteVideo();
         virtual bool unmuteVideo();
         virtual void addStream(int streamId, bool isVideo);
         virtual void removeStream(int streamId);
         virtual bool setVolume(int volume);
         virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip);
-        virtual void createOffer(const  cc_media_constraints_t *constraints);
-        virtual void createAnswer(const  cc_media_constraints_t *constraints);
+        virtual void createOffer(cc_media_constraints_t *constraints);
+        virtual void createAnswer(cc_media_constraints_t *constraints);
         virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp);
         virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp);
         virtual void setPeerConnection(const std::string& handle);
         virtual const std::string& getPeerConnection() const;
         virtual void addStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type);
         virtual void removeStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type);
         virtual CC_SIPCCCallMediaDataPtr getMediaData();
         virtual void addICECandidate(const std::string & candidate, const std::string & mid, unsigned short level);