Bug 991037 - Part 4: Get rid of the sipcc threads/queues, and run all sipcc logic on main. r=mt
authorByron Campen [:bwc] <docfaraday@gmail.com>
Wed, 30 Jul 2014 11:09:51 -0700
changeset 223923 b844017c2e61b67e91717c7d4890aa10b130630d
parent 223922 e4a05977128415057023f44684a21b83aeb12504
child 223924 64d5d948b1eaaea2ddf6a6bb778245eace2ee555
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmt
bugs991037
milestone34.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 991037 - Part 4: Get rid of the sipcc threads/queues, and run all sipcc logic on main. r=mt
media/webrtc/signaling/signaling.gyp
media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
media/webrtc/signaling/src/sipcc/core/ccapp/ccapp_task.c
media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
media/webrtc/signaling/src/sipcc/core/common/init.c
media/webrtc/signaling/src/sipcc/core/common/thread_monitor.c
media/webrtc/signaling/src/sipcc/core/common/thread_monitor.h
media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
media/webrtc/signaling/src/sipcc/core/gsm/gsm.c
media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_task.c
media/webrtc/signaling/src/sipcc/core/sipstack/sip_platform_task.c
media/webrtc/signaling/src/sipcc/core/src-common/misc_apps_task.c
media/webrtc/signaling/src/sipcc/cpr/android/cpr_android_init.c
media/webrtc/signaling/src/sipcc/cpr/android/cpr_android_threads.c
media/webrtc/signaling/src/sipcc/cpr/android/cpr_android_timers_using_select.c
media/webrtc/signaling/src/sipcc/cpr/common/cpr_ipc.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_init.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_threads.c
media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_timers_using_select.c
media/webrtc/signaling/src/sipcc/cpr/include/cpr_ipc.h
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_init.c
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_threads.c
media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_timers_using_select.c
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_defines.h
media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_timers.c
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCDevice.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCService.cpp
media/webrtc/signaling/src/softphonewrapper/CC_SIPCCService.h
--- a/media/webrtc/signaling/signaling.gyp
+++ b/media/webrtc/signaling/signaling.gyp
@@ -400,18 +400,16 @@
         './src/sipcc/core/common/prot_configmgr.h',
         './src/sipcc/core/common/resource_manager.c',
         './src/sipcc/core/common/resource_manager.h',
         './src/sipcc/core/common/sip_socket_api.c',
         './src/sipcc/core/common/subscription_handler.c',
         './src/sipcc/core/common/subscription_handler.h',
         './src/sipcc/core/common/text_strings.c',
         './src/sipcc/core/common/text_strings.h',
-        './src/sipcc/core/common/thread_monitor.h',
-        './src/sipcc/core/common/thread_monitor.c',
         './src/sipcc/core/common/ui.c',
         # GSM
         './src/sipcc/core/gsm/ccapi.c',
         './src/sipcc/core/gsm/ccapi_strings.c',
         './src/sipcc/core/gsm/dcsm.c',
         './src/sipcc/core/gsm/fim.c',
         './src/sipcc/core/gsm/fsm.c',
         './src/sipcc/core/gsm/fsmb2bcnf.c',
--- a/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
+++ b/media/webrtc/signaling/src/media/VcmSIPCCBinding.cpp
@@ -361,16 +361,17 @@ extern "C" {
  */
 
 void vcmControlRinger (vcm_ring_mode_t ringMode,
                        short once,
                        cc_boolean alert_info,
                        int line,
                        cc_callid_t call_id)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     const char fname[] = "vcmControlRinger";
 
     CSFLogDebug( logTag, "%s: ringMode=%d once=%d", fname, ringMode, once);
 
     /* we need to pass the line parameter for this */
 
 #if 0
      // <emannion> part of media provider removal
@@ -397,16 +398,17 @@ void vcmControlRinger (vcm_ring_mode_t r
  *  @param[in] side_tone - cc_boolean to enable/disable side tone
  *
  *  @return void
  *
  */
 
 void vcmEnableSidetone(cc_uint16_t side_tone)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     /* NOT REQD for TNP */
     CSFLogDebug( logTag, "vcmEnableSidetone: vcmEnableSidetone(): called");
 }
 
 /*
  *  Function:map_algorithmID
  *
  *  Parameters:algorithmID
@@ -436,24 +438,28 @@ map_algorithmID( vcm_crypto_algorithmID 
  *
  *  Description: Nothing to do for TNP.
  *
  *  Returns:none
  *
  */
 void vcmInit (void)
 {
+    // We do not do a thread assert here, since there are unit-tests that set
+    // gMainThread to something other than main, but still call the init code
+    // on main.
     CSFLogDebug( logTag, "vcmInit() called.");
 }
 
 /**
  * The unloading of the VCM module
  */
 void vcmUnload (void)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     CSFLogDebug( logTag, "vcmUnload() called.");
 }
 
 /**
  *  Allocate(Reserve) a receive port.
  *
  *  @param[in]  mcap_id - Media Capability ID
  *  @param[in]  group_id - group identifier to which stream belongs.
@@ -468,16 +474,17 @@ void vcmUnload (void)
 
 void vcmRxAllocPort(cc_mcapid_t mcap_id,
                     cc_groupid_t group_id,
                     cc_streamid_t stream_id,
                     cc_call_handle_t  call_handle,
                     cc_uint16_t port_requested,
                     int *port_allocated)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     *port_allocated = -1;
     CSFLogDebug( logTag, "vcmRxAllocPort(): group_id=%d stream_id=%d call_handle=%d port_requested = %d",
         group_id, stream_id, call_handle, port_requested);
 
     // Not in SDP/PeerConnection mode
     int port = -1;
     bool isVideo = false;
     if(CC_IS_AUDIO(mcap_id))
@@ -496,29 +503,20 @@ void vcmRxAllocPort(cc_mcapid_t mcap_id,
     StreamObserver* obs = VcmSIPCCBinding::getStreamObserver();
     if(obs != nullptr)
       obs->registerStream(call_handle, stream_id, isVideo);
 
     CSFLogDebug( logTag, "vcmRxAllocPort(): allocated port %d", port);
     *port_allocated = port;
 }
 
-static void InformPCOfNewMline_m(const std::string &peerconnection,
-                                 uint16_t level) {
-  sipcc::PeerConnectionWrapper pc(peerconnection.c_str());
-  ENSURE_PC_NO_RET(pc, peerconnection.c_str());
-
-  pc.impl()->OnNewMline(level);
-}
-
-
 /**
  *  Gets the ICE parameters for a stream. Called "alloc" for style consistency
  *
- *  @param[in]  mcap_id  - media cap id
+ *  @param[in]  mcap_id - Media Capability ID
  *  @param[in]  group_id - group identifier to which stream belongs.
  *  @param[in]  stream_id - stream identifier
  *  @param[in]  call_handle  - call identifier
  *  @param[in]  peerconnection - the peerconnection in use
  *  @param[in]  level - the m-line index (1-based)
  *  @param[out] default_addrp - the ICE default addr
  *  @param[out] port_allocatedp - the ICE default port
  *  @param[out] candidatesp - the ICE candidate array
@@ -554,39 +552,36 @@ short vcmRxAllocICE(cc_mcapid_t mcap_id,
   *default_addrp = (char *) cpr_malloc(default_addr.size() + 1);
   if (!*default_addrp)
     return VCM_ERROR;
   sstrncpy(*default_addrp, default_addr.c_str(), default_addr.size() + 1);
   *default_portp = default_port; /* This is the signal that things are cool */
 
   // Now, we let the PeerConnectionImpl know that another m-line has been added
   // This is necessary to avoid trickling extra candidates that aren't needed.
-  std::string pc_handle(peerconnection);
-  nsresult rv = VcmSIPCCBinding::getMainThread()->Dispatch(
-      WrapRunnableNM(&InformPCOfNewMline_m, pc_handle, level),
-      NS_DISPATCH_NORMAL);
-
-  if (NS_FAILED(rv)) {
-    return VCM_ERROR;
-  }
+  sipcc::PeerConnectionWrapper pc(peerconnection);
+  ENSURE_PC(pc, VCM_ERROR);
+
+  pc.impl()->OnNewMline(level);
 
   return 0;
 }
 
 /* Get ICE global parameters (ufrag and pwd)
  *  @param[in]  peerconnection - the peerconnection in use
  *  @param[out] ufragp - where to put the ufrag
  *  @param[out] pwdp - where to put the pwd
  *
  *  @return 0 for success; VCM_ERROR for failure
  */
-static short vcmGetIceParams_m(const char *peerconnection,
-                               char **ufragp,
-                               char **pwdp)
+short vcmGetIceParams(const char *peerconnection,
+                      char **ufragp,
+                      char **pwdp)
 {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
 
   *ufragp = *pwdp = nullptr;
 
  // Note: we don't acquire any media resources here, and we assume that the
   // ICE streams already exist, so we're just acquiring them. Any logic
   // to make them on demand is elsewhere.
   sipcc::PeerConnectionWrapper pc(peerconnection);
@@ -628,55 +623,31 @@ static short vcmGetIceParams_m(const cha
   }
 
   *ufragp = ufrag;
   *pwdp = pwd;
 
   return 0;
 }
 
-/* Get ICE global parameters (ufrag and pwd)
- *
- * This is a thunk to vcmGetIceParams_m.
- *
- *  @param[in]  peerconnection - the peerconnection in use
- *  @param[out] ufragp - where to put the ufrag
- *  @param[out] pwdp - where to put the pwd
- *
- *  @return 0 for success; VCM_ERROR for failure
- */
-short vcmGetIceParams(const char *peerconnection,
-                     char **ufragp,
-                     char **pwdp)
-{
-  int ret;
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmGetIceParams_m,
-                        peerconnection,
-                        ufragp,
-                        pwdp,
-                        &ret));
-  return ret;
-}
-
-
 /* Set remote ICE global parameters.
  *
  *  @param[in]  peerconnection - the peerconnection in use
  *  @param[in]  ufrag - the ufrag
  *  @param[in]  pwd - the pwd
  *  @param[in]  icelite - is peer ice lite
  *
  *  @return 0 for success; VCM_ERROR for failure
  */
-static short vcmSetIceSessionParams_m(const char *peerconnection,
-                                      char *ufrag,
-                                      char *pwd,
-                                      cc_boolean icelite)
+short vcmSetIceSessionParams(const char *peerconnection,
+                             char *ufrag,
+                             char *pwd,
+                             cc_boolean icelite)
 {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
 
   sipcc::PeerConnectionWrapper pc(peerconnection);
   ENSURE_PC(pc, VCM_ERROR);
 
   std::vector<std::string> attributes;
 
   if (ufrag)
@@ -692,57 +663,29 @@ static short vcmSetIceSessionParams_m(co
   if (!NS_SUCCEEDED(res)) {
     CSFLogError( logTag, "%s: couldn't parse global parameters", __FUNCTION__ );
     return VCM_ERROR;
   }
 
   return 0;
 }
 
-/* Set remote ICE global parameters.
- *
- * This is a thunk to vcmSetIceSessionParams_m.
- *
- *  @param[in]  peerconnection - the peerconnection in use
- *  @param[in]  ufrag - the ufrag
- *  @param[in]  pwd - the pwd
- *  @param[in]  icelite - is peer using ice-lite
- *
- *  @return 0 success, error failure
- */
-short vcmSetIceSessionParams(const char *peerconnection,
-                             char *ufrag,
-                             char *pwd,
-                             cc_boolean icelite)
-{
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmSetIceSessionParams_m,
-                        peerconnection,
-                        ufrag,
-                        pwd,
-                        icelite,
-                        &ret));
-
-  return ret;
-}
-
 /* Set ice candidate for trickle ICE.
  *
  *  @param[in]  peerconnection - the peerconnection in use
  *  @param[in]  icecandidate - the icecandidate
  *  @param[in]  level - the m line level
  *
  *  @return 0 success, error failure
  */
-static short vcmSetIceCandidate_m(const char *peerconnection,
-                                  const char *icecandidate,
-                                  uint16_t level)
+short vcmSetIceCandidate(const char *peerconnection,
+                         const char *icecandidate,
+                         uint16_t level)
 {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
 
   sipcc::PeerConnectionWrapper pc(peerconnection);
   ENSURE_PC(pc, VCM_ERROR);
 
   CSFLogDebug( logTag, "%s(): Getting stream %d", __FUNCTION__, level);
   mozilla::RefPtr<NrIceMediaStream> stream = pc.impl()->media()->
     ice_media_stream(level-1);
@@ -763,49 +706,23 @@ static short vcmSetIceCandidate_m(const 
 
   // TODO(ekr@rtfm.com): generate an error if the parse
   // fails. Bug 847449.
 
   return 0;
 }
 
 
-/* Set ice candidate for trickle ICE.
- *
- * This is a thunk to vcmSetIceCandidate_m
- *
- *  @param[in]  peerconnection - the peerconnection in use
- *  @param[in]  icecandidate - the icecandidate
- *  @param[in]  level - the m line level
- *
- *  @return 0 success, error failure
- */
-short vcmSetIceCandidate(const char *peerconnection,
-                         const char *icecandidate,
-                         uint16_t level)
-{
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmSetIceCandidate_m,
-                        peerconnection,
-                        icecandidate,
-                        level,
-                        &ret));
-
-  return ret;
-}
-
-
 /* Start ICE checks
  *  @param[in]  peerconnection - the peerconnection in use
  *  @return 0 success, error failure
  */
-static short vcmStartIceChecks_m(const char *peerconnection, cc_boolean isControlling)
+short vcmStartIceChecks(const char *peerconnection, cc_boolean isControlling)
 {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
 
   sipcc::PeerConnectionWrapper pc(peerconnection);
   ENSURE_PC(pc, VCM_ERROR);
 
   nsresult res;
   res = pc.impl()->media()->ice_ctx()->SetControlling(
       isControlling ? NrIceCtx::ICE_CONTROLLING : NrIceCtx::ICE_CONTROLLED);
@@ -822,53 +739,34 @@ static short vcmStartIceChecks_m(const c
   if (!NS_SUCCEEDED(rv)) {
     CSFLogError( logTag, "%s(): Could not dispatch to ICE thread", __FUNCTION__);
     return VCM_ERROR;
   }
 
   return 0;
 }
 
-/* Start ICE checks
- *
- * This is a thunk to vcmStartIceChecks_m
- *
- *  @param[in]  peerconnection - the peerconnection in use
- *  @return 0 success, error failure
- */
-short vcmStartIceChecks(const char *peerconnection, cc_boolean isControlling)
-{
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmStartIceChecks_m,
-                        peerconnection,
-                        isControlling,
-                        &ret));
-
-  return ret;
-}
-
 /* Set remote ICE media-level parameters.
  *
  *  @param[in]  peerconnection - the peerconnection in use
  *  @param[in]  level - the m-line
  *  @param[in]  ufrag - the ufrag
  *  @param[in]  pwd - the pwd
  *  @param[in]  candidates - the candidates
  *  @param[in]  candidate_ct - the number of candidates
  *  @return 0 success, error failure
  */
-static short vcmSetIceMediaParams_m(const char *peerconnection,
-                                    int level,
-                                    char *ufrag,
-                                    char *pwd,
-                                    char **candidates,
-                                    int candidate_ct)
+short vcmSetIceMediaParams(const char *peerconnection,
+                           int level,
+                           char *ufrag,
+                           char *pwd,
+                           char **candidates,
+                           int candidate_ct)
 {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
 
   sipcc::PeerConnectionWrapper pc(peerconnection);
   ENSURE_PC(pc, VCM_ERROR);
 
   CSFLogDebug( logTag, "%s(): Getting stream %d", __FUNCTION__, level);
   mozilla::RefPtr<NrIceMediaStream> stream = pc.impl()->media()->
     ice_media_stream(level-1);
@@ -891,67 +789,33 @@ static short vcmSetIceMediaParams_m(cons
   if (!NS_SUCCEEDED(res)) {
     CSFLogError( logTag, "%s: couldn't parse global parameters", __FUNCTION__ );
     return VCM_ERROR;
   }
 
   return 0;
 }
 
-/* Set remote ICE media-level parameters.
- *
- * This is a thunk to vcmSetIceMediaParams_w
- *
- *  @param[in]  peerconnection - the peerconnection in use
- *  @param[in]  level - the m-line
- *  @param[in]  ufrag - the ufrag
- *  @param[in]  pwd - the pwd
- *  @param[in]  candidates - the candidates
- *  @param[in]   candidate_ct - the number of candidates
- *  @return 0 success, error failure
- */
-short vcmSetIceMediaParams(const char *peerconnection,
-                           int level,
-                           char *ufrag,
-                           char *pwd,
-                           char **candidates,
-                           int candidate_ct)
-{
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmSetIceMediaParams_m,
-                     peerconnection,
-                     level,
-                     ufrag,
-                     pwd,
-                     candidates,
-                     candidate_ct,
-                     &ret));
-
-  return ret;
-}
-
-
 /*
  * Create a remote stream
  *
  *  @param[in] mcap_id - group identifier to which stream belongs.
  *  @param[in]  peerconnection - the peerconnection in use
  *  @param[out] pc_stream_id - the id of the allocated stream
  *
  *  TODO(ekr@rtfm.com): Revise along with everything else for the
  *  new stream model.
  *
  *  Returns: zero(0) for success; otherwise, ERROR for failure
  */
-static short vcmCreateRemoteStream_m(
+short vcmCreateRemoteStream(
   cc_mcapid_t mcap_id,
   const char *peerconnection,
   int *pc_stream_id) {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   nsresult res;
 
   *pc_stream_id = -1;
 
   CSFLogDebug( logTag, "%s", __FUNCTION__);
   sipcc::PeerConnectionWrapper pc(peerconnection);
   ENSURE_PC(pc, VCM_ERROR);
 
@@ -968,61 +832,32 @@ static short vcmCreateRemoteStream_m(
 
   CSFLogDebug( logTag, "%s: created remote stream with index %d",
     __FUNCTION__, *pc_stream_id);
 
   return 0;
 }
 
 /*
- * Create a remote stream
- *
- * This is a thunk to vcmCreateRemoteStream_m
- *
- *  @param[in] mcap_id - group identifier to which stream belongs.
- *  @param[in]  peerconnection - the peerconnection in use
- *  @param[out] pc_stream_id - the id of the allocated stream
- *
- *  TODO(ekr@rtfm.com): Revise along with everything else for the
- *  new stream model.
- *
- *  Returns: zero(0) for success; otherwise, ERROR for failure
- */
-short vcmCreateRemoteStream(cc_mcapid_t mcap_id,
-                            const char *peerconnection,
-                            int *pc_stream_id)
-{
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmCreateRemoteStream_m,
-                        mcap_id,
-                        peerconnection,
-                        pc_stream_id,
-                        &ret));
-
-  return ret;
-}
-
-/*
  * Add remote stream hint
  *
  * We are sending track information up to PeerConnection before
  * the tracks exist so it knows when the stream is fully constructed.
  *
  * @param[in] peerconnection
  * @param[in] pc_stream_id
  * @param[in] is_video
  *
  * Returns: zero(0) for success; otherwise, ERROR for failure
  */
-static short vcmAddRemoteStreamHint_m(
+short vcmAddRemoteStreamHint(
   const char *peerconnection,
   int pc_stream_id,
   cc_boolean is_video) {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   nsresult res;
 
   sipcc::PeerConnectionWrapper pc(peerconnection);
   ENSURE_PC(pc, VCM_ERROR);
 
   res = pc.impl()->media()->AddRemoteStreamHint(pc_stream_id,
     is_video ? TRUE : FALSE);
   if (NS_FAILED(res)) {
@@ -1031,161 +866,78 @@ static short vcmAddRemoteStreamHint_m(
 
   CSFLogDebug( logTag, "%s: added remote stream hint %u with index %d",
     __FUNCTION__, is_video, pc_stream_id);
 
   return 0;
 }
 
 /*
- * Add remote stream hint
- *
- * This is a thunk to vcmAddRemoteStreamHint_m
- *
- * Returns: zero(0) for success; otherwise, ERROR for failure
- */
-short vcmAddRemoteStreamHint(
-  const char *peerconnection,
-  int pc_stream_id,
-  cc_boolean is_video) {
-  short ret = 0;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmAddRemoteStreamHint_m,
-                        peerconnection,
-                        pc_stream_id,
-                        is_video,
-                        &ret));
-
-  return ret;
-}
-
-/*
  * Get DTLS key data
  *
  *  @param[in]  peerconnection - the peerconnection in use
  *  @param[out] digest_algp    - the digest algorithm e.g. 'sha-256'
  *  @param[in] max_digest_alg_len - available length of string
  *  @param[out] digestp        - the digest string
  *  @param[in] max_digest_len - available length of string
  *
  *  Returns: zero(0) for success; otherwise, ERROR for failure
  */
-static short vcmGetDtlsIdentity_m(const char *peerconnection,
-                                  char *digest_algp,
-                                  size_t max_digest_alg_len,
-                                  char *digestp,
-                                  size_t max_digest_len) {
-
+short vcmGetDtlsIdentity(const char *peerconnection,
+                         char *digest_algp,
+                         size_t max_digest_alg_len,
+                         char *digestp,
+                         size_t max_digest_len) {
+
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   digest_algp[0]='\0';
   digestp[0]='\0';
 
   sipcc::PeerConnectionWrapper pc(peerconnection);
   ENSURE_PC(pc, VCM_ERROR);
 
   std::string algorithm = pc.impl()->GetFingerprintAlgorithm();
   sstrncpy(digest_algp, algorithm.c_str(), max_digest_alg_len);
   std::string value = pc.impl()->GetFingerprintHexValue();
   sstrncpy(digestp, value.c_str(), max_digest_len);
 
   return 0;
 }
 
-/*
- * Get DTLS key data
- *
- * This is a thunk to vcmGetDtlsIdentity_m
- *
- *  @param[in]  peerconnection - the peerconnection in use
- *  @param[out] digest_algp    - the digest algorithm e.g. 'SHA-1'
- *  @param[in] max_digest_alg_len - length of string
- *  @param[out] digestp        - the digest string
- *  @param[in] max_digest_len - length of string
- *
- *  Returns: zero(0) for success; otherwise, ERROR for failure
- */
-short vcmGetDtlsIdentity(const char *peerconnection,
-                         char *digest_algp,
-                         size_t max_digest_alg_len,
-                         char *digestp,
-                         size_t max_digest_len) {
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmGetDtlsIdentity_m,
-                        peerconnection,
-                        digest_algp,
-                        max_digest_alg_len,
-                        digestp,
-                        max_digest_len,
-                        &ret));
-
-  return ret;
-}
-
 /* Set negotiated DataChannel parameters.
  *
  *  @param[in]  peerconnection - the peerconnection in use
  *  @param[in]  streams - the number of streams for this data channel
  *  @param[in]  local_datachannel_port - the negotiated sctp port
  *  @param[in]  remote_datachannel_port - the negotiated sctp port
  *  @param[in]  protocol - the protocol as a string
  *
  *  @return 0 success, error failure
  */
-static short vcmInitializeDataChannel_m(const char *peerconnection,
+short vcmInitializeDataChannel(const char *peerconnection,
   int track_id, cc_uint16_t streams,
   int local_datachannel_port, int remote_datachannel_port, const char* protocol)
 {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   nsresult res;
 
   CSFLogDebug( logTag, "%s: PC = %s", __FUNCTION__, peerconnection);
 
   sipcc::PeerConnectionWrapper pc(peerconnection);
   ENSURE_PC(pc, VCM_ERROR);
 
   res = pc.impl()->InitializeDataChannel(track_id, local_datachannel_port,
                                          remote_datachannel_port, streams);
   if (NS_FAILED(res)) {
     return VCM_ERROR;
   }
 
   return 0;
 }
 
-/* Set negotiated DataChannel parameters.
- *
- *  @param[in]  peerconnection - the peerconnection in use
- *  @param[in]  streams - the number of streams for this data channel
- *  @param[in]  local_datachannel_port - the negotiated sctp port
- *  @param[in]  remote_datachannel_port - the negotiated sctp port
- *  @param[in]  protocol - the protocol as a string
- *
- *  @return 0 success, error failure
- */
-short vcmInitializeDataChannel(const char *peerconnection, int track_id,
-  cc_uint16_t streams,
-  int local_datachannel_port, int remote_datachannel_port, const char* protocol)
-{
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmInitializeDataChannel_m,
-                        peerconnection,
-                        track_id,
-                        streams,
-                        local_datachannel_port,
-                        remote_datachannel_port,
-                        protocol,
-                        &ret));
-
-  return ret;
-}
-
-
 /**
  *   Should we remove this from external API
  *
  *  @param[in] mcap_id - group identifier to which stream belongs.
  *  @param[in]     group_id         - group identifier
  *  @param[in]     stream_id        - stream identifier
  *  @param[in]     call_handle      - call identifier
  *  @param[in]     port_requested   - requested port.
@@ -1203,16 +955,17 @@ short vcmRxOpen(cc_mcapid_t mcap_id,
                 cc_groupid_t group_id,
                 cc_streamid_t stream_id,
                 cc_call_handle_t call_handle,
                 cc_uint16_t port_requested,
                 cpr_ip_addr_t *listen_ip,
                 cc_boolean is_multicast,
                 int *port_allocated)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     char fname[] = "vcmRxOpen";
 
     char dottedIP[20] = "";
     *port_allocated = -1;
     if(listen_ip)
     {
         csf_sprintf(dottedIP, sizeof(dottedIP), "%u.%u.%u.%u",
                 (listen_ip->u.ip4 >> 24) & 0xff, (listen_ip->u.ip4 >> 16) & 0xff,
@@ -1264,26 +1017,27 @@ short vcmRxOpen(cc_mcapid_t mcap_id,
  *  @param[in]    algorithmID - crypto alogrithm ID
  *  @param[in]    rx_key      - rx key used when algorithm ID is encrypting
  *  @param[in]    attrs       - media attributes
  *
  *  @return   zero(0) for success; otherwise, -1 for failure
  *
  */
 int vcmRxStart(cc_mcapid_t mcap_id,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        cc_call_handle_t  call_handle,
-        const vcm_payload_info_t *payload,
-        cpr_ip_addr_t *local_addr,
-        cc_uint16_t port,
-        vcm_crypto_algorithmID algorithmID,
-        vcm_crypto_key_t *rx_key,
-        vcm_mediaAttrs_t *attrs)
+               cc_groupid_t group_id,
+               cc_streamid_t stream_id,
+               cc_call_handle_t  call_handle,
+               const vcm_payload_info_t *payload,
+               cpr_ip_addr_t *local_addr,
+               cc_uint16_t port,
+               vcm_crypto_algorithmID algorithmID,
+               vcm_crypto_key_t *rx_key,
+               vcm_mediaAttrs_t *attrs)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     uint8_t    *key;
     uint8_t    *salt;
     cc_uint16_t    key_len;
     cc_uint16_t    salt_len;
     char        fname[] = "vcmRxStart";
 
     CSFLogDebug( logTag, "%s: group_id=%d call_handle=%d payload=%d port=%d"
         " algID=%d", fname, group_id, call_handle, payload->remote_rtp_pt,
@@ -1365,31 +1119,32 @@ int vcmRxStart(cc_mcapid_t mcap_id,
  *  @param[in]   setup          - whether playing client or server role
  *  @param[in]   fingerprint_alg - the DTLS fingerprint algorithm
  *  @param[in]   fingerprint  - the DTLS fingerprint
  *  @param[in]   attrs        - media attributes
  *
  *  Returns: zero(0) for success; otherwise, ERROR for failure
  */
 
-static int vcmRxStartICE_m(cc_mcapid_t mcap_id,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        int level,
-        int pc_stream_id,
-        int pc_track_id,
-        cc_call_handle_t  call_handle,
-        const char *peerconnection,
-        int num_payloads,
-        const vcm_payload_info_t* payloads,
-        sdp_setup_type_e setup_type,
-        const char *fingerprint_alg,
-        const char *fingerprint,
-        vcm_mediaAttrs_t *attrs)
+int vcmRxStartICE(cc_mcapid_t mcap_id,
+                  cc_groupid_t group_id,
+                  cc_streamid_t stream_id,
+                  int level,
+                  int pc_stream_id,
+                  int pc_track_id,
+                  cc_call_handle_t  call_handle,
+                  const char *peerconnection,
+                  int num_payloads,
+                  const vcm_payload_info_t* payloads,
+                  sdp_setup_type_e setup_type,
+                  const char *fingerprint_alg,
+                  const char *fingerprint,
+                  vcm_mediaAttrs_t *attrs)
 {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   CSFLogDebug( logTag, "%s(%s) track = %d, stream = %d, level = %d",
               __FUNCTION__,
               peerconnection,
               pc_track_id,
               pc_stream_id,
               level);
 
   // Find the PC.
@@ -1613,97 +1368,34 @@ static int vcmRxStartICE_m(cc_mcapid_t m
     CSFLogError(logTag, "%s: mcap_id unrecognized", __FUNCTION__);
     return VCM_ERROR;
   }
 
   CSFLogDebug( logTag, "%s success", __FUNCTION__);
   return 0;
 }
 
-
-/**
- *  start rx stream
- *  Same concept as vcmRxStart but for ICE/PeerConnection-based flows
- *
- *  This is a thunk to vcmRxStartICE_m
- *
- *  @param[in]   mcap_id      - media cap id
- *  @param[in]   group_id     - group identifier to which the stream belongs
- *  @param[in]   stream_id    - stream id of the given media type.
- *  @param[in]   level        - the m-line index
- *  @param[in]   pc_stream_id - the media stream index (from PC.addStream())
- *  @param[i]n   pc_track_id  - the track within the media stream
- *  @param[in]   call_handle  - call handle
- *  @param[in]  peerconnection - the peerconnection in use
- *  @param[in]  num_payloads   - number of negotiated payloads
- *  @param[in]  payloads       - negotiated codec details list
- *  @param[in]   setup_type    - whether playing client or server role
- *  @param[in]   fingerprint_alg - the DTLS fingerprint algorithm
- *  @param[in]   fingerprint  - the DTLS fingerprint
- *  @param[in]   attrs        - media attributes
- *
- *  Returns: zero(0) for success; otherwise, ERROR for failure
- */
-
-int vcmRxStartICE(cc_mcapid_t mcap_id,
-                  cc_groupid_t group_id,
-                  cc_streamid_t stream_id,
-                  int level,
-                  int pc_stream_id,
-                  int pc_track_id,
-                  cc_call_handle_t  call_handle,
-                  const char *peerconnection,
-                  int num_payloads,
-                  const vcm_payload_info_t* payloads,
-                  sdp_setup_type_e setup_type,
-                  const char *fingerprint_alg,
-                  const char *fingerprint,
-                  vcm_mediaAttrs_t *attrs)
-{
-  int ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmRxStartICE_m,
-                        mcap_id,
-                        group_id,
-                        stream_id,
-                        level,
-                        pc_stream_id,
-                        pc_track_id,
-                        call_handle,
-                        peerconnection,
-                        num_payloads,
-                        payloads,
-                        setup_type,
-                        fingerprint_alg,
-                        fingerprint,
-                        attrs,
-                        &ret));
-
-  return ret;
-}
-
-
 /**
  *  Close the receive stream.
  *
  *  @param[in]    mcap_id - Media Capability ID
  *  @param[in]    group_id - group identifier that belongs to the stream.
  *  @param[in]    stream_id - stream id of the given media type.
  *  @param[in]    call_handle  - call identifier
  *
  *  @return 0 for success; VCM_ERROR for failure
  *
  */
 
 short vcmRxClose(cc_mcapid_t mcap_id,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        cc_call_handle_t  call_handle)
+                 cc_groupid_t group_id,
+                 cc_streamid_t stream_id,
+                 cc_call_handle_t  call_handle)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     char fname[] = "vcmRxClose";
 
     CSFLogDebug( logTag, "%s: group_id=%d call_handle=%d", fname, group_id, call_handle);
 
     if (call_handle == CC_NO_CALL_ID) {
         CSFLogDebug( logTag, "No CALL ID");
         /* no operation when no call ID */
         return VCM_ERROR;
@@ -1738,16 +1430,17 @@ short vcmRxClose(cc_mcapid_t mcap_id,
  */
 
 void vcmRxReleasePort  (cc_mcapid_t mcap_id,
                         cc_groupid_t group_id,
                         cc_streamid_t stream_id,
                         cc_call_handle_t  call_handle,
                         int port)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     CSFLogDebug( logTag, "vcmRxReleasePort(): group_id=%d stream_id=%d call_handle=%d port=%d",
                       group_id, stream_id, call_handle, port);
 
     if(CC_IS_AUDIO(mcap_id))
     {
         if ( VcmSIPCCBinding::getAudioTermination() != nullptr )
             VcmSIPCCBinding::getAudioTermination()->rxRelease( group_id, stream_id, port );
     }
@@ -1842,22 +1535,23 @@ map_tone_type( vcm_tones_t tone )
  *  @param[in] stream_id   - stream identifier.
  *  @param[in] direction  - network, speaker, both
  *
  *  @return void
  *
  */
 
 void vcmToneStart(vcm_tones_t tone,
-        short alert_info,
-        cc_call_handle_t  call_handle,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        cc_uint16_t direction)
+                  short alert_info,
+                  cc_call_handle_t  call_handle,
+                  cc_groupid_t group_id,
+                  cc_streamid_t stream_id,
+                  cc_uint16_t direction)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     const char fname[] = "vcmToneStart";
 
     CSFLogDebug( logTag, "%s:tone=%d call_handle=%d dir=%d", fname, tone, call_handle, direction);
 
     VcmSIPCCBinding::getAudioTermination()->toneStart( map_tone_type(tone), (ToneDirection)direction,
                                 alert_info, group_id, stream_id, FALSE );
     /*
      * Set delay value for multi-part tones and repeated tones.
@@ -1901,22 +1595,23 @@ void vcmToneStart(vcm_tones_t tone,
  * @param[in] group_id - identifier of the group to which stream belongs
  * @param[in] stream_id   - stream identifier.
  * @param[in] direction  - network, speaker, both
  *
  * @return void
  */
 
 void vcmToneStartWithSpeakerAsBackup(vcm_tones_t tone,
-        short alert_info,
-        cc_call_handle_t  call_handle,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        cc_uint16_t direction)
+                                     short alert_info,
+                                     cc_call_handle_t  call_handle,
+                                     cc_groupid_t group_id,
+                                     cc_streamid_t stream_id,
+                                     cc_uint16_t direction)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     const char fname[] = "vcmToneStartWithSpeakerAsBackup";
 
     CSFLogDebug( logTag, "%s:tone=%d call_handle=%d dir=%d", fname, tone, call_handle, direction);
 
     VcmSIPCCBinding::getAudioTermination()->toneStart( map_tone_type(tone), (ToneDirection)direction,
                                 alert_info, group_id, stream_id, TRUE );
     /*
      * Update dcb->active_tone if start request
@@ -1936,20 +1631,21 @@ void vcmToneStartWithSpeakerAsBackup(vcm
  * @param[in] stream_id - associated stream id
  * @param[in] call_handle - the context (call) for this tone.
  *
  * @return void
  *
  */
 
 void vcmToneStop(vcm_tones_t tone,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        cc_call_handle_t call_handle)
+                 cc_groupid_t group_id,
+                 cc_streamid_t stream_id,
+                 cc_call_handle_t call_handle)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     const char fname[] = "vcmToneStop";
 
     CSFLogDebug( logTag, "%s:tone=%d stream_id=%d", fname, tone, stream_id);
 /*
     lsm_stop_multipart_tone_timer();
     lsm_stop_continuous_tone_timer();
     */
 
@@ -1964,20 +1660,21 @@ void vcmToneStop(vcm_tones_t tone,
  *  @param[in]  stream_id - stream identifier
  *  @param[in]  call_handle - call identifier
  *
  *  @return  zero(0) for success; otherwise, ERROR for failure
  *
  */
 
 short vcmTxOpen(cc_mcapid_t mcap_id,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        cc_call_handle_t  call_handle)
+                cc_groupid_t group_id,
+                cc_streamid_t stream_id,
+                cc_call_handle_t call_handle)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     char        fname[] = "vcmTxOpen";
 
     CSFLogDebug( logTag, "%s: group_id=%d call_handle=%d", fname, group_id, call_handle);
 
     if (call_handle == CC_NO_CALL_ID) {
         /* no operation when no call ID */
         return VCM_ERROR;
     }
@@ -2059,29 +1756,30 @@ static int vcmEnsureExternalCodec(
  *  @param[in]   algorithmID  - crypto alogrithm ID
  *  @param[in]   tx_key       - tx key used when algorithm ID is encrypting.
  *  @param[in]   attrs        - media attributes
  *
  *  Returns: zero(0) for success; otherwise, ERROR for failure
  *
  */
 int vcmTxStart(cc_mcapid_t mcap_id,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        cc_call_handle_t  call_handle,
-        const vcm_payload_info_t *payload,
-        short tos,
-        cpr_ip_addr_t *local_addr,
-        cc_uint16_t local_port,
-        cpr_ip_addr_t *remote_ip_addr,
-        cc_uint16_t remote_port,
-        vcm_crypto_algorithmID algorithmID,
-        vcm_crypto_key_t *tx_key,
-        vcm_mediaAttrs_t *attrs)
+               cc_groupid_t group_id,
+               cc_streamid_t stream_id,
+               cc_call_handle_t  call_handle,
+               const vcm_payload_info_t *payload,
+               short tos,
+               cpr_ip_addr_t *local_addr,
+               cc_uint16_t local_port,
+               cpr_ip_addr_t *remote_ip_addr,
+               cc_uint16_t remote_port,
+               vcm_crypto_algorithmID algorithmID,
+               vcm_crypto_key_t *tx_key,
+               vcm_mediaAttrs_t *attrs)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     const char fname[] = "vcmTxStart";
     uint8_t    *key;
     uint8_t    *salt;
     cc_uint16_t    key_len;
     cc_uint16_t    salt_len;
 
     char dottedIP[20];
     csf_sprintf(dottedIP, sizeof(dottedIP), "%u.%u.%u.%u",
@@ -2274,31 +1972,32 @@ static int vcmTxCreateVideoConduit(int l
  *  @param[in]   fingerprint  - the DTLS fingerprint
  *  @param[in]   attrs        - media attributes
  *
  *  Returns: zero(0) for success; otherwise, ERROR for failure
  *
  */
 #define EXTRACT_DYNAMIC_PAYLOAD_TYPE(PTYPE) ((PTYPE)>>16)
 
-static int vcmTxStartICE_m(cc_mcapid_t mcap_id,
-                           cc_groupid_t group_id,
-                           cc_streamid_t stream_id,
-                           int level,
-                           int pc_stream_id,
-                           int pc_track_id,
-                           cc_call_handle_t  call_handle,
-                           const char *peerconnection,
-                           const vcm_payload_info_t *payload,
-                           short tos,
-                           sdp_setup_type_e setup_type,
-                           const char *fingerprint_alg,
-                           const char *fingerprint,
-                           vcm_mediaAttrs_t *attrs)
+int vcmTxStartICE(cc_mcapid_t mcap_id,
+                  cc_groupid_t group_id,
+                  cc_streamid_t stream_id,
+                  int level,
+                  int pc_stream_id,
+                  int pc_track_id,
+                  cc_call_handle_t  call_handle,
+                  const char *peerconnection,
+                  const vcm_payload_info_t *payload,
+                  short tos,
+                  sdp_setup_type_e setup_type,
+                  const char *fingerprint_alg,
+                  const char *fingerprint,
+                  vcm_mediaAttrs_t *attrs)
 {
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   CSFLogDebug(logTag, "%s(%s) track = %d, stream = %d, level = %d",
               __FUNCTION__,
               peerconnection,
               pc_track_id,
               pc_stream_id,
               level);
 
   // Find the PC and get the stream
@@ -2341,16 +2040,17 @@ static int vcmTxStartICE_m(cc_mcapid_t m
   } else if (CC_IS_VIDEO(mcap_id)) {
     mediaType = "video";
     err = vcmTxCreateVideoConduit(level, payload, pc, attrs, conduit);
     is_video = true;
   } else {
     CSFLogError(logTag, "%s: mcap_id unrecognized", __FUNCTION__);
   }
   if (err) {
+    CSFLogError(logTag, "%s: failed to create %s conduit", __FUNCTION__, mediaType);
     return err;
   }
 
   pc.impl()->media()->AddConduit(level, false, conduit);
 
   // Now we have all the pieces, create the pipeline
   mozilla::RefPtr<mozilla::MediaPipelineTransmit> pipeline =
     new mozilla::MediaPipelineTransmit(
@@ -2398,97 +2098,35 @@ static int vcmTxStartICE_m(cc_mcapid_t m
     // This will also clear the filter.
     pc.impl()->media()->SetUsingBundle_m(level, false);
   }
 
   CSFLogDebug( logTag, "%s success", __FUNCTION__);
   return 0;
 }
 
-/**
- *  start tx stream
- *  Same concept as vcmTxStart but for ICE/PeerConnection-based flows
- *
- *  This is a thunk to vcmTxStartICE_m
- *
- *  @param[in]   mcap_id      - media cap id
- *  @param[in]   group_id     - group identifier to which the stream belongs
- *  @param[in]   stream_id    - stream id of the given media type.
- *  @param[in]   level        - the m-line index
- *  @param[in]   pc_stream_id - the media stream index (from PC.addStream())
- *  @param[i]n   pc_track_id  - the track within the media stream
- *  @param[in]   call_handle  - call handle
- *  @param[in]  peerconnection - the peerconnection in use
- *  @param[in]   payload      - payload type
- *  @param[in]   tos          - bit marking
- *  @param[in]   setup_type   - whether playing client or server role.
- *  @param[in]   fingerprint_alg - the DTLS fingerprint algorithm
- *  @param[in]   fingerprint  - the DTLS fingerprint
- *  @param[in]   attrs        - media attributes
- *
- *  Returns: zero(0) for success; otherwise, ERROR for failure
- *
- */
 #define EXTRACT_DYNAMIC_PAYLOAD_TYPE(PTYPE) ((PTYPE)>>16)
 
-int vcmTxStartICE(cc_mcapid_t mcap_id,
-                  cc_groupid_t group_id,
-                  cc_streamid_t stream_id,
-                  int level,
-                  int pc_stream_id,
-                  int pc_track_id,
-                  cc_call_handle_t  call_handle,
-                  const char *peerconnection,
-                  const vcm_payload_info_t *payload,
-                  short tos,
-                  sdp_setup_type_e setup_type,
-                  const char *fingerprint_alg,
-                  const char *fingerprint,
-                  vcm_mediaAttrs_t *attrs)
-{
-  int ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmTxStartICE_m,
-                        mcap_id,
-                        group_id,
-                        stream_id,
-                        level,
-                        pc_stream_id,
-                        pc_track_id,
-                        call_handle,
-                        peerconnection,
-                        payload,
-                        tos,
-                        setup_type,
-                        fingerprint_alg,
-                        fingerprint,
-                        attrs,
-                        &ret));
-
-  return ret;
-}
-
-
 /**
  *  Close the transmit stream
  *
  *  @param[in] mcap_id - Media Capability ID
  *  @param[in] group_id - identifier of the group to which stream belongs
  *  @param[in] stream_id - stream id of the given media type.
  *  @param[in] call_handle  - call identifier
  *
  *  @return 0 for success; VCM_ERROR for failure
  */
 
 short vcmTxClose(cc_mcapid_t mcap_id,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        cc_call_handle_t  call_handle)
+                 cc_groupid_t group_id,
+                 cc_streamid_t stream_id,
+                 cc_call_handle_t  call_handle)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     const char fname[] = "vcmTxClose";
 
     CSFLogDebug( logTag, "%s: group_id=%d call_handle=%d", fname, group_id, call_handle);
 
     if (call_handle == CC_NO_CALL_ID) {
         /* no operation when no call ID */
         return VCM_ERROR;
     }
@@ -2555,16 +2193,17 @@ int vcmGetAudioCodecList(int request_typ
     if ( retVal & AudioCodecMask_LINEAR ) {  codecMask |= cip_sipcc_CodecMask_DSP_RESOURCE_LINEAR; CSFLogDebug( logTag, "%s", " LINEAR" ); }
     if ( retVal & AudioCodecMask_G722 ) {    codecMask |= cip_sipcc_CodecMask_DSP_RESOURCE_G722; CSFLogDebug( logTag, "%s", " G722"); }
     if ( retVal & AudioCodecMask_iLBC )  {   codecMask |= cip_sipcc_CodecMask_DSP_RESOURCE_iLBC; CSFLogDebug( logTag, "%s", " iLBC"); }
     if ( retVal & AudioCodecMask_iSAC )   {  codecMask |= cip_sipcc_CodecMask_DSP_RESOURCE_iSAC; CSFLogDebug( logTag, "%s", " iSAC "); }
 
     CSFLogDebug( logTag, "%s(codec_mask = %X)", fname, codecMask);
     return codecMask;
 #else
+  ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
   int codecMask = VcmSIPCCBinding::getAudioCodecs();
   CSFLogDebug(logTag, "GetAudioCodecList returning %X", codecMask);
 
   return codecMask;
 #endif
 }
 
 /**
@@ -2673,16 +2312,17 @@ uint32_t vcmGetVideoH264ProfileLevelID()
  *        Only FAST_PICTURE_UPDATE is supported
  *
  *  @return  void
  *
  */
 
 void vcmMediaControl(cc_call_handle_t  call_handle, vcm_media_control_to_encoder_t to_encoder)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     if ( to_encoder == VCM_MEDIA_CONTROL_PICTURE_FAST_UPDATE )
     {
         StreamObserver* obs = VcmSIPCCBinding::getStreamObserver();
         if (obs != nullptr)
         {
                 obs->sendIFrame(call_handle);
         }
     }
@@ -2696,22 +2336,23 @@ void vcmMediaControl(cc_call_handle_t  c
  * @param[in]  stream_id - stram id of the stream
  * @param[in]  call_handle - call identifier
  * @param[out] rx_stats - ptr to the rx field in the stats struct
  * @param[out] tx_stats - ptr to the tx field in the stats struct
  *
  */
 
 int vcmGetRtpStats(cc_mcapid_t mcap_id,
-        cc_groupid_t group_id,
-        cc_streamid_t stream_id,
-        cc_call_handle_t  call_handle,
-        char *rx_stats,
-        char *tx_stats)
+                   cc_groupid_t group_id,
+                   cc_streamid_t stream_id,
+                   cc_call_handle_t  call_handle,
+                   char *rx_stats,
+                   char *tx_stats)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     rx_stats[0] = '\0';
     tx_stats[0] = '\0';
     return 0;
 }
 
 /**
  *  specifies DSCP marking for RTCP streams
  *
@@ -2800,16 +2441,17 @@ void vcmFreeMediaPtr(void *ptr)
  * @param [out] rcapptr - variable to return the allocated attrib structure
  *
  * @return cc_boolean - true if attributes are accepted false otherwise
  */
 
 cc_boolean vcmCheckAttribs(cc_uint32_t media_type, void *sdp_p, int level,
                            int remote_pt, void **rcapptr)
 {
+    ASSERT_ON_THREAD(VcmSIPCCBinding::getMainThread());
     CSFLogDebug( logTag, "vcmCheckAttribs(): media=%d", media_type);
 
     cc_uint16_t     temp;
     const char      *ptr;
     uint32_t        t_uint;
     struct VideoCodecConfigH264 *rcap;
 
     *rcapptr = nullptr;
@@ -3065,61 +2707,35 @@ vcmCreateTransportFlow(sipcc::PeerConnec
  * vcmOnSdpParseError_m
  *
  * This method is called for each parsing error of SDP.  It does not necessarily
  * mean the SDP read was fatal and can be called many times for the same SDP.
  *
  * This function should only be called on the main thread.
  *
  */
-static void vcmOnSdpParseError_m(nsAutoPtr<std::string> peerconnection,
-                                 nsAutoPtr<std::string> message) {
-
-  sipcc::PeerConnectionWrapper pc(peerconnection->c_str());
-  ENSURE_PC_NO_RET(pc, peerconnection->c_str());
-
-  pc.impl()->OnSdpParseError(message->c_str());
-}
-
-
-/**
- * vcmOnSdpParseError
- *
- * Dispatch the static version of this function on the main thread.
- * The string parameters are autoptr in order to survive the DISPATCH_NORMAL
- *
- */
 int vcmOnSdpParseError(const char *peerconnection, const char *message) {
   MOZ_ASSERT(peerconnection);
   MOZ_ASSERT(message);
-  nsAutoPtr<std::string> peerconnectionDuped(new std::string(peerconnection));
-  nsAutoPtr<std::string> messageDuped(new std::string(message));
-
-  // Now DISPATCH_NORMAL with the duped strings
-  nsresult rv = VcmSIPCCBinding::getMainThread()->Dispatch(
-      WrapRunnableNM(&vcmOnSdpParseError_m,
-                   peerconnectionDuped,
-                   messageDuped),
-      NS_DISPATCH_NORMAL);
-
-  if (!NS_SUCCEEDED(rv)) {
-    CSFLogError( logTag, "%s(): Could not dispatch to main thread", __FUNCTION__);
-    return VCM_ERROR;
-  }
-
+
+  sipcc::PeerConnectionWrapper pc(peerconnection);
+  ENSURE_PC(pc, VCM_ERROR);
+
+  pc.impl()->OnSdpParseError(message);
   return 0;
 }
 
+
 /**
  * vcmDisableRtcpComponent_m
  *
  * If we are doing rtcp-mux we need to disable component number 2 in the ICE
  * layer.  Otherwise we will wait for it to connect when it is unused
  */
-static int vcmDisableRtcpComponent_m(const char *peerconnection, int level) {
+int vcmDisableRtcpComponent(const char *peerconnection, int level) {
 #ifdef MOZILLA_INTERNAL_API
   MOZ_ASSERT(NS_IsMainThread());
 #endif
   MOZ_ASSERT(level > 0);
 
   sipcc::PeerConnectionWrapper pc(peerconnection);
   ENSURE_PC(pc, VCM_ERROR);
 
@@ -3136,104 +2752,61 @@ static int vcmDisableRtcpComponent_m(con
   MOZ_ASSERT(NS_SUCCEEDED(res));
   if (!NS_SUCCEEDED(res)) {
     return VCM_ERROR;
   }
 
   return 0;
 }
 
-/**
- * vcmDisableRtcpComponent
- *
- * If we are doing rtcp-mux we need to disable component number 2 in the ICE
- * layer.  Otherwise we will wait for it to connect when it is unused
- */
-int vcmDisableRtcpComponent(const char *peerconnection, int level) {
-  int ret;
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmDisableRtcpComponent_m,
-                        peerconnection,
-                        level,
-                        &ret));
-  return ret;
-}
-
-static short vcmGetVideoPref_m(uint16_t codec,
-                               const char *pref,
-                               int32_t *ret) {
+static short vcmGetVideoPref(uint16_t codec,
+                             const char *pref,
+                             int32_t *ret) {
   nsCOMPtr<nsIPrefBranch> branch = VcmSIPCCBinding::getPrefBranch();
   if (branch && NS_SUCCEEDED(branch->GetIntPref(pref, ret))) {
     return 0;
   }
   return VCM_ERROR;
 }
 
 short vcmGetVideoMaxFs(uint16_t codec,
                        int32_t *max_fs) {
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmGetVideoPref_m,
-                        codec,
-                        "media.navigator.video.max_fs",
-                        max_fs,
-                        &ret));
-  return ret;
+  return vcmGetVideoPref(codec,
+                         "media.navigator.video.max_fs",
+                         max_fs);
 }
 
 short vcmGetVideoMaxFr(uint16_t codec,
                        int32_t *max_fr) {
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmGetVideoPref_m,
-                        codec,
-                        "media.navigator.video.max_fr",
-                        max_fr,
-                        &ret));
-  return ret;
+  return vcmGetVideoPref(codec,
+                         "media.navigator.video.max_fr",
+                         max_fr);
 }
 
 short vcmGetVideoMaxBr(uint16_t codec,
                        int32_t *max_br) {
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmGetVideoPref_m,
-                        codec,
-                        "media.navigator.video.h264.max_br",
-                        max_br,
-                        &ret));
-  return ret;
+  return vcmGetVideoPref(codec,
+                         "media.navigator.video.h264.max_br",
+                         max_br);
 }
 
 short vcmGetVideoMaxMbps(uint16_t codec,
-                       int32_t *max_mbps) {
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmGetVideoPref_m,
-                        codec,
-                        "media.navigator.video.h264.max_mbps",
-                        max_mbps,
-                        &ret));
+                         int32_t *max_mbps) {
+  short ret = vcmGetVideoPref(codec,
+                              "media.navigator.video.h264.max_mbps",
+                              max_mbps);
+
   if (ret == VCM_ERROR) {
 #ifdef MOZ_WEBRTC_OMX
     // Level 1.2; but let's allow CIF@30 or QVGA@30+ by default
     *max_mbps = 11880;
     ret = 0;
 #endif
   }
   return ret;
 }
 
 short vcmGetVideoPreferredCodec(int32_t *preferred_codec) {
-  short ret;
-
-  mozilla::SyncRunnable::DispatchToThread(VcmSIPCCBinding::getMainThread(),
-      WrapRunnableNMRet(&vcmGetVideoPref_m,
-                        (uint16_t)0,
-                        "media.navigator.video.preferred_codec",
-                        preferred_codec,
-                        &ret));
-  return ret;
+  return vcmGetVideoPref((uint16_t)0,
+                         "media.navigator.video.preferred_codec",
+                         preferred_codec);
 }
+
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp
@@ -13,17 +13,16 @@
 #include "CC_SIPCCCallInfo.h"
 #include "ccapi_device_info.h"
 #include "CC_SIPCCDeviceInfo.h"
 #include "vcm.h"
 #include "VcmSIPCCBinding.h"
 #include "PeerConnectionImpl.h"
 #include "PeerConnectionCtx.h"
 #include "runnable_utils.h"
-#include "cpr_socket.h"
 #include "debug-psipcc-types.h"
 #include "prcvar.h"
 
 #include "mozilla/Telemetry.h"
 
 #ifdef MOZILLA_INTERNAL_API
 #include "mozilla/dom/RTCPeerConnectionBinding.h"
 #include "mozilla/Preferences.h"
@@ -31,28 +30,19 @@
 #endif
 
 #include "nsNetCID.h" // NS_SOCKETTRANSPORTSERVICE_CONTRACTID
 #include "nsServiceManagerUtils.h" // do_GetService
 #include "nsIObserverService.h"
 #include "nsIObserver.h"
 #include "mozilla/Services.h"
 #include "StaticPtr.h"
-extern "C" {
-#include "../sipcc/core/common/thread_monitor.h"
-}
 
 static const char* logTag = "PeerConnectionCtx";
 
-extern "C" {
-extern PRCondVar *ccAppReadyToStartCond;
-extern PRLock *ccAppReadyToStartLock;
-extern char ccAppReadyToStart;
-}
-
 namespace mozilla {
 
 using namespace dom;
 
 // Convert constraints to C structures
 
 #ifdef MOZILLA_INTERNAL_API
 static void
@@ -164,39 +154,21 @@ NS_IMPL_ISUPPORTS(PeerConnectionCtxShutd
 
 using namespace mozilla;
 namespace sipcc {
 
 PeerConnectionCtx* PeerConnectionCtx::gInstance;
 nsIThread* PeerConnectionCtx::gMainThread;
 StaticRefPtr<PeerConnectionCtxShutdown> PeerConnectionCtx::gPeerConnectionCtxShutdown;
 
-// Since we have a pointer to main-thread, help make it safe for lower-level
-// SIPCC threads to use SyncRunnable without deadlocking, by exposing main's
-// dispatcher and waiter functions. See sipcc/core/common/thread_monitor.c.
-
-static void thread_ended_dispatcher(thread_ended_funct func, thread_monitor_id_t id)
-{
-  nsresult rv = PeerConnectionCtx::gMainThread->Dispatch(WrapRunnableNM(func, id),
-                                                         NS_DISPATCH_NORMAL);
-  if (NS_FAILED(rv)) {
-    CSFLogError( logTag, "%s(): Could not dispatch to main thread", __FUNCTION__);
-  }
-}
-
-static void join_waiter() {
-  NS_ProcessPendingEvents(PeerConnectionCtx::gMainThread);
-}
-
 nsresult PeerConnectionCtx::InitializeGlobal(nsIThread *mainThread,
   nsIEventTarget* stsThread) {
   if (!gMainThread) {
     gMainThread = mainThread;
     CSF::VcmSIPCCBinding::setMainThread(gMainThread);
-    init_thread_monitor(&thread_ended_dispatcher, &join_waiter);
   } else {
     MOZ_ASSERT(gMainThread == mainThread);
   }
 
   nsresult res;
 
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -420,41 +392,24 @@ nsresult PeerConnectionCtx::Initialize()
 #else
   // Outside MOZILLA_INTERNAL_API ensures H.264 available in unit tests
   codecMask |= VCM_CODEC_RESOURCE_H264;
 #endif
 
   codecMask |= VCM_CODEC_RESOURCE_VP8;
   //codecMask |= VCM_CODEC_RESOURCE_I420;
   mCCM->setVideoCodecs(codecMask);
-
-  ccAppReadyToStartLock = PR_NewLock();
-  if (!ccAppReadyToStartLock) {
-    return NS_ERROR_FAILURE;
-  }
-
-  ccAppReadyToStartCond = PR_NewCondVar(ccAppReadyToStartLock);
-  if (!ccAppReadyToStartCond) {
-    return NS_ERROR_FAILURE;
-  }
+  mCCM->addCCObserver(this);
+  ChangeSipccState(dom::PCImplSipccState::Starting);
 
   if (!mCCM->startSDPMode())
     return NS_ERROR_FAILURE;
 
   mDevice = mCCM->getActiveDevice();
-  mCCM->addCCObserver(this);
   NS_ENSURE_TRUE(mDevice.get(), NS_ERROR_FAILURE);
-  ChangeSipccState(dom::PCImplSipccState::Starting);
-
-  // Now that everything is set up, we let the CCApp thread
-  // know that it's okay to start processing messages.
-  PR_Lock(ccAppReadyToStartLock);
-  ccAppReadyToStart = 1;
-  PR_NotifyAllCondVar(ccAppReadyToStartCond);
-  PR_Unlock(ccAppReadyToStartLock);
 
 #ifdef MOZILLA_INTERNAL_API
   mConnectionCounter = 0;
   Telemetry::GetHistogramById(Telemetry::WEBRTC_CALL_COUNT)->Add(0);
 
   mTelemetryTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
   MOZ_ASSERT(mTelemetryTimer);
   nsresult rv = mTelemetryTimer->SetTarget(gMainThread);
@@ -565,45 +520,20 @@ void PeerConnectionCtx::onDeviceEvent(cc
       }
       break;
     default:
       CSFLogDebug(logTag, "%s: Ignoring event: %s\n",__FUNCTION__,
                   device_event_getname(aDeviceEvent));
   }
 }
 
-static void onCallEvent_m(nsAutoPtr<std::string> peerconnection,
-                          ccapi_call_event_e aCallEvent,
-                          CSF::CC_CallInfoPtr aInfo);
-
 void PeerConnectionCtx::onCallEvent(ccapi_call_event_e aCallEvent,
                                     CSF::CC_CallPtr aCall,
                                     CSF::CC_CallInfoPtr aInfo) {
-  // This is called on a SIPCC thread.
-  //
-  // We cannot use SyncRunnable to main thread, as that would deadlock on
-  // shutdown. Instead, we dispatch asynchronously. We copy getPeerConnection(),
-  // a "weak ref" to the PC, which is safe in shutdown, and CC_CallInfoPtr (an
-  // nsRefPtr) is thread-safe and keeps aInfo alive.
-  nsAutoPtr<std::string> pcDuped(new std::string(aCall->getPeerConnection()));
-
-  // DISPATCH_NORMAL with duped string
-  nsresult rv = gMainThread->Dispatch(WrapRunnableNM(&onCallEvent_m, pcDuped,
-                                                     aCallEvent, aInfo),
-                                      NS_DISPATCH_NORMAL);
-  if (NS_FAILED(rv)) {
-    CSFLogError( logTag, "%s(): Could not dispatch to main thread", __FUNCTION__);
-  }
-}
-
-// Demux the call event to the right PeerConnection
-static void onCallEvent_m(nsAutoPtr<std::string> peerconnection,
-                          ccapi_call_event_e aCallEvent,
-                          CSF::CC_CallInfoPtr aInfo) {
   CSFLogDebug(logTag, "onCallEvent()");
-  PeerConnectionWrapper pc(peerconnection->c_str());
+  PeerConnectionWrapper pc(aCall->getPeerConnection());
   if (!pc.impl())  // This must be an event on a dead PC. Ignore
     return;
   CSFLogDebug(logTag, "Calling PC");
   pc.impl()->onCallEvent(OnCallEventArgs(aCallEvent, aInfo));
 }
 
 }  // namespace sipcc
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -1780,18 +1780,16 @@ PeerConnectionImpl::CheckApiState(bool a
 NS_IMETHODIMP
 PeerConnectionImpl::Close()
 {
   CSFLogDebug(logTag, "%s: for %s", __FUNCTION__, mHandle.c_str());
   PC_AUTO_ENTER_API_CALL_NO_CHECK();
 
   nsresult res = CloseInt();
 
-  SetSignalingState_m(PCImplSignalingState::SignalingClosed);
-
   return res;
 }
 
 bool
 PeerConnectionImpl::PluginCrash(uint64_t aPluginID,
                                 const nsAString& aPluginName,
                                 const nsAString& aPluginDumpID)
 {
@@ -1863,28 +1861,33 @@ PeerConnectionImpl::PluginCrash(uint64_t
   return true;
 }
 
 nsresult
 PeerConnectionImpl::CloseInt()
 {
   PC_AUTO_ENTER_API_CALL_NO_CHECK();
 
+  if (IsClosed()) {
+    return NS_OK;
+  }
+
+  SetSignalingState_m(PCImplSignalingState::SignalingClosed);
+
   // We do this at the end of the call because we want to make sure we've waited
   // for all trickle ICE candidates to come in; this can happen well after we've
   // transitioned to connected. As a bonus, this allows us to detect race
   // conditions where a stats dispatch happens right as the PC closes.
-  if (!IsClosed()) {
-    RecordLongtermICEStatistics();
-  }
+  RecordLongtermICEStatistics();
 
   if (mInternal->mCall) {
     CSFLogInfo(logTag, "%s: Closing PeerConnectionImpl %s; "
                "ending call", __FUNCTION__, mHandle.c_str());
     mInternal->mCall->endCall();
+    mInternal->mCall = nullptr;
   }
 #ifdef MOZILLA_INTERNAL_API
   if (mDataConnection) {
     CSFLogInfo(logTag, "%s: Destroying DataChannelConnection %p for %s",
                __FUNCTION__, (void *) mDataConnection.get(), mHandle.c_str());
     mDataConnection->Destroy();
     mDataConnection = nullptr; // it may not go away until the runnables are dead
   }
@@ -2174,17 +2177,17 @@ SendEndOfCandidatesImpl(nsWeakPtr weakPC
 
   JSErrorResult rv;
   pco->OnIceCandidate(0, ObString(""), ObString(""), rv);
 }
 
 void
 PeerConnectionImpl::SendEndOfCandidates() {
   // We dispatch this because real candidates do a dispatch in
-  // PeerConnection::onCallEvent, and we don't want this to jump ahead.
+  // PeerConnectionImpl::onCallEvent, and we don't want this to jump ahead.
   NS_DispatchToMainThread(
       WrapRunnableNM(&SendEndOfCandidatesImpl, mPCObserver),
       NS_DISPATCH_NORMAL);
 }
 
 #ifdef MOZILLA_INTERNAL_API
 static bool isDone(PCImplIceConnectionState state) {
   return state != PCImplIceConnectionState::Checking &&
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/CCProvider.h
@@ -136,17 +136,18 @@ typedef enum {
 #define CCAPP_SEND_INFO      14
 #define CCAPP_RCVD_INFO      15
 #define CCAPP_LOGOUT_RESET   16
 #define CCAPP_THREAD_UNLOAD  17
 #define CCAPP_SESSION_MGMT   18
 
 extern cpr_status_e ccappTaskPostMsg(unsigned int msgId, void * data, uint16_t len, int appId);
 extern void ccappSyncSessionMgmt(session_mgmt_t *sessMgmt);
-extern void CCApp_task(void * arg);
+extern void CCApp_prepare_task();
+extern void GSM_prepare_task();
 extern void *findhash(unsigned int key);
 extern session_id_t createSessionId(line_t line, callid_t call);
 extern void getLineIdAndCallId (line_t *line_id, callid_t *call_id);
 extern void ccp_handler(void* msg, int type);
 extern session_data_t * getDeepCopyOfSessionData(session_data_t *data);
 extern void cleanSessionData(session_data_t *data);
 extern cc_call_handle_t ccappGetConnectedCall();
 
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccapp_task.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccapp_task.c
@@ -117,80 +117,33 @@ cpr_status_e ccappTaskPostMsg(unsigned i
  *
  * @return  CPR_SUCCESS/CPR_FAILURE
  *
  * @pre     msg is a malloc mem ptr
  */
 cpr_status_e
 ccappTaskSendMsg (uint32_t cmd, void *msg, uint16_t len, uint32_t UsrInfo)
 {
-    phn_syshdr_t *syshdr;
+    appListener *listener = NULL;
+
+    CCAPP_DEBUG(DEB_F_PREFIX"Received Cmd[%d] for app[%d]", DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__),
+        cmd, UsrInfo);
 
-    syshdr = (phn_syshdr_t *) cprGetSysHeader(msg);
-    if (!syshdr) {
-        return CPR_FAILURE;
+    listener = getCcappListener(UsrInfo);
+    if (listener != NULL) {
+      (* ((appListener)(listener)))(msg, cmd);
+    } else {
+      CCAPP_DEBUG(DEB_F_PREFIX"Event[%d] doesn't have a dedicated listener.", DEB_F_PREFIX_ARGS(SIP_CC_PROV, __FUNCTION__),
+          UsrInfo);
     }
-    syshdr->Cmd = cmd;
-    syshdr->Len = len;
-    syshdr->Usr.UsrInfo = UsrInfo;
+    cpr_free(msg);
 
-    if (cprSendMessage(ccapp_msgq , (cprBuffer_t*)msg, (void **)&syshdr) == CPR_FAILURE) {
-        cprReleaseSysHeader(syshdr);
-        return CPR_FAILURE;
-    }
     return CPR_SUCCESS;
 }
 
-/**
- *
- * CCApp Provider main routine.
- *
- * @param   arg - CCApp msg queue
- *
- * @return  void
- *
- * @pre     None
- */
-void CCApp_task(void * arg)
+void CCApp_prepare_task()
 {
-    static const char fname[] = "CCApp_task";
-    phn_syshdr_t   *syshdr = NULL;
-    appListener *listener = NULL;
-    void * msg;
-
     //initialize the listener list
     sll_lite_init(&sll_list);
 
     CCAppInit();
-
-    // If the "ready to start" condition variable has been created
-    // (is non-null), we're going to wait for it to be signaled
-    // before we start processing messages.
-    if (ccAppReadyToStartCond) {
-      PR_Lock(ccAppReadyToStartLock);
-      while (!ccAppReadyToStart) {
-        PR_WaitCondVar(ccAppReadyToStartCond, PR_INTERVAL_NO_TIMEOUT);
-      }
-      PR_Unlock(ccAppReadyToStartLock);
-    }
-
-
-    while (1) {
-        msg = cprGetMessage(ccapp_msgq, TRUE, (void **) &syshdr);
-        if ( msg) {
-            CCAPP_DEBUG(DEB_F_PREFIX"Received Cmd[%d] for app[%d]", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
-                    syshdr->Cmd, syshdr->Usr.UsrInfo);
-
-            listener = getCcappListener(syshdr->Usr.UsrInfo);
-            if (listener != NULL) {
-                (* ((appListener)(listener)))(msg, syshdr->Cmd);
-            } else {
-                CCAPP_DEBUG(DEB_F_PREFIX"Event[%d] doesn't have a dedicated listener.", DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),
-                        syshdr->Usr.UsrInfo);
-            }
-            cprReleaseSysHeader(syshdr);
-            cpr_free(msg);
-        }
-    }
 }
 
-
-
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
@@ -48,17 +48,16 @@
 #include "call_logger.h"
 #include "subscription_handler.h"
 #include "ccapi_device_info.h"
 #include "conf_roster.h"
 #include "reset_api.h"
 #include "prlog.h"
 #include "prlock.h"
 #include "prcvar.h"
-#include "thread_monitor.h"
 
 /*---------------------------------------------------------
  *
  * Definitions
  *
  */
 #define NOTIFY_CALL_STATUS (data->state == OFFHOOK? "OFFHOOK" : \
         data->state == ONHOOK? "ONHOOK" : \
@@ -171,17 +170,17 @@ extern void set_default_video_pref(int p
 extern void set_next_sess_video_pref(int pref);
 extern void cc_media_update_native_video_support(boolean val);
 extern void cc_media_update_video_cap(boolean val);
 extern void cc_media_update_video_txcap(boolean val);
 
 session_data_t * getDeepCopyOfSessionData(session_data_t *data);
 static void ccappUpdateSessionData(session_update_t *sessUpd);
 static void ccappFeatureUpdated (feature_update_t *featUpd);
-void destroy_ccapp_thread();
+void ccapp_shutdown();
 void ccpro_handleserviceControlNotify();
 /* Sets up mutex needed for protecting state variables. */
 static cc_int32_t InitInternal();
 static void ccapp_set_state(cc_reg_state_t state);
 
 /* Handy macro for executing memory barrier on CCApp State updates. */
 #define ENTER_CCAPPSTATE_PROTECT \
   PR_Lock(gAppStateLock); \
@@ -2142,40 +2141,38 @@ void ccp_handler(void* msg, int type) {
     case CCAPP_SHUTDOWN_ACK:
     case CCAPP_FALLBACK_IND:
     case CCAPP_REG_ALL_FAIL:
         featUpd = (feature_update_t *) msg;
         ccappHandleRegStateUpdates(featUpd);
         break;
 
     case CCAPP_THREAD_UNLOAD:
-        thread_ended(THREADMON_CCAPP);
-        destroy_ccapp_thread();
+        ccapp_shutdown();
         break;
     default:
         APP_ERR_MSG("CCApp_Task: Error: Unknown message %d msg =%p",
           type, msg);
         break;
     }
 }
 
 /*
- *  Function: destroy_ccapp_thread
- *  Description:  shutdown and kill ccapp thread
+ *  Function: ccapp_shutdown
+ *  Description:  shutdown ccapp
  *  Parameters:   none
  *  Returns: none
  */
-void destroy_ccapp_thread()
+void ccapp_shutdown()
 {
-    static const char fname[] = "destroy_ccapp_thread";
-    TNP_DEBUG(DEB_F_PREFIX"Unloading ccapp and destroying ccapp thread",
+    static const char fname[] = "ccapp_shutdown";
+    TNP_DEBUG(DEB_F_PREFIX"Unloading ccapp",
         DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
     platform_initialized = FALSE;
     CCAppShutdown();
-    (void)cprDestroyThread(ccapp_thread);
 }
 
 /**
  * CCAPP wrapper to update device features.
  * @param featUpd - feature_update_t
  * @return void
  */
 static
--- a/media/webrtc/signaling/src/sipcc/core/common/init.c
+++ b/media/webrtc/signaling/src/sipcc/core/common/init.c
@@ -16,17 +16,17 @@
 #include "debug.h"
 #include "phone_debug.h"
 #include "CCProvider.h"
 #include "ccsip_task.h"
 #include "gsm.h"
 #include "misc_apps_task.h"
 #include "plat_api.h"
 #include "ccapp_task.h"
-#include "thread_monitor.h"
+#include "uiapi.h"
 #include "mozilla/Assertions.h"
 
 #include "phone_platform_constants.h"
 /** The following defines are used to tune the total memory that pSIPCC
  * allocates and uses. */
 /** Block size for emulated heap space, i.e. 1kB */
 #define BLK_SZ  1024
 
@@ -89,39 +89,39 @@ boolean gStopTickTask = FALSE;
 #define  DEFQSZ         0            /* default message queue size       */
 #define  DEFAPPQSZ     MAX_REG_LINES
 
 /*--------------------------------------------------------------------------
  * Global data
  *--------------------------------------------------------------------------
  */
 
-cprMsgQueue_t ccapp_msgq;
-cprThread_t ccapp_thread;
+cprMsgQueue_t ccapp_msgq = NULL;
+cprThread_t ccapp_thread = NULL;
 
-cprMsgQueue_t sip_msgq;
-cprThread_t sip_thread;
+cprMsgQueue_t sip_msgq = NULL;
+cprThread_t sip_thread = NULL;
 #ifdef NO_SOCKET_POLLING
-cprThread_t sip_msgqwait_thread;
+cprThread_t sip_msgqwait_thread = NULL;
 #endif
 
-cprMsgQueue_t gsm_msgq;
-cprThread_t gsm_thread;
+cprMsgQueue_t gsm_msgq = NULL;
+cprThread_t gsm_thread = NULL;
 
-cprMsgQueue_t misc_app_msgq;
-cprThread_t misc_app_thread;
+cprMsgQueue_t misc_app_msgq = NULL;
+cprThread_t misc_app_thread = NULL;
 
 #ifdef JINDO_DEBUG_SUPPORTED
-cprMsgQueue_t debug_msgq;
-cprThread_t debug_thread;
+cprMsgQueue_t debug_msgq = NULL;
+cprThread_t debug_thread = NULL;
 #endif
 
 #ifdef EXTERNAL_TICK_REQUIRED
-cprMsgQueue_t ticker_msgq;
-cprThread_t ticker_thread;
+cprMsgQueue_t ticker_msgq = NULL;
+cprThread_t ticker_thread = NULL;
 #endif
 
 /* Platform initialized flag */
 boolean platform_initialized = FALSE;
 
 static int thread_init(void);
 
 /*--------------------------------------------------------------------------
@@ -210,23 +210,16 @@ ccInit ()
 {
 
     TNP_DEBUG(DEB_F_PREFIX"started init of SIP call control", DEB_F_PREFIX_ARGS(SIP_CC_INIT, "ccInit"));
 
     platInit();
 
     strlib_init();
 
-    /*
-     * below should move to cprPreInit. keep it here until then
-     */
-#if defined(_WIN32) && defined(CPR_TIMERS_ENABLED)
-    cprTimerSystemInit();
-#endif
-
     /* Initialize threads, queues etc. */
     (void) thread_init();
 
     platform_initialized = TRUE;
 
     return 0;
 }
 
@@ -238,146 +231,26 @@ thread_init ()
      * This will have already been called for CPR CNU code,
      * but may be called here for Windows emulation.
      */
     (void) cprPreInit();
 
 
     PHNChangeState(STATE_FILE_CFG);
 
-    /* initialize message queues */
-    sip_msgq = cprCreateMessageQueue("SIPQ", SIPQSZ);
-    gsm_msgq = cprCreateMessageQueue("GSMQ", GSMQSZ);
-
-    if (FALSE == gHardCodeSDPMode) {
-        misc_app_msgq = cprCreateMessageQueue("MISCAPPQ", DEFQSZ);
-    }
-    ccapp_msgq = cprCreateMessageQueue("CCAPPQ", DEFQSZ);
-#ifdef JINDO_DEBUG_SUPPORTED
-    debug_msgq = cprCreateMessageQueue("DEBUGAPPQ", DEFQSZ);
-#endif
-#ifdef EXTERNAL_TICK_REQUIRED
-    ticker_msgq = cprCreateMessageQueue("Ticker", DEFQSZ);
-#endif
-
-
     /*
      * Initialize the command parser and debug infrastructure
      */
     debugInit();
 
-    /* create threads */
-    ccapp_thread = cprCreateThread("CCAPP Task",
-                                 (cprThreadStartRoutine) CCApp_task,
-                                 GSMSTKSZ, CCPROVIDER_THREAD_RELATIVE_PRIORITY /* pri */, ccapp_msgq);
-    MOZ_ASSERT(ccapp_thread);
-    if (ccapp_thread) {
-        thread_started(THREADMON_CCAPP, ccapp_thread);
-    } else {
-        CSFLogError("common", "failed to create CCAPP task");
-    }
-
-#ifdef JINDO_DEBUG_SUPPORTED
-#ifndef VENDOR_BUILD
-    debug_thread = cprCreateThread("Debug Task",
-                                   (cprThreadStartRoutine) debug_task, STKSZ,
-                                   0 /*pri */ , debug_msgq);
-
-    if (debug_thread == NULL) {
-        CSFLogError("common", "failed to create debug task");
-    }
-#endif
-#endif
-
-    /* SIP main thread */
-    sip_thread = cprCreateThread("SIPStack task",
-                                 (cprThreadStartRoutine) sip_platform_task_loop,
-                                 STKSZ, SIP_THREAD_RELATIVE_PRIORITY /* pri */, sip_msgq);
-    MOZ_ASSERT(sip_thread);
-    if (sip_thread) {
-        thread_started(THREADMON_SIP, sip_thread);
-    } else {
-        CSFLogError("common", "failed to create sip task");
-    }
-
-#ifdef NO_SOCKET_POLLING
-    /* SIP message wait queue task */
-    sip_msgqwait_thread = cprCreateThread("SIP MsgQueueWait task",
-                                          (cprThreadStartRoutine)
-                                          sip_platform_task_msgqwait,
-                                          STKSZ, SIP_THREAD_RELATIVE_PRIORITY /* pri */, sip_msgq);
-    MOZ_ASSERT(sip_msgqwait_thread);
-    if (sip_msgqwait_thread) {
-        thread_started(THREADMON_MSGQ, sip_msgqwait_thread);
-    } else {
-        CSFLogError("common", "failed to create sip message queue wait task");
-    }
-#endif
+    CCApp_prepare_task();
+    GSM_prepare_task();
 
-    gsm_thread = cprCreateThread("GSM Task",
-                                 (cprThreadStartRoutine) GSMTask,
-                                 GSMSTKSZ, GSM_THREAD_RELATIVE_PRIORITY /* pri */, gsm_msgq);
-    MOZ_ASSERT(gsm_thread);
-    if (gsm_thread) {
-        thread_started(THREADMON_GSM, gsm_thread);
-    } else {
-        CSFLogError("common", "failed to create gsm task");
-    }
-
-    if (FALSE == gHardCodeSDPMode) {
-    	misc_app_thread = cprCreateThread("MiscApp Task",
-    			(cprThreadStartRoutine) MiscAppTask,
-    			STKSZ, 0 /* pri */, misc_app_msgq);
-    	if (misc_app_thread == NULL) {
-    		CSFLogError("common", "failed to create MiscApp task");
-    	}
-    }
-
-#ifdef EXTERNAL_TICK_REQUIRED
-    ticker_thread = cprCreateThread("Ticker task",
-                                    (cprThreadStartRoutine) TickerTask,
-                                    STKSZ, 0, ticker_msgq);
-    if (ticker_thread == NULL) {
-        CSFLogError("common", "failed to create ticker task");
-    }
-#endif
-
-    /* Associate the threads with the message queues */
-    (void) cprSetMessageQueueThread(sip_msgq, sip_thread);
-    (void) cprSetMessageQueueThread(gsm_msgq, gsm_thread);
-
-    if (FALSE == gHardCodeSDPMode) {
-    	(void) cprSetMessageQueueThread(misc_app_msgq, misc_app_thread);
-    }
-
-    (void) cprSetMessageQueueThread(ccapp_msgq, ccapp_thread);
-#ifdef JINDO_DEBUG_SUPPORTED
-    (void) cprSetMessageQueueThread(debug_msgq, debug_thread);
-#endif
-#ifdef EXTERNAL_TICK_REQUIRED
-    (void) cprSetMessageQueueThread(ticker_msgq, ticker_thread);
-#endif
-
-    /*
-     * initialize debugs of other modules.
-     *
-     * dp_init needs the gsm_msgq id. This
-     * is set in a global variable by the
-     * GSM task running. However due to timing
-     * issues dp_init is sometimes run before
-     * the GSM task has set this variable resulting
-     * in a NULL msgqueue ptr being passed to CPR
-     * which returns an error and does not create
-     * the dialplan timer. Thus pass is the same
-     * data to dp_init that is passed into the
-     * cprCreateThread call for GSM above.
-     */
     config_init();
     vcmInit();
-    dp_init(gsm_msgq);
 
     if (sip_minimum_config_check() != 0) {
         PHNChangeState(STATE_UNPROVISIONED);
     } else {
         PHNChangeState(STATE_CONNECTED);
     }
 
     (void) cprPostInit();
@@ -418,32 +291,19 @@ TickerTask (void *a)
     return 0;
 }
 #endif
 
 void
 send_protocol_config_msg (void)
 {
     const char *fname = "send_protocol_config_msg";
-    char *msg;
-
-    TNP_DEBUG(DEB_F_PREFIX"send TCP_DONE message to sip thread..", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
-
-    msg = (char *) SIPTaskGetBuffer(4);
-    if (msg == NULL) {
-        TNP_DEBUG(DEB_F_PREFIX"failed to allocate message..", DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
-        return;
-    }
-    /* send a config done message to the SIP Task */
-    if (SIPTaskSendMsg(TCP_PHN_CFG_TCP_DONE, msg, 0, NULL) == CPR_FAILURE) {
-        CSFLogError("common", "%s: notify SIP stack ready failed", fname);
-        cpr_free(msg);
-    }
     gsm_set_initialized();
     PHNChangeState(STATE_CONNECTED);
+    ui_set_sip_registration_state(CC_ALL_LINES, TRUE);
 }
 
 
 
 
 
 /*
  *  Function: send_task_unload_msg
@@ -456,27 +316,21 @@ send_protocol_config_msg (void)
  *  Returns: none
  *
  */
 void
 send_task_unload_msg(cc_srcs_t dest_id)
 {
     const char *fname = "send_task_unload_msg";
     uint16_t len = 4;
-    cprBuffer_t  msg =  gsm_get_buffer(len);
+    cprBuffer_t  msg;
     int  sdpmode = 0;
 
     config_get_value(CFGID_SDPMODE, &sdpmode, sizeof(sdpmode));
 
-    if (msg == NULL) {
-        CSFLogError("common", "%s: failed to allocate  msg cprBuffer_t",
-                    fname);
-        return;
-    }
-
     DEF_DEBUG(DEB_F_PREFIX"send Unload message to %s task ..",
         DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname),
         dest_id == CC_SRC_SIP ? "SIP" :
         dest_id == CC_SRC_GSM ? "GSM" :
         dest_id == CC_SRC_MISC_APP ? "Misc App" :
         dest_id == CC_SRC_CCAPP ? "CCApp" : "Unknown");
 
     switch(dest_id) {
@@ -594,15 +448,10 @@ ccUnload (void)
 
     if (!gHardCodeSDPMode) {
     	send_task_unload_msg(CC_SRC_MISC_APP);
     }
 
     send_task_unload_msg(CC_SRC_CCAPP);
 
     gStopTickTask = TRUE;
-
-    /*
-     * Here we are waiting until all threads that were started notify and exit.
-     */
-    join_all_threads();
 }
 
deleted file mode 100644
--- a/media/webrtc/signaling/src/sipcc/core/common/thread_monitor.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "cpr_types.h"
-#include "cpr_stdlib.h"
-#include "thread_monitor.h"
-#include "mozilla/Assertions.h"
-
-/*
- * If thread is running, should have a non-zero entry here that is the threadId
- */
-static cprThread_t thread_list[THREADMON_MAX];
-static boolean wait_list[THREADMON_MAX];
-
-/*
- * thread_started
- *
- * Should be called exactly once for each thread created.
- *
- * @param[in]  monitor_id     - enum of which thread created
- * @param[in]  thread         - created thread
- */
-void thread_started(thread_monitor_id_t monitor_id, cprThread_t thread) {
-  MOZ_ASSERT(monitor_id < THREADMON_MAX);
-  if (monitor_id >= THREADMON_MAX) {
-    return;
-  }
-
-  /* Should not already be started */
-  MOZ_ASSERT(thread_list[monitor_id] == NULL);
-
-  thread_list[monitor_id] = thread;
-  wait_list[monitor_id] = TRUE;
-}
-
-/*
- * thread_ended
- *
- * Must be called by thread itself on THREAD_UNLOAD to unblock join_all_threads()
- *
- * Alerts if init_thread_monitor() has not been called.
- *
- * @param[in]  monitor_id     - enum of which thread created
- */
-
-/*
- * init_thread_monitor
- *
- * Thread-monitor supports a way to let threads notify the joiner when it is
- * safe to join, IF it is initialized with a dispatcher and a waiter function.
- *
- * Example: To use SyncRunnable or otherwise block on the main thread without
- * deadlocking on shutdown, pass in the following:
- *
- * static void dispatcher(thread_ended_funct fun, thread_monitor_id_t id)
- * {
- *   nsresult rv = gMain->Dispatch(WrapRunnableNM(fun, id), NS_DISPATCH_NORMAL);
- *   MOZ_ASSERT(NS_SUCCEEDED(rv));
- * }
- *
- * static void waiter() { NS_ProcessPendingEvents(gMain); }
- *
- * The created thread must then call thread_ended() on receiving THREAD_UNLOAD.
- */
-
-static thread_ended_dispatcher_funct dispatcher = NULL;
-static join_wait_funct waiter = NULL;
-
-void init_thread_monitor(thread_ended_dispatcher_funct dispatch,
-                         join_wait_funct wait) {
-  dispatcher = dispatch;
-  waiter = wait;
-}
-
-static void thread_ended_m(thread_monitor_id_t monitor_id) {
-  MOZ_ASSERT(dispatcher);
-  MOZ_ASSERT(waiter);
-  MOZ_ASSERT(monitor_id < THREADMON_MAX);
-  if (monitor_id >= THREADMON_MAX) {
-    return;
-  }
-
-  /* Should already be started */
-  MOZ_ASSERT(thread_list[monitor_id]);
-  MOZ_ASSERT(wait_list[monitor_id]);
-
-  wait_list[monitor_id] = FALSE;
-}
-
-void thread_ended(thread_monitor_id_t monitor_id) {
-  MOZ_ASSERT(dispatcher);
-  dispatcher (&thread_ended_m, monitor_id);
-}
-
-/*
- * join_all_threads
- *
- * Join all threads that were started.
- */
-void join_all_threads() {
-  int i;
-  MOZ_ASSERT(dispatcher);
-  MOZ_ASSERT(waiter);
-
-  for (i = 0; i < THREADMON_MAX; i++) {
-    if (thread_list[i] != NULL) {
-      while (wait_list[i]) {
-        waiter();
-      }
-      cprJoinThread(thread_list[i]);
-      cpr_free(thread_list[i]);
-      thread_list[i] = NULL;
-    }
-  }
-}
deleted file mode 100644
--- a/media/webrtc/signaling/src/sipcc/core/common/thread_monitor.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef THREAD_MONITOR_H_
-#define THREAD_MONITOR_H_
-
-#include "cpr_threads.h"
-
-/*
- * This should be a list of threads that could be created by SIPCC
- * On Windows, the MSGQ thread is not started.
- */
-typedef enum {
-  THREADMON_CCAPP,
-  THREADMON_SIP,
-  THREADMON_MSGQ,
-  THREADMON_GSM,
-  THREADMON_MAX
-} thread_monitor_id_t;
-
-/*
- * thread_started
- *
- * Should be called exactly once for each thread created.
- *
- * @param[in]  monitor_id     - enum of which thread created
- * @param[in]  thread         - created thread
- */
-void thread_started(thread_monitor_id_t monitor_id, cprThread_t thread);
-
-/*
- * thread_ended
- *
- * Must be called by thread itself on THREAD_UNLOAD to unblock join_all_threads()
- *
- * Alerts if init_thread_monitor() has not been called.
- *
- * @param[in]  monitor_id     - enum of which thread created
- */
-void thread_ended(thread_monitor_id_t monitor_id);
-
-typedef void (*thread_ended_funct)(thread_monitor_id_t);
-typedef void (*thread_ended_dispatcher_funct)(thread_ended_funct func, thread_monitor_id_t);
-typedef void (*join_wait_funct)();
-
-/*
- * init_thread_monitor - see thread_monitor.c
- */
-void init_thread_monitor(thread_ended_dispatcher_funct dispatch, join_wait_funct wait);
-
-/*
- * join_all_threads
- *
- * Join all threads that were started.
- */
-void join_all_threads();
-
-#endif
-
--- a/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/fsmdef.c
@@ -1259,26 +1259,16 @@ fsmdef_init_dcb (fsmdef_dcb_t *dcb, call
     dcb->play_tone_action = FSMDEF_PLAYTONE_NO_ACTION;
 
     dcb->fcb = fcb;
 
     dcb->early_error_release = FALSE;
 
     dcb->active_feature = CC_FEATURE_NONE;
 
-    /* Release transient timers if any have been allocated */
-    if (dcb->err_onhook_tmr) {
-        (void) cprDestroyTimer(dcb->err_onhook_tmr);
-        dcb->err_onhook_tmr = NULL;
-    }
-    if (dcb->req_pending_tmr) {
-        (void) cprDestroyTimer(dcb->req_pending_tmr);
-        dcb->req_pending_tmr = NULL;
-    }
-
     FSM_SET_SECURITY_STATUS(dcb, CC_SECURITY_UNKNOWN);
     FSM_SET_POLICY(dcb, CC_POLICY_UNKNOWN);
     dcb->session = PRIMARY;
 
     dcb->dsp_out_of_resources = FALSE;
 
     if (dcb->selected) {
         g_numofselected_calls--;
@@ -1336,35 +1326,16 @@ fsmdef_free_dcb (fsmdef_dcb_t *dcb)
     strlib_free(dcb->caller_id.called_number);
 
     strlib_free(dcb->caller_id.last_redirect_name);
     strlib_free(dcb->caller_id.last_redirect_number);
     strlib_free(dcb->caller_id.orig_called_name);
     strlib_free(dcb->caller_id.orig_called_number);
     strlib_free(dcb->caller_id.orig_rpid_number);
 
-    /* Cancel any existing error onhook timer */
-    if (dcb->err_onhook_tmr) {
-        (void) cprCancelTimer(dcb->err_onhook_tmr);
-        (void) cprDestroyTimer(dcb->err_onhook_tmr);
-        dcb->err_onhook_tmr = NULL;
-    }
-
-    /* Cancel any existing request pending timer */
-    if (dcb->req_pending_tmr) {
-        (void) cprCancelTimer(dcb->req_pending_tmr);
-        (void) cprDestroyTimer(dcb->req_pending_tmr);
-        dcb->req_pending_tmr = NULL;
-    }
-
-    /* Cancel any existing ringback delay timer */
-    if (dcb->ringback_delay_tmr) {
-        (void) cprCancelTimer(dcb->ringback_delay_tmr);
-    }
-
     // Free the call instance id
     if (dcb->caller_id.call_instance_id != 0) {
         fsmutil_free_ci_id(dcb->caller_id.call_instance_id, dcb->line);
     }
 
     /* clean media list */
     gsmsdp_clean_media_list(dcb);
 
@@ -1980,19 +1951,16 @@ fsmdef_release (fsm_fcb_t *fcb, cc_cause
 
     FSM_DEBUG_SM(DEB_L_C_F_PREFIX"Entered. cause= %s",
 		DEB_L_C_F_PREFIX_ARGS(FSM, dcb->line, dcb->call_id, __FUNCTION__), cc_cause_name(cause));
 
     if (g_dock_undock_event != MEDIA_INTERFACE_UPDATE_NOT_REQUIRED) {
         ui_update_media_interface_change(dcb->line, dcb->call_id, MEDIA_INTERFACE_UPDATE_FAIL);
     }
     memset(&kfactor, 0, sizeof(cc_kfact_t));
-    /* Cancel any existing autoanswer timer */
-    (void) cprCancelTimer(dcb->autoAnswerTimer);
-
 
     /*
      * Let Dialog Manager know that there is ONHOOK event
      */
     fsmdef_notify_hook_event(fcb, CC_MSG_ONHOOK, NULL, CC_NO_CALL_ID,
                              CC_REASON_NONE, CC_MONITOR_NONE,CFWDALL_NONE);
 
     media = gsmsdp_find_audio_media(dcb);
@@ -2335,83 +2303,26 @@ fsmdef_update_callinfo (fsm_fcb_t *fcb, 
  *    N/A.
  */
 static void
 fsmdef_set_feature_timer (fsmdef_dcb_t *dcb, cprTimer_t *timer,
                           uint32_t duration)
 {
     static const char fname[] = "fsmdef_set_feature_timer";
 
-    if (cprCancelTimer(*timer) != CPR_SUCCESS) {
-        FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_CANCEL_FAILED),
-                     dcb->call_id, dcb->line, fname, "Feature", cpr_errno);
-
-        return;
-    }
-
-    if (cprStartTimer(*timer, duration, (void *)(long)dcb->call_id) == CPR_FAILURE) {
-        FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_START_FAILED),
-                     dcb->call_id, dcb->line, fname, "Feature", cpr_errno);
-    }
 }
 
 static void
 fsmdef_set_req_pending_timer (fsmdef_dcb_t *dcb)
 {
-    static const char fname[] = "fsmdef_set_req_pending_timer";
-    uint32_t msec;
-
-    if (dcb == NULL) {
-        FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_INVALID_DCB), fname);
-        return;
-    }
-
-    if (!dcb->req_pending_tmr) {
-        dcb->req_pending_tmr = cprCreateTimer("Request Pending",
-                                              GSM_REQ_PENDING_TIMER,
-                                              TIMER_EXPIRATION,
-                                              gsm_msgq);
-
-        if (dcb->req_pending_tmr == NULL) {
-            FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_CREATE_FAILED),
-                         dcb->call_id, dcb->line, fname, "Request Pending");
-
-            return;
-        }
-    }
-
-    if (dcb->inbound) {
-        // We did not initiate this call, so set timer between 0 and 2000ms
-        msec = abs(cpr_rand()) % 2000;
-    } else {
-        // We initiated this call, so set the timer between 2100 and 4000ms
-        msec = abs(cpr_rand()) % 1900 + 2100;
-    }
-
-    FSM_DEBUG_SM(DEB_L_C_F_PREFIX"Starting req pending timer for %d ms.",
-		DEB_L_C_F_PREFIX_ARGS(FSM, dcb->line, dcb->call_id, fname), msec);
-
-    fsmdef_set_feature_timer(dcb, &dcb->req_pending_tmr, msec);
 }
 
 static void
 fsmdef_set_ringback_delay_timer (fsmdef_dcb_t *dcb)
 {
-    static const char fname[] = "fsmdef_set_ringback_delay_timer";
-
-    if (dcb == NULL) {
-        FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_INVALID_DCB), fname);
-        return;
-    }
-
-    FSM_DEBUG_SM(DEB_L_C_F_PREFIX"Starting Ringback Delay timer"
-                 " for %d ms.\n",
-                 DEB_L_C_F_PREFIX_ARGS(FSM, dcb->line, dcb->call_id, fname), RINGBACK_DELAY);
-
-    fsmdef_set_feature_timer(dcb, &dcb->ringback_delay_tmr, RINGBACK_DELAY);
 }
 
 /*******************************************************************
  * event functions
  */
 static sm_rcs_t
 fsmdef_ev_default (sm_event_t *event)
 {
@@ -4719,40 +4630,16 @@ fsmdef_ev_collectinginfo_release (sm_eve
 {
     fsm_fcb_t          *fcb       = (fsm_fcb_t *) event->data;
     fsmdef_dcb_t       *dcb       = fcb->dcb;
 
     FSM_DEBUG_SM(DEB_F_PREFIX"Entered.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
 
    fsmdef_set_call_info_cc_call_state(dcb, CC_STATE_CALL_FAILED, CC_CAUSE_INVALID_NUMBER);
 
-    // Start onhook timer
-    if ( dcb->err_onhook_tmr) {
-        (void) cprDestroyTimer(dcb->err_onhook_tmr);
-    }
-    dcb->err_onhook_tmr = cprCreateTimer("Error Onhook",
-                                         GSM_ERROR_ONHOOK_TIMER,
-                                         TIMER_EXPIRATION,
-                                         gsm_msgq);
-    if (dcb->err_onhook_tmr == NULL) {
-        FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_CREATE_FAILED),
-                     dcb->call_id, dcb->line, "", "Error Onhook");
-
-        return (SM_RC_CLEANUP);
-    }
-
-    if (cprStartTimer(dcb->err_onhook_tmr,
-                      FSMDEF_ERR_ONHOOK_TMR_SECS * 1000,
-                      (void *)(long)dcb->call_id) == CPR_FAILURE) {
-        FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_START_FAILED),
-                     dcb->call_id, dcb->line, "",
-                     "Error Onhook", cpr_errno);
-		return (SM_RC_CLEANUP);
-    }
-
     return (SM_RC_END);
 }
 
 
 static sm_rcs_t
 fsmdef_ev_collectinginfo_feature (sm_event_t *event)
 {
     fsm_fcb_t       *fcb    = (fsm_fcb_t *) event->data;
@@ -4937,38 +4824,16 @@ fsmdef_ev_out_alerting (sm_event_t *even
             return (fsmdef_release(fcb, cause, dcb->send_release));
         }
 
         /*
          * Record fact that we have successfully negotiated media that may be
          * used for inband ringback.
          */
         dcb->inband_received = TRUE;
-        FSM_DEBUG_SM(DEB_F_PREFIX"inband_received, cancel timer.", DEB_F_PREFIX_ARGS(FSM, fname));
-
-        /*
-         * If ringback delay timer has been started, cancel it now.
-         */
-        if (cprCancelTimer(dcb->ringback_delay_tmr) != CPR_SUCCESS) {
-            FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_CANCEL_FAILED),
-                         dcb->call_id, dcb->line, fname, "Ringback Delay",
-                         cpr_errno);
-        }
-    } else {
-        /*
-         * Not inband alerting case. Set ringback delay timer so that local
-         * ringback will eventually be played. We delay the ringback for
-         * a short time to handle the case where the messages key was pressed.
-         * This is because VM server can respond very quickly with RTP, 183,
-         * and 200 and we do not want local ringback tone to interfere with
-         * the playing of the VM prompt.
-         */
-        if (!cprIsTimerRunning(dcb->ringback_delay_tmr)) {
-            fsmdef_set_ringback_delay_timer(dcb);
-        }
     }
 
     cc_call_state(dcb->call_id, dcb->line, CC_STATE_FAR_END_ALERTING,
                   FSMDEF_CC_CALLER_ID);
 
     /*
      * If DSP is not able to start rx/tx channels, release the call
      */
@@ -5057,41 +4922,16 @@ fsmdef_ev_callsent_release (sm_event_t *
              * If SIP brought this down, we are still offhook on the UI, so
              * when we get the release_complete from the 200 for the BYE, we
              * need to ignore it, so that reorder can be played AND when the user
              * hangs up, then the UI will be driven to a clean state.
              */
             if (src_id == CC_SRC_SIP) {
                 dcb->early_error_release = TRUE;
             }
-
-            if ( dcb->err_onhook_tmr) {
-                (void) cprDestroyTimer(dcb->err_onhook_tmr);
-            }
-            dcb->err_onhook_tmr = cprCreateTimer("Error Onhook",
-                    GSM_ERROR_ONHOOK_TIMER,
-                    TIMER_EXPIRATION,
-                    gsm_msgq);
-            if (dcb->err_onhook_tmr == NULL) {
-                FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_CREATE_FAILED),
-                        dcb->call_id, dcb->line, "", "Error Onhook");
-                return (SM_RC_CLEANUP);
-            }
-
-            if (cprStartTimer(dcb->err_onhook_tmr,
-                        FSMDEF_ERR_ONHOOK_TMR_SECS * 1000,
-                        (void *)(long)dcb->call_id) == CPR_FAILURE) {
-
-                FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_START_FAILED),
-                        dcb->call_id, dcb->line, "",
-                        "Error Onhook", cpr_errno);
-
-                return (SM_RC_CLEANUP);
-            }
-
             break;
 
         default:
             sm_rc = fsmdef_release(fcb, cause, dcb->send_release);
             if (sm_rc == SM_RC_CLEANUP) {
                 /*
                  * FSM release indicates clean up, do not continue
                  * on since fcb and dcb have been freed or re-initialized.
@@ -5443,19 +5283,16 @@ fsmdef_handle_inalerting_offhook_answer 
             /*
              * Force us to update the UI so that any possible callinfo received
              * prior to the call is answered takes effect.
              */
             dcb->ui_update_required = TRUE;
         }
     }
 
-    /* Cancel any existing autoanswer timer */
-    (void)cprCancelTimer(dcb->autoAnswerTimer);
-
     cc_int_connected(CC_SRC_GSM, CC_SRC_SIP, dcb->call_id, dcb->line,
                      &(dcb->caller_id), NULL, &msg_body);
 
     FSM_SET_FLAGS(dcb->msgs_sent, FSMDEF_MSG_CONNECTED);
 
     cc_call_state(dcb->call_id, dcb->line, CC_STATE_ANSWERED,
                   FSMDEF_CC_CALLER_ID);
 
@@ -5571,21 +5408,16 @@ fsmdef_transition_to_connected (fsm_fcb_
 {
     fsmdef_dcb_t      *dcb = fcb->dcb;
     cc_feature_data_t feature_data;
     sm_rcs_t          sm_rc = SM_RC_END;
     cc_causes_t       cause;
 
     FSM_DEBUG_SM(DEB_F_PREFIX"Entered.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
 
-    if (dcb->req_pending_tmr) {
-        /* cancel any request pending timer, just in case */
-        (void) cprCancelTimer(dcb->req_pending_tmr);
-    }
-
     /*
      * Update the media capability without effecting the existing media line.
      */
     if (!gsmsdp_update_local_sdp_media_capability(dcb, FALSE, FALSE)) {
         /* not thing is changed, transition to connected state */
         fsm_change_state(fcb, __LINE__, FSMDEF_S_CONNECTED);
         return (sm_rc);
     }
@@ -5648,25 +5480,16 @@ fsmdef_ev_connected (sm_event_t *event)
     dcb->active_feature = CC_FEATURE_NONE;
 
     /* Reset spoof ring out in case t was set before going to connected state. */
     FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_CLR_SPOOF_APPLD),
                  dcb->call_id, dcb->line, fname);
 
     dcb->spoof_ringout_applied = FALSE;
 
-    /*
-     * Cancel ringback delay timer
-     */
-    if (cprCancelTimer(dcb->ringback_delay_tmr) != CPR_SUCCESS) {
-        FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_CANCEL_FAILED),
-                     dcb->call_id, dcb->line, fname, "Ringback Delay",
-                     cpr_errno);
-    }
-
     cc_call_state(dcb->call_id, dcb->line, CC_STATE_CONNECTED,
                   FSMDEF_CC_CALLER_ID);
 
     if ( dcb->log_disp != CC_CALL_LOG_DISP_UNKNWN ) {
         ui_log_disposition(dcb->call_id, dcb->log_disp );
     }
 
 
@@ -5934,38 +5757,16 @@ fsm_connected_media_pend_local_hold (fsm
         cc_int_feature_ack(CC_SRC_GSM, CC_SRC_GSM, dcb->call_id,
                            dcb->line, CC_FEATURE_HOLD, NULL,
                            CC_CAUSE_NORMAL);
         FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG1), dcb->call_id, dcb->line,
                      fname, "already hold");
         return (SM_RC_END);
     }
 
-    if (dcb->req_pending_tmr &&
-        cprIsTimerRunning(dcb->req_pending_tmr)) {
-        /*
-         * Request timer is running, that means we are waiting
-         * to re-send media update again due to previously glare.
-         * Since the previous offer has not been accepted, we can
-         * simply just send hold instead when glare resolution timer
-         * expires.
-         */
-
-        /* store the reason to resend when glare timer expires */
-        dcb->hold_reason = data_p->hold.call_info.data.hold_resume_reason;
-        /*
-         * reset feature hold pending flag in case that there are
-         * multiple hold feature received while waiting for
-         * glare resolution to resolve.
-         */
-        FSM_RESET_FLAGS(dcb->flags, FSMDEF_F_HOLD_REQ_PENDING);
-        fsm_change_state(fcb, __LINE__, FSMDEF_S_HOLD_PENDING);
-        return (SM_RC_END);
-    }
-
     /*
      * We have sent media capability update out but have not received
      * any response yet. The glare condition may occur but we can only
      * assume that the media update was sent out at this point.
      * We can not send out any more request until the result is
      * known. We can not do any thing now but simply remember
      * to re-send media with the hold feature pending when
      * the result is known.
@@ -7079,27 +6880,17 @@ void fsmdef_reversion_timeout(callid_t c
     }
 
     // check that we are in HOLDING state before proceeding
     if ((dcb->fcb->state != FSMDEF_S_HOLDING) &&
         (dcb->fcb->state != FSMDEF_S_HOLD_PENDING)) {
         return;
     }
 
-    if  (dcb->reversionInterval > 0) {
-	    ret = cprStartTimer(dcb->revertTimer, dcb->reversionInterval * 1000, (void*)(long)call_id);
-	}
-
-	if ( ret == CPR_FAILURE ) {
-        FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_START_FAILED),
-              dcb->call_id, dcb->line, "", "Reversion", cpr_errno);
-        return;
-    }
-
-	cc_call_state(dcb->call_id, dcb->line, CC_STATE_HOLD_REVERT, NULL);
+    cc_call_state(dcb->call_id, dcb->line, CC_STATE_HOLD_REVERT, NULL);
 
 }
 
 
 /**
   *
   * fsmdef_resume - Performs Resume Operation.
   *
@@ -7139,18 +6930,16 @@ fsmdef_resume (sm_event_t *event)
         cc_int_feature_ack(CC_SRC_GSM, CC_SRC_GSM, dcb->call_id,
                            dcb->line, CC_FEATURE_RESUME, NULL,
                            CC_CAUSE_NORMAL);
         FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG1), call_id, dcb->line,
                      fname, "resume media not in hold state\n");
         return;
     }
 
-    (void) cprCancelTimer(dcb->revertTimer);
-	dcb->reversionInterval = -1;
     /*
      * Make sure the connected call (if there is one) goes on hold,
      * but do not hold the connected call if it is involved in a
      * conference.
      */
     if (msg->data.resume.cause != CC_CAUSE_CONF) {
         if (fsmdef_wait_to_start_new_call(TRUE, src_id, call_id, line,
                                           CC_FEATURE_RESUME, (msg->data_valid ?
@@ -7162,20 +6951,16 @@ fsmdef_resume (sm_event_t *event)
             }
             return ;
         }
     }
 
     /* Clear all media holding status */
     fsmdef_update_media_hold_status(dcb, NULL, FALSE);
 
-    if (dcb->req_pending_tmr && cprIsTimerRunning(dcb->req_pending_tmr)) {
-        req_pending_tmr_running = TRUE;
-    }
-
     if (!req_pending_tmr_running) {
         /*
          * Reinitialize the local sdp to include all available codecs.
          * We do this because it is possible that our local list
          * may have been shortened to the one negotiated codec. This is
          * the case when we receive an incoming call, we negotiate a
          * single codec, copy it into the local sdp and send it back
          * in the connected msg.
@@ -7255,22 +7040,17 @@ fsmdef_resume (sm_event_t *event)
 static sm_rcs_t
 fsmdef_ev_holding_offhook (sm_event_t *event)
 {
     fsm_fcb_t         *fcb     = (fsm_fcb_t *) event->data;
     fsmdef_dcb_t      *dcb     = fcb->dcb;
 
     FSM_DEBUG_SM(DEB_F_PREFIX"Entered.", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
 
-    if (cprIsTimerRunning(dcb->revertTimer)) {
-		// Off hook resume calls only if HR is active else ignore this event
-		fsmdef_resume(event);
-	}
-
-	return  SM_RC_END;
+    return  SM_RC_END;
 
 }
 
 static sm_rcs_t
 fsmdef_ev_holding_feature (sm_event_t *event)
 {
     fsm_fcb_t *fcb = (fsm_fcb_t *) event->data;
     fsmdef_dcb_t *dcb = fcb->dcb;
@@ -7305,47 +7085,40 @@ fsmdef_ev_holding_feature (sm_event_t *e
                 feature_data.hold.call_info.data.call_info_feat_data.swap = FALSE;
                 feature_data.hold.call_info.data.call_info_feat_data.protect = FALSE;
                 sm_rc = fsm_hold_local(fcb, &feature_data, FALSE);
             }
             fsmdef_handle_join_pending(dcb);
             return (sm_rc);
 
         case CC_FEATURE_HOLD_REVERSION:
-            // Stop the timer for alert interval
-            (void) cprCancelTimer(dcb->revertTimer);
-            dcb->reversionInterval = -1;
 
 			// Do not revert if alertInterval is negative
             if ( data->hold_reversion.alertInterval < 0 )
                return SM_RC_END;
 			// interval timer of 0 implies continue to revert
 			// Clamp the interval to be in MIN/MAX_HOLD_REVERSION_INTERVAL_TIMER
             if ( data->hold_reversion.alertInterval  > 0  &&
 				 data->hold_reversion.alertInterval < MIN_HOLD_REVERSION_INTERVAL_TIMER )
                data->hold_reversion.alertInterval = MIN_HOLD_REVERSION_INTERVAL_TIMER;
 
             if ( data->hold_reversion.alertInterval > MAX_HOLD_REVERSION_INTERVAL_TIMER )
                data->hold_reversion.alertInterval = MAX_HOLD_REVERSION_INTERVAL_TIMER;
 
-            dcb->reversionInterval = data->hold_reversion.alertInterval ;
-
             fsmdef_reversion_timeout(fcb->dcb->call_id);
 
             fsmdef_handle_join_pending(dcb);
             return SM_RC_END;
 
         case CC_FEATURE_RESUME:
             fsmdef_resume(event);
             break;
 
         case CC_FEATURE_END_CALL:
             sm_rc = fsmdef_release_call(fcb, msg);
-            (void) cprCancelTimer(dcb->revertTimer);
-            dcb->reversionInterval = -1;
             fsmdef_handle_join_pending(dcb);
             return (sm_rc);
 
         case CC_FEATURE_SELECT:
             if (msg->data_valid == FALSE) {
                 fsmdef_select_invoke(dcb, NULL);
             } else {
                 fsmdef_select_invoke(dcb, data);
@@ -7383,18 +7156,16 @@ fsmdef_ev_holding_feature (sm_event_t *e
         case CC_FEATURE_MEDIA:
             return (fsmdef_remote_media(fcb, msg));
 
         case CC_FEATURE_CALLINFO:
             fsmdef_update_callinfo(fcb, msg);
             break;
 
         case CC_FEATURE_CALL_PRESERVATION:
-            (void) cprCancelTimer(dcb->revertTimer);
-            dcb->reversionInterval = -1;
             return (fsmdef_release(fcb, CC_CAUSE_NORMAL, dcb->send_release));
 
         case CC_FEATURE_NOTIFY:
             fsmdef_ev_notify_feature(msg, dcb);
             break;
 
         default:
             fsmdef_sm_ignore_ftr(fcb, __LINE__, ftr_id);
@@ -7522,52 +7293,34 @@ fsmdef_ev_resume_pending_feature (sm_eve
              * then we can not send out hold immediately. In the later
              * case, go to hold pending state and wait for resume
              * feature ack to send hold out.
              *
              * In either case, UI can be unlocked since we are now
              * about to hold again.
              */
             fim_unlock_ui(dcb->call_id);
-            if (dcb->req_pending_tmr &&
-                cprIsTimerRunning(dcb->req_pending_tmr)) {
-                /*
-                 * Request timer is running, that means we are waiting
-                 * to send resume or we already have sent one out
-                 * but it resulted in glare condition and that we are waiting
-                 * to resent it again. In this, just go back to hold state.
-                 */
-                (void) cprCancelTimer(dcb->req_pending_tmr);
-
-                FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG1),
-                             dcb->call_id, dcb->line, fname,
-                             "Received Hold while waiting to send resume\n");
-
-                /* Go back to holding without sending any thing out */
-                (void)fsm_hold_local_only(fcb);
+            /*
+             * We have sent resume to the network and wait for
+             * for the feature ack. The glare condition can
+             * occur but we can only assume that resume was sent out
+             * at this point. We can not send out any more request
+             * until the result is known.
+             */
+            if (msg->data_valid) {
+                dcb->hold_reason =
+                     data->hold.call_info.data.hold_resume_reason;
             } else {
-                /*
-                 * We have sent resume to the network and wait for
-                 * for the feature ack. The glare condition can
-                 * occur but we can only assume that resume was sent out
-                 * at this point. We can not send out any more request
-                 * until the result is known.
-                 */
-                if (msg->data_valid) {
-                    dcb->hold_reason =
-                         data->hold.call_info.data.hold_resume_reason;
-                } else {
-                    dcb->hold_reason = CC_REASON_NONE;
-                }
-                // since we are going to hold stop the media now
-                // else the next new call or resume will result in 2 sets of media ports open
-                (void)cc_call_action(dcb->call_id, dcb->line, CC_ACTION_STOP_MEDIA,
-                                 NULL);
-                fsm_change_state(fcb, __LINE__, FSMDEF_S_HOLD_PENDING);
+                dcb->hold_reason = CC_REASON_NONE;
             }
+            // since we are going to hold stop the media now
+            // else the next new call or resume will result in 2 sets of media ports open
+            (void)cc_call_action(dcb->call_id, dcb->line, CC_ACTION_STOP_MEDIA,
+                             NULL);
+            fsm_change_state(fcb, __LINE__, FSMDEF_S_HOLD_PENDING);
             break;
 
         default:
             fsmdef_sm_ignore_ftr(fcb, __LINE__, ftr_id);
             break;
         }
         break;
 
@@ -9227,58 +8980,16 @@ fsmdef_init (void)
                      DEB_F_PREFIX_ARGS(FSM, fname));
         return;
     }
 
     DEF_DEBUG(DEB_F_PREFIX"Disabling mass registration print", DEB_F_PREFIX_ARGS(SIP_REG, fname));
     FSM_FOR_ALL_CBS(dcb, fsmdef_dcbs, FSMDEF_MAX_DCBS) {
         fsmdef_init_dcb(dcb, CC_NO_CALL_ID, FSMDEF_CALL_TYPE_NONE,
                         FSMDEF_NO_NUMBER, LSM_NO_LINE, NULL);
-        /*
-         * Allocate ringback delay timer for each dcb
-         */
-        dcb->ringback_delay_tmr = cprCreateTimer("Ringback Delay",
-                                                 GSM_RINGBACK_DELAY_TIMER,
-                                                 TIMER_EXPIRATION,
-                                                 gsm_msgq);
-        if (dcb->ringback_delay_tmr == NULL) {
-            FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_CREATE_FAILED),
-                         dcb->call_id, dcb->line, fname, "Ringback Delay");
-            return;
-        }
-
-        /*
-         * Allocate auto answer timer for each dcb
-         */
-        dcb->autoAnswerTimer = cprCreateTimer("Auto Answer",
-                                              GSM_AUTOANSWER_TIMER,
-                                              TIMER_EXPIRATION,
-                                              gsm_msgq);
-        if (dcb->autoAnswerTimer == NULL) {
-            FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_CREATE_FAILED),
-                         dcb->call_id, dcb->line, fname, "Auto Answer");
-            (void)cprDestroyTimer(dcb->ringback_delay_tmr);
-            dcb->ringback_delay_tmr = NULL;
-            return;
-        }
-        dcb->revertTimer = cprCreateTimer("Call Reversion",
-                                              GSM_REVERSION_TIMER,
-                                              TIMER_EXPIRATION,
-                                              gsm_msgq);
-		dcb->reversionInterval = -1;
-        if (dcb->revertTimer == NULL) {
-            FSM_DEBUG_SM(get_debug_string(FSMDEF_DBG_TMR_CREATE_FAILED),
-                         dcb->call_id, dcb->line, fname, "Hold Revertion");
-
-            (void)cprDestroyTimer(dcb->ringback_delay_tmr);
-            dcb->ringback_delay_tmr = NULL;
-            (void)cprDestroyTimer(dcb->autoAnswerTimer);
-            dcb->autoAnswerTimer = NULL;
-            return;
-        }
         if (dcb == fsmdef_dcbs) {
             g_disable_mass_reg_debug_print = TRUE;
         }
     }
     g_disable_mass_reg_debug_print = FALSE;
 
     /*
      * Initialize the state/event table.
@@ -9291,32 +9002,16 @@ fsmdef_init (void)
 }
 
 void
 fsmdef_shutdown (void)
 {
     fsmdef_dcb_t *dcb;
 
     FSM_FOR_ALL_CBS(dcb, fsmdef_dcbs, FSMDEF_MAX_DCBS) {
-        if (dcb->req_pending_tmr) {
-            (void)cprDestroyTimer(dcb->req_pending_tmr);
-        }
-        if (dcb->err_onhook_tmr) {
-            (void)cprDestroyTimer(dcb->err_onhook_tmr);
-        }
-        if (dcb->ringback_delay_tmr) {
-            (void)cprDestroyTimer(dcb->ringback_delay_tmr);
-        }
-        if (dcb->autoAnswerTimer) {
-            (void)cprDestroyTimer(dcb->autoAnswerTimer);
-        }
-        if (dcb->revertTimer) {
-            (void)cprDestroyTimer(dcb->revertTimer);
-        }
-
         /* clean media list */
         gsmsdp_clean_media_list(dcb);
     }
 
     /* destroy free media structure list */
     gsmsdp_destroy_free_media_list();
 
     cpr_free(fsmdef_dcbs);
--- a/media/webrtc/signaling/src/sipcc/core/gsm/gsm.c
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/gsm.c
@@ -22,17 +22,16 @@
 #include "debug.h"
 #include "fim.h"
 #include "gsm_sdp.h"
 #include "ccsip_subsmanager.h"
 #include "dialplanint.h"
 #include "kpmlmap.h"
 #include "subapi.h"
 #include "platform_api.h"
-#include "thread_monitor.h"
 
 static void sub_process_feature_msg(uint32_t cmd, void *msg);
 static void sub_process_feature_notify(ccsip_sub_not_data_t *msg, callid_t call_id,
                             callid_t other_call_id);
 static void sub_process_b2bcnf_msg(uint32_t cmd, void *msg);
 void fsmb2bcnf_get_sub_call_id_from_ccb(fsmcnf_ccb_t *ccb, callid_t *cnf_call_id,
                 callid_t *cns_call_id);
 extern cprMsgQueue_t gsm_msgq;
@@ -40,17 +39,16 @@ void destroy_gsm_thread(void);
 void dp_shutdown();
 extern void dcsm_process_jobs(void);
 extern void dcsm_init(void);
 extern void dcsm_shutdown(void);
 
 /* Flag to see whether we can start processing events */
 
 static boolean gsm_initialized = FALSE;
-extern cprThread_t gsm_thread;
 static media_timer_callback_fp* media_timer_callback = NULL;
 
 /**
  * Add media falsh one time timer call back. It's for ROUNDTABLE only.
  */
 void
 gsm_set_media_callback(media_timer_callback_fp* callback) {
     media_timer_callback = callback;
@@ -70,36 +68,16 @@ gsm_get_initialize_state (void)
 
 cprBuffer_t
 gsm_get_buffer (uint16_t size)
 {
     return cpr_malloc(size);
 }
 
 
-cpr_status_e
-gsm_send_msg (uint32_t cmd, cprBuffer_t buf, uint16_t len)
-{
-    phn_syshdr_t *syshdr;
-
-    syshdr = (phn_syshdr_t *) cprGetSysHeader(buf);
-    if (!syshdr) {
-        return CPR_FAILURE;
-    }
-    syshdr->Cmd = cmd;
-    syshdr->Len = len;
-
-    if (cprSendMessage(gsm_msgq, buf, (void **) &syshdr) == CPR_FAILURE) {
-        cprReleaseSysHeader(syshdr);
-        return CPR_FAILURE;
-    }
-    return CPR_SUCCESS;
-}
-
-
 boolean
 gsm_process_msg (uint32_t cmd, void *msg)
 {
     static const char fname[] = "gsm_process_msg";
     boolean release_msg = TRUE;
     cc_msgs_t       msg_id   = ((cc_setup_t *)msg)->msg_id;
     int             event_id = msg_id;
 
@@ -253,38 +231,18 @@ void
 gsm_reset (void)
 {
     dp_reset();
     lsm_reset();
     fsmutil_free_all_shown_calls_ci_map();
 }
 
 void
-GSMTask (void *arg)
+GSM_prepare_task()
 {
-    static const char fname[] = "GSMTask";
-    void           *msg;
-    phn_syshdr_t   *syshdr;
-    boolean        release_msg = TRUE;
-
-    MOZ_ASSERT (gsm_msgq == (cprMsgQueue_t) arg);
-
-    if (!gsm_msgq) {
-        GSM_ERR_MSG(GSM_F_PREFIX"invalid input, exiting", fname);
-        return;
-    }
-
-    if (platThreadInit("GSMTask") != 0) {
-        return;
-    }
-    /*
-     * Adjust relative priority of GSM thread.
-     */
-    (void) cprAdjustRelativeThreadPriority(GSM_THREAD_RELATIVE_PRIORITY);
-
     /*
      * Initialize all the GSM modules
      */
     lsm_init();
     fsm_init();
     fim_init();
     gsm_init();
     dcsm_init();
@@ -299,85 +257,83 @@ GSMTask (void *arg)
      * restarts.
      */
     cpr_srand((unsigned int)time(NULL));
 
     /*
      * Cache random numbers for SRTP keys
      */
     gsmsdp_cache_crypto_keys();
-
-    while (1) {
-
-        release_msg = TRUE;
+}
 
-        msg = cprGetMessage(gsm_msgq, TRUE, (void **) &syshdr);
-        if (msg) {
-            switch (syshdr->Cmd) {
-            case TIMER_EXPIRATION:
-                gsm_process_timer_expiration(msg);
-                break;
+cpr_status_e
+gsm_send_msg (uint32_t cmd, cprBuffer_t msg, uint16_t len)
+{
+    boolean release_msg = TRUE;
+
+    switch (cmd) {
+    case TIMER_EXPIRATION:
+        gsm_process_timer_expiration(msg);
+        break;
 
-            case GSM_SIP:
-            case GSM_GSM:
-                release_msg = gsm_process_msg(syshdr->Cmd, msg);
-                break;
+    case GSM_SIP:
+    case GSM_GSM:
+        release_msg = gsm_process_msg(cmd, msg);
+        break;
 
-            case DP_MSG_INIT_DIALING:
-            case DP_MSG_DIGIT_STR:
-            case DP_MSG_STORE_DIGIT:
-            case DP_MSG_DIGIT:
-            case DP_MSG_DIAL_IMMEDIATE:
-            case DP_MSG_REDIAL:
-            case DP_MSG_ONHOOK:
-            case DP_MSG_OFFHOOK:
-            case DP_MSG_UPDATE:
-            case DP_MSG_DIGIT_TIMER:
-            case DP_MSG_CANCEL_OFFHOOK_TIMER:
-                dp_process_msg(syshdr->Cmd, msg);
-                break;
+    case DP_MSG_INIT_DIALING:
+    case DP_MSG_DIGIT_STR:
+    case DP_MSG_STORE_DIGIT:
+    case DP_MSG_DIGIT:
+    case DP_MSG_DIAL_IMMEDIATE:
+    case DP_MSG_REDIAL:
+    case DP_MSG_ONHOOK:
+    case DP_MSG_OFFHOOK:
+    case DP_MSG_UPDATE:
+    case DP_MSG_DIGIT_TIMER:
+    case DP_MSG_CANCEL_OFFHOOK_TIMER:
+        dp_process_msg(cmd, msg);
+        break;
 
-            case SUB_MSG_B2BCNF_SUBSCRIBE_RESP:
-            case SUB_MSG_B2BCNF_NOTIFY:
-            case SUB_MSG_B2BCNF_TERMINATE:
-                sub_process_b2bcnf_msg(syshdr->Cmd, msg);
-                break;
+    case SUB_MSG_B2BCNF_SUBSCRIBE_RESP:
+    case SUB_MSG_B2BCNF_NOTIFY:
+    case SUB_MSG_B2BCNF_TERMINATE:
+        sub_process_b2bcnf_msg(cmd, msg);
+        break;
 
-            case SUB_MSG_FEATURE_SUBSCRIBE_RESP:
-            case SUB_MSG_FEATURE_NOTIFY:
-            case SUB_MSG_FEATURE_TERMINATE:
-                sub_process_feature_msg(syshdr->Cmd, msg);
-                break;
+    case SUB_MSG_FEATURE_SUBSCRIBE_RESP:
+    case SUB_MSG_FEATURE_NOTIFY:
+    case SUB_MSG_FEATURE_TERMINATE:
+        sub_process_feature_msg(cmd, msg);
+        break;
 
-            case REG_MGR_STATE_CHANGE:
-                gsm_reset();
-                break;
-            case THREAD_UNLOAD:
-                thread_ended(THREADMON_GSM);
-                destroy_gsm_thread();
-                break;
+    case REG_MGR_STATE_CHANGE:
+        gsm_reset();
+        break;
+    case THREAD_UNLOAD:
+        destroy_gsm_thread();
+        break;
 
-            default:
-                GSM_ERR_MSG(GSM_F_PREFIX"Unknown message", fname);
-                break;
-            }
+    default:
+        GSM_ERR_MSG(GSM_F_PREFIX"Unknown message", __FUNCTION__);
+        break;
+    }
 
-            cprReleaseSysHeader(syshdr);
-            if (release_msg == TRUE) {
-                cpr_free(msg);
-            }
+    if (release_msg == TRUE) {
+        cpr_free(msg);
+    }
 
-            /* Check if there are pending messages for dcsm
-             * if it in the right state perform its operation
-             */
-            dcsm_process_jobs();
-        }
-    }
+    /* Check if there are pending messages for dcsm
+     * if it in the right state perform its operation
+     */
+    dcsm_process_jobs();
+    return CPR_SUCCESS;
 }
 
+
 /**
  * This function will process SUBSCRIBED feature NOTIFY messages.
  *
  * @param[in] msg - pointer to ccsip_sub_not_data_t
  *
  * @return none
  *
  * @pre (msg != NULL)
@@ -588,10 +544,9 @@ gsm_is_idle (void)
  */
 void destroy_gsm_thread()
 {
     static const char fname[] = "destroy_gsm_thread";
     DEF_DEBUG(DEB_F_PREFIX"Unloading GSM and destroying GSM thread",
         DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
     gsm_shutdown();
     dp_shutdown();
-    (void) cprDestroyThread(gsm_thread);
 }
--- a/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h
+++ b/media/webrtc/signaling/src/sipcc/core/gsm/h/fsm.h
@@ -351,25 +351,16 @@ typedef struct {
      */
     void *feature_invocation_state;
 
     /* TRUE if CCM has requested phone to show ringout UI */
     boolean spoof_ringout_requested;
     /* TRUE if GSM has applied ringout due to CCMs request to show ringout UI */
     boolean spoof_ringout_applied;
 
-    /* Timer to go on hook after any call error */
-    cprTimer_t err_onhook_tmr;
-
-    /* Request pending timer */
-    cprTimer_t req_pending_tmr;
-
-    /* Ringback delay timer */
-    cprTimer_t ringback_delay_tmr;
-
     /*
      * save of orientation from callInfo to update UI at any time
      * other than during call info. update such as after Tx start in
      * order to update security icon.
      */
     cc_orientation_e orientation;
 
     /*
@@ -380,21 +371,16 @@ typedef struct {
     boolean ui_update_required;
     boolean placed_call_update_required;
 
     boolean is_conf_call;
 
     cc_security_e security;
     cc_policy_e policy;
 
-    /* auto answer timer */
-    cprTimer_t autoAnswerTimer;
-    int32_t    reversionInterval;
-    cprTimer_t revertTimer;
-
     boolean dsp_out_of_resources;
 
     boolean selected;
 
     boolean select_pending;
 
     boolean call_not_counted_in_mnc_bt;
 
--- a/media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_task.c
+++ b/media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_task.c
@@ -38,17 +38,16 @@
 #include "uiapi.h"
 #include "sip_csps_transport.h"
 #include "sip_common_regmgr.h"
 #include "sip_platform_task.h"
 #include "platform_api.h"
 #include "sip_interface_regmgr.h"
 #include "ccsip_publish.h"
 #include "platform_api.h"
-#include "thread_monitor.h"
 
 #ifdef SAPP_SAPP_GSM
 #define SAPP_APP_GSM 3
 #define SAPP_APP SAPP_APP_GSM
 #include "sapp.h"
 #endif
 
 #if defined SIP_OS_WINDOWS
@@ -56,22 +55,20 @@
 #endif
 
 
 
 extern sipSCB_t *find_scb_by_callid(const char *callID, int *scb_index);
 extern int platThreadInit(char *);
 void sip_platform_handle_service_control_notify(sipServiceControl_t *scp);
 short SIPTaskProcessTimerExpiration(void *msg, uint32_t *cmd);
-extern cprMsgQueue_t sip_msgq;
 extern cprMsgQueue_t gsm_msgq;
 extern void ccsip_dump_recv_msg_info(sipMessage_t *pSIPMessage,
                                cpr_ip_addr_t *cc_remote_ipaddr,
                                uint16_t cc_remote_port);
-void destroy_sip_thread(void);
 
 // Global variables
 
 
 /*---------------------------------------------------------
  *
  * Definitions
  *
@@ -113,19 +110,16 @@ typedef struct ccsip_restart_req_t_ {
 
 typedef struct ccsip_shutdown_req_t_ {
     ccsip_shutdown_cmd cmd;    /* shutdown command */
     int action;
     int reason;
 } ccsip_shutdown_req_t;
 
 
-extern cprThread_t sip_thread;
-
-
 /*---------------------------------------------------------
  *
  * Local Variables
  *
  */
 // static uint16_t    nfds = 0; No reference. Should this be removed?
 extern fd_set read_fds;
 extern fd_set write_fds;
@@ -312,38 +306,21 @@ SIPTaskInit (void)
  *               usr - user pointer TEMPORARY VALUE TO MOVE INTO msg
  *
  * Return Value: SIP_OK or SIP_ERROR
  *
  */
 cpr_status_e
 SIPTaskSendMsg (uint32_t cmd, void *msg, uint16_t len, void *usr)
 {
-    phn_syshdr_t *syshdr;
-
-    syshdr = (phn_syshdr_t *) cprGetSysHeader(msg);
-    if (!syshdr) {
-        return CPR_FAILURE;
-    }
-    syshdr->Cmd = cmd;
-    syshdr->Len = len;
-    syshdr->Usr.UsrPtr = usr;
-
-    /*
-     * If we send a message to the task too soon the sip variable is not set yet.
-     * so just use the global for now. This happens if we create sip thread
-     * and immediately send a CFG_DONE message to sip thread from the main thread.
-     * This can be solved by waiting for an echo roundtrip from Thread before sending
-     * any other message. Will do someday.
-     */
-    if (cprSendMessage(sip_msgq /*sip.msgQueue */ , (cprBuffer_t)msg, (void **)&syshdr)
-        == CPR_FAILURE) {
-        cprReleaseSysHeader(syshdr);
-        return CPR_FAILURE;
-    }
+    /* Mozilla hack: just ignore everything that is posted here */
+    (void)cmd;
+    cpr_free(msg);
+    (void)len;
+    (void)usr;
     return CPR_SUCCESS;
 }
 
 /**
  *
  * SIPTaskGetBuffer (API)
  *
  * The API to grab a buffer from the SIP buffer pool
@@ -872,20 +849,16 @@ SIPTaskProcessListEvent (uint32_t cmd, v
             cpr_free(msg);
             CCSIP_DEBUG_TASK(DEB_F_PREFIX"Received SIP_SHUTDOWN message",
                 DEB_F_PREFIX_ARGS(SIP_EVT, fname));
             SIPTaskProcessShutdown(action, reason);
         }
         break;
 
     case THREAD_UNLOAD:
-        {
-            thread_ended(THREADMON_SIP);
-            destroy_sip_thread();
-        }
         break;
 
     case SIP_TMR_GLARE_AVOIDANCE:
         // Handle glare retry timer expiry
         idx = (long) (timerMsg->usrData);
         sip_sm_event.ccb = sip_sm_get_ccb_by_index((line_t)idx);
         sip_sm_event.type = (sipSMEventType_t) E_SIP_GLARE_AVOIDANCE_TIMER;
         cpr_free(msg);
@@ -3013,23 +2986,9 @@ SIPTaskProcessShutdown (int action, int 
 {
     static const char fname[] = "SIPTaskProcessShutdown";
 
     CCSIP_DEBUG_TASK(DEB_F_PREFIX"Starting Shutdown Process", DEB_F_PREFIX_ARGS(SIP_TASK, fname));
     sip_mode_quiet = TRUE;
     /* Shutdown SIP components */
     sip_shutdown_phase1(action, reason);
 }
-/*
- *  Function: destroy_sip_thread
- *  Description:  kill sip msgQ and sip thread
- *  Parameters:   none
- *  Returns: none
- */
-void destroy_sip_thread()
-{
-    static const char fname[] = "destroy_sip_thread";
-    DEF_DEBUG(DEB_F_PREFIX"Unloading SIP and destroying sip thread",
-        DEB_F_PREFIX_ARGS(SIP_CC_INIT, fname));
 
-    /* kill msgQ thread first, then itself */
-    (void) cprDestroyThread(sip_thread);
-}
--- a/media/webrtc/signaling/src/sipcc/core/sipstack/sip_platform_task.c
+++ b/media/webrtc/signaling/src/sipcc/core/sipstack/sip_platform_task.c
@@ -21,17 +21,16 @@
 #include "ccsip_platform_tcp.h"
 #include "ccsip_task.h"
 #include "sip_socket_api.h"
 #include "platform_api.h"
 #include <sys/stat.h>
 #include <stdio.h>
 #include <unistd.h>
 #include "prprf.h"
-#include "thread_monitor.h"
 
 /*---------------------------------------------------------
  *
  * Definitions
  *
  */
 
 /* The maximum number of messages parsed from the message queue at one time */
@@ -119,146 +118,16 @@ sip_platform_task_init (void)
      */
     FD_ZERO(&read_fds);
     FD_ZERO(&write_fds);
     return;
 }
 
 
 /**
- *  The function is a thread loop that waits on SIP message queue
- *  visible for the external components (sip_msgq). The thread is used
- *  to avoid having the main task loop from having to set a small time
- *  waiting on select() to poll inter-thread messages. The small waiting
- *  time on select() to poll internal messages queue increases the
- *  unnecessary of waking up when system is idle. On the platform that
- *  power conservative is critical such as handheld phone, waking up
- *  periodically is not good for battery life.
- *
- *  This thread splits the message queue waiting function from the
- *  main thread waiting on select(). This thread simply listens on the
- *  internal message queue and signal to the main thread via IPC socket
- *  or local socket trigger. Therefore the main thread can uniformly
- *  process internal message event and the network event via select().
- *  The small internal poll time on select() can be
- *  avoided.
- *
- *  @param[in] arg - pointer to SIP main thread's message queue.
- *
- *  @return None.
- *
- *  @pre     (arg != NULL)
- */
-void sip_platform_task_msgqwait (void *arg)
-{
-    const char    *fname = "sip_platform_task_msgqwait";
-    cprMsgQueue_t *msgq = (cprMsgQueue_t *)arg;
-    unsigned int  wait_main_thread = 0;
-    phn_syshdr_t  *syshdr;
-    void          *msg;
-    uint8_t       num_messages = 0;
-    uint8_t       response = 0;
-    boolean       quit_thread = FALSE;
-
-    if (msgq == NULL) {
-        CCSIP_DEBUG_ERROR(SIP_F_PREFIX"task msgq is null, exiting", fname);
-        return;
-    }
-
-    if (platThreadInit("SIP IPCQ task") != 0) {
-        CCSIP_DEBUG_ERROR(SIP_F_PREFIX"failed to attach thread to JVM", fname);
-        return;
-    }
-
-    /*
-     * Wait for SIP main thread ready for IPC connection.
-     */
-    while (!main_thread_ready) {
-        /* Pause for other threads to run while waiting */
-        cprSleep(SIP_PAUSE_WAIT_IPC_LISTEN_READY_TIME);
-
-        wait_main_thread++;
-        if (wait_main_thread > SIP_MAX_WAIT_FOR_IPC_LISTEN_READY) {
-            /* Exceed the number of wait time */
-            CCSIP_DEBUG_ERROR(SIP_F_PREFIX"timeout waiting for listening IPC"
-                              " socket ready, exiting\n", fname);
-            return;
-        }
-    }
-
-    /*
-     * Adjust relative priority of SIP thread.
-     */
-    (void) cprAdjustRelativeThreadPriority(SIP_THREAD_RELATIVE_PRIORITY);
-
-    while (quit_thread == FALSE) {
-        msg = cprGetMessage(msgq, TRUE, (void **) &syshdr);
-        while (msg != NULL) {
-            /*
-             * There is a message to be forwarded to the main SIP
-             * thread for processing.
-             */
-            sip_int_msgq_buf[num_messages].msg    = msg;
-            sip_int_msgq_buf[num_messages].syshdr = syshdr;
-            num_messages++;
-
-            switch (syshdr->Cmd) {
-            case THREAD_UNLOAD:
-                thread_ended(THREADMON_MSGQ);
-                quit_thread = TRUE;
-                    break;
-                default:
-                    break;
-            }
-
-            if (num_messages == MAX_SIP_MESSAGES) {
-                /*
-                 * Limit the number of messages passed to the main SIP
-                 * thread to MAX_SIP_MESSAGES since SIP main thread only
-                 * process messages up to MAX_SIP_MESSAGES at a time.
-                 */
-                break;
-            }
-            /*
-             * Check to see if there is more message on the queue
-             * before sending IPC message trigger to the main SIP
-             * thread. This is to minimize the overhead of the
-             * the main SIP thread in processing select().
-             */
-            msg = cprGetMessage(msgq, 0, (void **) &syshdr);
-        }
-
-        if (num_messages) {
-            CCSIP_DEBUG_TASK(DEB_F_PREFIX"%d msg available on msgq", DEB_F_PREFIX_ARGS(SIP_MSG_QUE, fname), num_messages);
-            /*
-             * There are some number of messages sent to the main thread,
-             * trigger the main SIP thread via IPC to process the message.
-             */
-            if (cprSend(sip_ipc_clnt_socket, (void *)&num_messages,
-			sizeof(num_messages), 0) < 0) {
-                CCSIP_DEBUG_ERROR(SIP_F_PREFIX"send IPC failed errno=%d", fname, cpr_errno);
-            }
-
-            if (FALSE == quit_thread) {
-            	/*
-            	 * Wait for main thread to signal us to get more message.
-            	 */
-                if (cprRecv(sip_ipc_clnt_socket, &response,
-			    sizeof(response), 0) < 0) {
-            		CCSIP_DEBUG_ERROR(SIP_F_PREFIX"read IPC failed:"
-            				" errno=%d\n", fname, cpr_errno);
-            	}
-            	num_messages = 0;
-            }
-        }
-    }
-    cprCloseSocket(sip_ipc_clnt_socket);
-}
-
-/**
  *  sip_process_int_msg - process internal IPC message from the
  *  the message queue waiting thread.
  *
  *  @param - none.
  *
  *  @return none.
  */
 static void sip_process_int_msg (void)
@@ -323,199 +192,16 @@ static void sip_process_int_msg (void)
     if (cprSend(sip_ipc_serv_socket, (void *)&response,
 		sizeof(response), 0) < 0) {
         CCSIP_DEBUG_ERROR(SIP_F_PREFIX"sending IPC", fname);
     }
 }
 
 /**
  *
- * sip_platform_task_loop
- *
- * Run the SIP task
- *
- * Parameters: arg - SIP message queue
- *
- * Return Value: None
- *
- */
-void
-sip_platform_task_loop (void *arg)
-{
-    static const char *fname = "sip_platform_task_loop";
-    int pending_operations;
-    uint16_t i;
-    fd_set sip_read_fds;
-    fd_set sip_write_fds;
-    sip_tcp_conn_t *entry;
-
-    sip_msgq = (cprMsgQueue_t) arg;
-    if (!sip_msgq) {
-        CCSIP_DEBUG_ERROR(SIP_F_PREFIX"sip_msgq is null, exiting", fname);
-        return;
-    }
-    sip.msgQueue = sip_msgq;
-
-    sip_platform_task_init();
-    /*
-     * Initialize the SIP task
-     */
-    SIPTaskInit();
-
-    if (platThreadInit("SIPStack Task") != 0) {
-        CCSIP_DEBUG_ERROR(SIP_F_PREFIX"failed to attach thread to JVM", fname);
-        return;
-    }
-
-    /*
-     * Adjust relative priority of SIP thread.
-     */
-    (void) cprAdjustRelativeThreadPriority(SIP_THREAD_RELATIVE_PRIORITY);
-
-    /*
-     * Setup IPC socket addresses for main thread (server)
-     */
-    {
-      cpr_socket_t sockets[2];
-      if (cprSocketPair(AF_LOCAL, SOCK_DGRAM, 0, sockets) == CPR_SUCCESS) {
-	sip_ipc_serv_socket = sockets[0];
-	sip_ipc_clnt_socket = sockets[1];
-      } else {
-        CCSIP_DEBUG_ERROR(SIP_F_PREFIX"socketpair failed:"
-                          " errno=%d\n", fname, cpr_errno);
-        return;
-      }
-    }
-
-    /*
-     * On Win32 platform, the random seed is stored per thread; therefore,
-     * each thread needs to seed the random number.  It is recommended by
-     * MS to do the following to ensure randomness across application
-     * restarts.
-     */
-    cpr_srand((unsigned int)time(NULL));
-
-    /*
-     * Set read IPC socket
-     */
-    sip_platform_task_set_read_socket(sip_ipc_serv_socket);
-
-    /*
-     * Let the message queue waiting thread know that the main
-     * thread is ready.
-     */
-    main_thread_ready = TRUE;
-
-    /*
-     * Main Event Loop
-     * - Forever-loop exits in sip_process_int_msg()::THREAD_UNLOAD
-     */
-    while (TRUE) {
-      sip_process_int_msg();
-
-#if 0
-       /* We don't actually want to select anything else. See bug 1049291 */
-        /*
-         * Wait on events or timeout
-         */
-        sip_read_fds = read_fds;
-
-        // start off by init to zero
-        FD_ZERO(&sip_write_fds);
-        // now look for sockets where data has been queued up
-        for (i = 0; i < MAX_CONNECTIONS; i++) {
-            entry = sip_tcp_conn_tab + i;
-            if (-1 != entry->fd && entry->sendQueue && sll_count(entry->sendQueue)) {
-                FD_SET(entry->fd, &sip_write_fds);
-            }
-        }
-
-        pending_operations = cprSelect((nfds + 1),
-                                       &sip_read_fds,
-                                       &sip_write_fds,
-                                       NULL, NULL);
-        if (pending_operations == SOCKET_ERROR) {
-            CCSIP_DEBUG_ERROR(SIP_F_PREFIX"cprSelect() failed: errno=%d."
-                " Recover by initiating sip restart\n",
-                              fname, cpr_errno);
-            /*
-             * If we have come here, then either read socket related to
-             * sip_ipc_serv_socket has got corrupted, or one of the write
-             * socket related to cucm tcp/tls connection.
-             * We will recover, by first clearing all fds, then re-establishing
-             * the connection with sip-msgq by listening on
-             * sip_ipc_serv_socket.
-             */
-            sip_platform_task_init(); /* this clear FDs */
-            sip_platform_task_set_read_socket(sip_ipc_serv_socket);
-
-            /*
-             * Since all sockets fds have been cleared above, we can not anyway
-             * send or receive msg from cucm. So, there is no point
-             * trying to send registration cancel msg to cucm. Also, a
-             * call may be active, and in that case we do not want to
-             * un-register. So, by setting sip_reg_all_failed to true, we
-             * make sure that no registration cancelation attempt is made.
-             */
-            sip_reg_all_failed = TRUE;
-            platform_reset_req(DEVICE_RESTART);
-            continue;
-        } else if (pending_operations) {
-            /*
-             * Listen socket is set only if UDP transport has been
-             * configured. So see if the select return was for read
-             * on the listen socket.
-             */
-            if ((listen_socket != INVALID_SOCKET) &&
-                (sip.taskInited == TRUE) &&
-                FD_ISSET(listen_socket, &sip_read_fds)) {
-                sip_platform_udp_read_socket(listen_socket);
-                pending_operations--;
-            }
-
-            /*
-             * Check IPC for internal message queue
-             */
-            if (FD_ISSET(sip_ipc_serv_socket, &sip_read_fds)) {
-                /* read the message to flush the buffer */
-                sip_process_int_msg();
-                pending_operations--;
-            }
-
-            /*
-             * Check all sockets for stuff to do
-             */
-            for (i = 0; ((i < MAX_SIP_CONNECTIONS) &&
-                         (pending_operations > 0)); i++) {
-                if ((sip_conn.read[i] != INVALID_SOCKET) &&
-                    FD_ISSET(sip_conn.read[i], &sip_read_fds)) {
-                    /*
-                     * Assume tcp
-                     */
-                    sip_tcp_read_socket(sip_conn.read[i]);
-                    pending_operations--;
-                }
-                if ((sip_conn.write[i] != INVALID_SOCKET) &&
-                    FD_ISSET(sip_conn.write[i], &sip_write_fds)) {
-                    int connid;
-
-                    connid = sip_tcp_fd_to_connid(sip_conn.write[i]);
-                    if (connid >= 0) {
-                        sip_tcp_resend(connid);
-                    }
-                    pending_operations--;
-                }
-            }
-        }
-#endif
-    }
-}
-
-/**
- *
  * sip_platform_task_set_listen_socket
  *
  * Mark the socket for cpr_select to be read
  *
  * Parameters:   s - the socket
  *
  * Return Value: None
  *
--- a/media/webrtc/signaling/src/sipcc/core/src-common/misc_apps_task.c
+++ b/media/webrtc/signaling/src/sipcc/core/src-common/misc_apps_task.c
@@ -22,104 +22,23 @@
 
 cprMsgQueue_t s_misc_msg_queue;
 void destroy_misc_app_thread(void);
 extern cprThread_t misc_app_thread;
 
 cpr_status_e
 MiscAppTaskSendMsg (uint32_t cmd, cprBuffer_t buf, uint16_t len)
 {
-    phn_syshdr_t *syshdr_p;
-
-    syshdr_p = (phn_syshdr_t *) cprGetSysHeader(buf);
-    if (!syshdr_p)
-    {
-        return CPR_FAILURE;
-    }
-    syshdr_p->Cmd = cmd;
-    syshdr_p->Len = len;
-
-    if (cprSendMessage(s_misc_msg_queue, buf, (void **)&syshdr_p) == CPR_FAILURE)
-    {
-        cprReleaseSysHeader(syshdr_p);
-        return CPR_FAILURE;
-    }
+    /* Mozilla hack: just ignore everything that is posted here */
+    (void)cmd;
+    cpr_free(buf);
+    (void)len;
     return CPR_SUCCESS;
 }
 
-void MiscAppTask (void *arg)
-{
-    static const char fname[] = "MiscAppTask";
-    void *msg_p;
-    phn_syshdr_t *syshdr_p;
-
-    /*
-     * Get the misc apps message queue handle
-     */
-    s_misc_msg_queue  = (cprMsgQueue_t)arg;
-    if (!s_misc_msg_queue) {
-        MISC_ERROR(MISC_F_PREFIX"invalid input, exiting", fname);
-        return;
-    }
-
-    if (platThreadInit("MiscAppTask") != 0) {
-        MISC_ERROR(MISC_F_PREFIX"Failed to Initialize the thread, exiting",
-                fname);
-        return;
-    }
-
-    /*
-     * Create retry-after timers.
-     */
-    if (pres_create_retry_after_timers() == CPR_FAILURE) {
-        MISC_ERROR(MISC_F_PREFIX"failed to create retry-after Timers, exiting",
-               fname);
-        return;
-    }
-
-    while (1)
-    {
-        msg_p = cprGetMessage(s_misc_msg_queue, TRUE, (void **)&syshdr_p);
-        if (msg_p)
-        {
-            switch(syshdr_p->Cmd) {
-            case SUB_MSG_PRESENCE_SUBSCRIBE_RESP:
-            case SUB_MSG_PRESENCE_NOTIFY:
-            case SUB_MSG_PRESENCE_UNSOLICITED_NOTIFY:
-            case SUB_MSG_PRESENCE_TERMINATE:
-            case SUB_MSG_PRESENCE_GET_STATE:
-            case SUB_MSG_PRESENCE_TERM_REQ:
-            case SUB_MSG_PRESENCE_TERM_REQ_ALL:
-            case TIMER_EXPIRATION:
-            case SUB_HANDLER_INITIALIZED:
-                pres_process_msg_from_msgq(syshdr_p->Cmd, msg_p);
-                break;
-
-            case SUB_MSG_CONFIGAPP_SUBSCRIBE:
-            case SUB_MSG_CONFIGAPP_TERMINATE:
-            case SUB_MSG_CONFIGAPP_NOTIFY_ACK:
-                configapp_process_msg(syshdr_p->Cmd, msg_p);
-                break;
-
-            case THREAD_UNLOAD:
-                destroy_misc_app_thread();
-                break;
-
-            default:
-                MISC_ERROR(MISC_F_PREFIX"invalid msg <%d> received",
-                        fname, syshdr_p->Cmd);
-                break;
-            }
-
-            cprReleaseSysHeader(syshdr_p);
-            cpr_free(msg_p);
-        }
-    }
-}
-
 /**
  *
  * Perform cleaning up resoruces of misc. application task.
  *
  * @param none
  *
  * @return none
  *
--- a/media/webrtc/signaling/src/sipcc/cpr/android/cpr_android_init.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/android/cpr_android_init.c
@@ -118,21 +118,16 @@
 #include <errno.h>
 #ifndef ANDROID
 #include <sys/msg.h>
 #include <sys/ipc.h>
 #endif
 #include "plat_debug.h"
 
 /**
-  * Mutex to manage message queue list.
-  */
-extern pthread_mutex_t msgQueueListMutex;
-
-/**
   * Boolean to check that cprPreInit been called
   */
 static boolean pre_init_called = FALSE;
 
 /**
  * cprInfo prints out informational messages that are
  * not necessarily errors, but maybe of interest to
  * someone debugging a problem. Examples of this are
@@ -163,31 +158,18 @@ cprPreInit (void)
 
     /*
      * Make function reentreant
      */
     if (pre_init_called == TRUE) {
         return CPR_SUCCESS;
     }
     pre_init_called = TRUE;
-    /*
-     * Create message queue list mutex
-     */
-    returnCode = pthread_mutex_init(&msgQueueListMutex, NULL);
-    if (returnCode != 0) {
-        CPR_ERROR("%s: MsgQueue Mutex init failure %d\n", fname, returnCode);
-        return CPR_FAILURE;
-    }
-#ifdef CPR_TIMERS_ENABLED
-    returnCode = cpr_timer_pre_init();
-    if (returnCode != 0) {
-        CPR_ERROR("%s: timer pre init failed %d\n", fname, returnCode);
-        return CPR_FAILURE;
-    }
-#endif
+    (void)fname;
+    (void)returnCode;
     return CPR_SUCCESS;
 }
 
 
 /**
  * cprPostInit
  *
  * @brief The cprPostInit function IS called from pSIPCC @b after all the components are initialized.
--- a/media/webrtc/signaling/src/sipcc/cpr/android/cpr_android_threads.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/android/cpr_android_threads.c
@@ -4,17 +4,16 @@
 
 #include "cpr.h"
 #include "cpr_stdlib.h"
 #include "cpr_stdio.h"
 #include <pthread.h>
 #include <errno.h>
 #include <unistd.h>
 #include <sys/resource.h>
-#include "thread_monitor.h"
 #include "prtypes.h"
 #include "mozilla/Assertions.h"
 
 #define ANDROID_MIN_THREAD_PRIORITY (-20)	/* tbd: check MV linux: current val from Larry port */
 #define ANDROID_MAX_THREAD_PRIORITY (+19)	/* tbd: check MV linux. current val from Larry port */
 
 void CSFLogRegisterThread(const cprThread_t thread);
 
--- a/media/webrtc/signaling/src/sipcc/cpr/android/cpr_android_timers_using_select.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/android/cpr_android_timers_using_select.c
@@ -1223,83 +1223,13 @@ cprRC_t start_timer_service_loop (void)
  *
  * Process the timers expired. Generally this is called when head timer
  * has expired.
  * @note we need to process the list as there could be
  * other timers too in the list which have expired.
  *
  */
 void process_expired_timers() {
-    static const char fname[] = "process_expired_timer";
-    cprCallBackTimerMsg_t *timerMsg;
-    void *syshdr;
-    boolean processingTimers;
-
-    /* nothing to do if no timers running */
-    if (timerListHead == NULL) {
-        return;
-    }
-
-    /* nothing to do if head has not expired */
-    if (timerListHead->duration > 0) {
-        return;
-    }
-
-
-    /* There are one or more expired timers on the list */
-    processingTimers = TRUE;
-    while (processingTimers) {
-        if (timerListHead != NULL) {
-            /*
-             * Send msg to queue to indicate this timer has expired
-             */
-            if (timerListHead->duration <= 0) {
-                timerMsg = (cprCallBackTimerMsg_t *)
-                    cpr_malloc(sizeof(cprCallBackTimerMsg_t));
-                if (timerMsg) {
-                    timerMsg->expiredTimerName =
-                        timerListHead->cprTimerPtr->name;
-                    //CPR_INFO("%s: timer %s expired..\n",fname,
-                    //       timerMsg->expiredTimerName);
-
-                    timerMsg->expiredTimerId =
-                        timerListHead->cprTimerPtr->applicationTimerId;
-                    timerMsg->usrData =
-                        timerListHead->cprTimerPtr->data;
-                    syshdr = cprGetSysHeader(timerMsg);
-                    if (syshdr) {
-                        fillInSysHeader(syshdr,
-                                        timerListHead->cprTimerPtr->applicationMsgId,
-                                        sizeof(cprCallBackTimerMsg_t), timerMsg);
-                        if (cprSendMessage(timerListHead->cprTimerPtr->callBackMsgQueue,
-                                           timerMsg, (void **) &syshdr) == CPR_FAILURE) {
-                            cprReleaseSysHeader(syshdr);
-                            cpr_free(timerMsg);
-                            CPR_ERROR("%s - Call to cprSendMessage failed\n", fname);
-                            CPR_ERROR("%s - Unable to send timer %s expiration msg\n",
-                                      fname, timerListHead->cprTimerPtr->name);
-                        }
-                    } else {
-                        cpr_free(timerMsg);
-                        CPR_ERROR("%s - Call to cprGetSysHeader failed\n", fname);
-                        CPR_ERROR("%s - Unable to send timer %s expiration msg\n",
-                                  fname, timerListHead->cprTimerPtr->name);
-                    }
-                } else {
-                    CPR_ERROR("%s - Call to cpr_malloc failed\n", fname);
-                    CPR_ERROR("%s - Unable to send timer %s expiration msg\n",
-                              fname, timerListHead->cprTimerPtr->name);
-                }
-                (void) removeTimer(timerListHead->cprTimerPtr);
-            } else {
-                /* The rest of the timers on the list have not yet expired */
-                processingTimers = FALSE;
-            }
-        } else {
-            /* The timer list is now empty */
-            processingTimers = FALSE;
-        }
-    } /* still more to process */
 }
 
 /**
   * @}
   */
--- a/media/webrtc/signaling/src/sipcc/cpr/common/cpr_ipc.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/common/cpr_ipc.c
@@ -3,54 +3,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "cpr.h"
 #include "cpr_stdlib.h"
 #include "cpr_stdio.h"
 #include "plat_api.h"
 #include "cpr_string.h"
 
-#ifdef SIP_OS_WINDOWS
-#include <windows.h>
-#include <process.h>
-#include <winuser.h>
-#else
 #include <errno.h>
-#include <sys/time.h>
-#include <time.h>
-#endif /* SIP_OS_WINDOWS */
-
-
-#ifdef SIP_OS_WINDOWS
-extern cprMsgQueue_t sip_msgq;
-extern cprMsgQueue_t gsm_msgq;
-extern cprMsgQueue_t tmr_msgq;
-
-extern void gsm_shutdown();
-extern void sip_shutdown();
-
-/*
- * Buffer to hold the messages sent/received by CPR. All
- * CPR does is pass four bytes (CNU msg type) and an unsigned
- * four bytes (pointer to the msg buffer).
- */
-static char rcvBuffer[100];
-#define MSG_BUF 0xF000
-
-#else
 
 #define OS_MSGTQL 31 /* need to check number for MV linux and put here */
 
 /*
- * Internal CPR API
- */
-extern pthread_t cprGetThreadId(cprThread_t thread);
-
-
-/*
  * Extended internal message queue node
  *
  * A double-linked list holding the nessasary message information
  */
 typedef struct cpr_msgq_node_s
 {
     struct cpr_msgq_node_s *next;
     struct cpr_msgq_node_s *prev;
@@ -70,28 +37,25 @@ typedef struct cpr_msgq_node_s
  * Note:if the depth supplied by OS is insufficient,a message queue owner may
  * increase the message queue depth via cprCreateMessageQueue's depth
  * parameter where the value can range from MSGTQL to CPR_MAX_MSG_Q_DEPTH.
  */
 typedef struct cpr_msg_queue_s
 {
     struct cpr_msg_queue_s *next;
     const char *name;
-    pthread_t thread;
     int32_t queueId;
     uint16_t currentCount;
     uint32_t totalCount;
     uint32_t sendErrors;
     uint32_t reTries;
     uint32_t highAttempts;
     uint32_t selfQErrors;
     uint16_t extendedQDepth;
     uint16_t maxExtendedQDepth;
-    pthread_mutex_t mutex;       /* lock for managing extended queue     */
-    pthread_cond_t cond;         /* signal for queue/dequeue */
     cpr_msgq_node_t *head;       /* extended queue head (newest element) */
     cpr_msgq_node_t *tail;       /* extended queue tail (oldest element) */
 } cpr_msg_queue_t;
 
 /*
  * A enumeration used to report the result of posting a message to
  * a message queue
  */
@@ -103,20 +67,16 @@ typedef enum
 } cpr_msgq_post_result_e;
 
 
 /*
  * Head of list of message queues
  */
 static cpr_msg_queue_t *msgQueueList = NULL;
 
-/*
- * Mutex to manage message queue list
- */
-pthread_mutex_t msgQueueListMutex;
 
 /*
  * CPR_MAX_MSG_Q_DEPTH
  *
  * The maximum queue depth supported by the CPR layer.  This value
  * is arbitrary though the purpose is to limit the memory usage
  * by CPR and avoid (nearly) unbounded situations.
  *
@@ -206,18 +166,16 @@ cprPostMessage (cpr_msg_queue_t *msgq, v
      * Allocate new message queue node
      */
     node = cpr_malloc(sizeof(*node));
     if (!node) {
         errno = ENOMEM;
         return CPR_MSGQ_POST_FAILED;
     }
 
-    pthread_mutex_lock(&msgq->mutex);
-
     /*
      * Fill in data
      */
     node->msg = msg;
     if (ppUserData != NULL) {
         node->pUserData = *ppUserData;
     } else {
         node->pUserData = NULL;
@@ -234,450 +192,55 @@ cprPostMessage (cpr_msg_queue_t *msgq, v
         node->next->prev = node;
     }
 
     if (msgq->tail == NULL) {
         msgq->tail = node;
     }
     msgq->currentCount++;
 
-    pthread_cond_signal(&msgq->cond);
-    pthread_mutex_unlock(&msgq->mutex);
-
     return CPR_MSGQ_POST_SUCCESS;
 
 }
-#endif /* !SIP_OS_WINDOWS */
 
 /*
  * Functions
  */
 
 /**
- * Creates a message queue
- *
- * @param name  - name of the message queue
- * @param depth - the message queue depth, optional field which will
- *                default if set to zero(0).  This parameter is currently
- *                not supported on Windows.
- *
- * @return Msg queue handle or NULL if init failed, errno provided
- *
- * @note the actual message queue depth will be bounded by the
- *       standard system message queue depth and CPR_MAX_MSG_Q_DEPTH.
- *       If 'depth' is outside of the bounds, the value will be
- *       reset automatically.
- */
-cprMsgQueue_t
-cprCreateMessageQueue (const char *name, uint16_t depth)
-{
-    cpr_msg_queue_t *msgq;
-
-#ifndef SIP_OS_WINDOWS
-    static int key_id = 100; /* arbitrary starting number */
-    pthread_cond_t _cond = PTHREAD_COND_INITIALIZER;
-    pthread_mutex_t _lock = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
-    msgq = cpr_calloc(1, sizeof(cpr_msg_queue_t));
-    if (msgq == NULL) {
-        printf("%s: Malloc failed: %s\n", __FUNCTION__,
-               name ? name : "unnamed");
-        errno = ENOMEM;
-        return NULL;
-    }
-
-    msgq->name = name ? name : "unnamed";
-
-#ifndef SIP_OS_WINDOWS
-    msgq->queueId = key_id++;
-    msgq->cond = _cond;
-    msgq->mutex = _lock;
-
-    /*
-     * Add message queue to list for statistics reporting
-     */
-    pthread_mutex_lock(&msgQueueListMutex);
-    msgq->next = msgQueueList;
-    msgQueueList = msgq;
-    pthread_mutex_unlock(&msgQueueListMutex);
-#endif /* SIP_OS_WINDOWS */
-
-    return msgq;
-}
-
-
-
-/**
- * Associate a thread with the message queue
- *
- * @param msgQueue  - msg queue to set
- * @param thread    - CPR thread to associate with queue
- *
- * @return CPR_SUCCESS or CPR_FAILURE
- *
- * @note Nothing is done to prevent overwriting the thread ID
- *       when the value has already been set.
- */
-cprRC_t
-cprSetMessageQueueThread (cprMsgQueue_t msgQueue, cprThread_t thread)
-{
-    cpr_msg_queue_t *msgq;
-
-    if ((!msgQueue) || (!thread)) {
-        CPR_ERROR("%s: Invalid input\n", __FUNCTION__);
-        return CPR_FAILURE;
-    }
-
-#ifdef SIP_OS_WINDOWS
-    ((cpr_msg_queue_t *)msgQueue)->handlePtr = thread;
-#else
-    msgq = (cpr_msg_queue_t *) msgQueue;
-    if (msgq->thread != 0) {
-        CPR_ERROR("%s: over-writing previously msgq thread name for %s",
-                  __FUNCTION__, msgq->name);
-    }
-
-    msgq->thread = cprGetThreadId(thread);
-#endif /* SIP_OS_WINDOWS */
-
-    return CPR_SUCCESS;
-}
-
-
-/**
  * Retrieve a message from a particular message queue
  *
  * @param[in]  msgQueue    - msg queue from which to retrieve the message
  * @param[in]  waitForever - boolean to either wait forever (TRUE) or not
  *                           wait at all (FALSE) if the msg queue is empty.
  * @param[out] ppUserData  - pointer to a pointer to user defined data
  *
  * @return Retrieved message buffer or NULL if failure occurred or
  *         the waitForever flag was set to false and no messages were
  *         on the queue.
  *
  * @note   If ppUserData is defined, the value will be initialized to NULL
  */
 void *
 cprGetMessage (cprMsgQueue_t msgQueue, boolean waitForever, void **ppUserData)
 {
-    void *buffer = NULL;
-
-#ifdef SIP_OS_WINDOWS
-    struct msgbuffer *rcvMsg = (struct msgbuffer *)rcvBuffer;
-    cpr_msg_queue_t *pCprMsgQueue;
-    MSG msg;
-    cpr_thread_t *pThreadPtr;
-#else
-    cpr_msg_queue_t *msgq = (cpr_msg_queue_t *) msgQueue;
-    cpr_msgq_node_t *node;
-    struct timespec timeout;
-    struct timeval tv;
-    struct timezone tz;
-#endif
-
-    if (!msgQueue) {
-        CPR_ERROR("%s - invalid msgQueue\n", __FUNCTION__);
-        return NULL;
-    }
-
-    /* Initialize ppUserData */
-    if (ppUserData) {
-        *ppUserData = NULL;
-    }
-
-#ifdef SIP_OS_WINDOWS
-    pCprMsgQueue = (cpr_msg_queue_t *)msgQueue;
-    memset(&msg, 0, sizeof(MSG));
-
-    if (waitForever == TRUE) {
-        if (GetMessage(&msg, NULL, 0, 0) == -1) {
-            CPR_ERROR("%s - msgQueue = %x failed: %d\n",
-                      __FUNCTION__, msgQueue, GetLastError());
-            return NULL;
-        }
-    } else {
-        if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) == 0) {
-            /* no message present */
-            return NULL;
-        }
-    }
-
-    switch (msg.message) {
-        case WM_CLOSE:
-            if (msgQueue == &gsm_msgq)
-            {
-                CPR_ERROR("%s - WM_CLOSE GSM msg queue\n", __FUNCTION__);
-                gsm_shutdown();
-            }
-            else if (msgQueue == &sip_msgq)
-            {
-                CPR_ERROR("%s - WM_CLOSE SIP msg queue\n", __FUNCTION__);
-                sip_regmgr_destroy_cc_conns();
-                sip_shutdown();
-            }
-            else if (msgQueue == &tmr_msgq)
-            {
-                CPR_ERROR("%s - WM_CLOSE TMR msg queue\n", __FUNCTION__);
-            }
-
-            pThreadPtr=(cpr_thread_t *)pCprMsgQueue->handlePtr;
-            if (pThreadPtr)
-            {
-                CloseHandle(pThreadPtr->u.handlePtr);
-            }
-            /* zap the thread ptr, since the thread is going away now */
-            pCprMsgQueue->handlePtr = NULL;
-            _endthreadex(0);
-            break;
-        case MSG_BUF:
-            rcvMsg = (struct msgbuffer *)msg.wParam;
-            buffer = rcvMsg->msgPtr;
-            if (ppUserData) {
-                *ppUserData = rcvMsg->usrPtr;
-            }
-            cpr_free((void *)msg.wParam);
-            break;
-        case MSG_ECHO_EVENT:
-            {
-                HANDLE event;
-                event = (HANDLE*)msg.wParam;
-                SetEvent( event );
-            }
-            break;
-        case WM_TIMER:
-            DispatchMessage(&msg);
-            return NULL;
-            break;
-        default:
-            break;
-    }
-#else
-    /*
-     * If waitForever is set, block on the message queue
-     * until a message is received, else return after
-     * 25msec of waiting
-     */
-    pthread_mutex_lock(&msgq->mutex);
-
-    if (!waitForever)
-    {
-        // We'll wait till 25uSec from now
-        gettimeofday(&tv, &tz);
-        timeout.tv_nsec = (tv.tv_usec * 1000) + 25000;
-        timeout.tv_sec = tv.tv_sec;
-
-        pthread_cond_timedwait(&msgq->cond, &msgq->mutex, &timeout);
-    }
-    else
-    {
-        while(msgq->tail==NULL)
-        {
-            pthread_cond_wait(&msgq->cond, &msgq->mutex);
-        }
-    }
-
-    // If there is a message on the queue, de-queue it
-    if (msgq->tail)
-    {
-        node = msgq->tail;
-        msgq->tail = node->prev;
-        if (msgq->tail) {
-            msgq->tail->next = NULL;
-        }
-        if (msgq->head == node) {
-            msgq->head = NULL;
-        }
-        msgq->currentCount--;
-        /*
-         * Pull out the data
-         */
-        if (ppUserData) {
-            *ppUserData = node->pUserData;
-        }
-        buffer = node->msg;
-
-    }
-
-    pthread_mutex_unlock(&msgq->mutex);
-#endif /* SIP_OS_WINDOWS */
-
-    return buffer;
+    return NULL;
 }
 
-
-/**
- * Place a message on a particular queue.  Note that caller may
- * block (see comments below)
- *
- * @param msgQueue   - msg queue on which to place the message
- * @param msg        - pointer to the msg to place on the queue
- * @param ppUserData - pointer to a pointer to user defined data
- *
- * @return CPR_SUCCESS or CPR_FAILURE, errno provided
- *
- * @note 1. Messages queues are set to be non-blocking, those cases
- *       where the system call fails with a would-block error code
- *       (EAGAIN) the function will attempt other mechanisms described
- *       below.
- * @note 2. If enabled with an extended message queue, either via a
- *       call to cprCreateMessageQueue with depth value or a call to
- *       cprSetExtendMessageQueueDepth() (when unit testing), the message
- *       will be added to the extended message queue and the call will
- *       return successfully.  When room becomes available on the
- *       system's message queue, those messages will be added.
- * @note 3. If the message queue becomes full and no space is availabe
- *       on the extended message queue, then the function will attempt
- *       to resend the message up to CPR_ATTEMPTS_TO_SEND and the
- *       calling thread will *BLOCK* CPR_SND_TIMEOUT_WAIT_INTERVAL
- *       milliseconds after each failed attempt.  If unsuccessful
- *       after all attempts then EGAIN error code is returned.
- * @note 4. This applies to all CPR threads, including the timer thread.
- *       So it is possible that the timer thread would be forced to
- *       sleep which would have the effect of delaying all active
- *       timers.  The work to fix this rare situation is not considered
- *       worth the effort to fix....so just leaving as is.
- */
-cprRC_t
-cprSendMessage (cprMsgQueue_t msgQueue, void *msg, void **ppUserData)
-{
-#ifdef SIP_OS_WINDOWS
-    struct msgbuffer *sendMsg;
-    cpr_thread_t *pCprThread;
-    HANDLE *hThread;
-#else
-    static const char error_str[] = "%s: Msg not sent to %s queue: %s\n";
-    cpr_msgq_post_result_e rc;
-    cpr_msg_queue_t *msgq = (cpr_msg_queue_t *) msgQueue;
-    int16_t attemptsToSend = CPR_ATTEMPTS_TO_SEND;
-    uint16_t numAttempts   = 0;
-#endif
-
-    if (!msgQueue) {
-        CPR_ERROR("%s - msgQueue is NULL\n", __FUNCTION__);
-        return CPR_FAILURE;
-    }
-
-#ifdef SIP_OS_WINDOWS
-    pCprThread = (cpr_thread_t *)(((cpr_msg_queue_t *)msgQueue)->handlePtr);
-    if (!pCprThread) {
-        CPR_ERROR("%s - msgQueue(%x) not associated with a thread\n",
-                  __FUNCTION__, msgQueue);
-        return CPR_FAILURE;
-    }
-
-    hThread = (HANDLE*)(pCprThread->u.handlePtr);
-    if (!hThread) {
-        CPR_ERROR("%s - msgQueue(%x)'s thread(%x) not assoc. with Windows\n",
-                __FUNCTION__, msgQueue, pCprThread);
-        return CPR_FAILURE;
-    }
-
-    /* Package up the message */
-    sendMsg = (struct msgbuffer *)cpr_calloc(1, sizeof(struct msgbuffer));
-    if (!sendMsg) {
-        CPR_ERROR("%s - No memory\n", __FUNCTION__);
-        return CPR_FAILURE;
-    }
-    sendMsg->mtype = PHONE_IPC_MSG;
-
-    /* Save the address of the message */
-    sendMsg->msgPtr = msg;
-
-    /* Allow the ppUserData to be optional */
-    if (ppUserData) {
-        sendMsg->usrPtr = *ppUserData;
-    }
-
-    /* Post the message */
-    if (hThread == NULL || PostThreadMessage(pCprThread->threadId, MSG_BUF,
-        (WPARAM)sendMsg, 0) == 0 ) {
-        CPR_ERROR("%s - Msg not sent: %d\n", __FUNCTION__, GetLastError());
-        cpr_free(sendMsg);
-        return CPR_FAILURE;
-    }
-    return CPR_SUCCESS;
-
-#else
-    /*
-     * Attempt to send message
-     */
-    do {
-
-        /*
-         * Post the message to the Queue
-         */
-        rc = cprPostMessage(msgq, msg, ppUserData);
-
-        if (rc == CPR_MSGQ_POST_SUCCESS) {
-            cprPegSendMessageStats(msgq, numAttempts);
-            return CPR_SUCCESS;
-        } else if (rc == CPR_MSGQ_POST_FAILED) {
-            CPR_ERROR("%s: Msg not sent to %s queue: %d\n",
-                      __FUNCTION__, msgq->name, errno);
-            msgq->sendErrors++;
-            /*
-             * If posting to calling thread's own queue,
-             * then peg the self queue error.
-             */
-            if (pthread_self() == msgq->thread) {
-                msgq->selfQErrors++;
-            }
-
-            return CPR_FAILURE;
-        }
-
-
-        /*
-         * Did not succeed in sending the message, so continue
-         * to attempt up to the CPR_ATTEMPTS_TO_SEND.
-         */
-        attemptsToSend--;
-        if (attemptsToSend > 0) {
-            /*
-             * Force a context-switch of the thread attempting to
-             * send the message, in order to help the case where
-             * the msg queue is full and the owning thread may get
-             * a a chance be scheduled so it can drain it (Note:
-             * no guarantees, more of a "last-ditch effort" to
-             * recover...especially when temporarily over-whelmed).
-             */
-            cprSleep(CPR_SND_TIMEOUT_WAIT_INTERVAL);
-            msgq->reTries++;
-            numAttempts++;
-        }
-    } while (attemptsToSend > 0);
-
-    CPR_ERROR(error_str, __FUNCTION__, msgq->name, "FULL");
-    msgq->sendErrors++;
-    return CPR_FAILURE;
-#endif /* SIP_OS_WINDOWS */
-}
-
-
-
 /**
  * cprGetDepth
  *
  * @brief get depth of a message queue
  *
  * The pSIPCC uses this API to look at the depth of a message queue for internal
  * routing and throttling decision
  *
  * @param[in] msgQueue - message queue
  *
  * @return depth of msgQueue
  *
  * @pre (msgQueue not_eq NULL)
  */
 uint16_t cprGetDepth (cprMsgQueue_t msgQueue)
 {
-#ifdef SIP_OS_WINDOWS
     return 0;
-#else
-    cpr_msg_queue_t *msgq;
-    msgq = (cpr_msg_queue_t *) msgQueue;
-    return msgq->currentCount;
-#endif /* SIP_OS_WINDOWS */
 }
 
-
--- a/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_init.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_init.c
@@ -111,21 +111,16 @@
 #include "plat_api.h"
 #include "plat_debug.h"
 
 #include <errno.h>
 #include <sys/msg.h>
 #include <sys/ipc.h>
 
 /**
-  * Mutex to manage message queue list.
-  */
-extern pthread_mutex_t msgQueueListMutex;
-
-/**
   * Boolean to check that cprPreInit been called
   */
 static boolean pre_init_called = FALSE;
 
 /**
  * cprInfo prints out informational messages that are
  * not necessarily errors, but maybe of interest to
  * someone debugging a problem. Examples of this are
@@ -157,31 +152,18 @@ cprPreInit (void)
     /*
      * Make function reentreant
      */
     if (pre_init_called == TRUE) {
         return CPR_SUCCESS;
     }
     pre_init_called = TRUE;
 
-    /*
-     * Create message queue list mutex
-     */
-    returnCode = pthread_mutex_init(&msgQueueListMutex, NULL);
-    if (returnCode != 0) {
-        CPR_ERROR("%s: MsgQueue Mutex init failure %d\n", fname, returnCode);
-        return CPR_FAILURE;
-    }
-#ifdef CPR_TIMERS_ENABLED
-    returnCode = cpr_timer_pre_init();
-    if (returnCode != 0) {
-        CPR_ERROR("%s: timer pre init failed %d\n", fname, returnCode);
-        return CPR_FAILURE;
-    }
-#endif
+    (void)fname;
+    (void)returnCode;
     return CPR_SUCCESS;
 }
 
 
 /**
  * cprPostInit
  *
  * @brief The cprPostInit function IS called from pSIPCC @b after all the components are initialized.
--- a/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_threads.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_threads.c
@@ -4,17 +4,16 @@
 
 #include "cpr.h"
 #include "cpr_stdlib.h"
 #include "cpr_stdio.h"
 #include <pthread.h>
 #include <errno.h>
 #include <unistd.h>
 #include <sys/resource.h>
-#include "thread_monitor.h"
 #include "prtypes.h"
 #include "mozilla/Assertions.h"
 
 
 #define LINUX_MIN_THREAD_PRIORITY (-20)	/* tbd: check MV linux: current val from Larry port */
 #define LINUX_MAX_THREAD_PRIORITY (+19)	/* tbd: check MV linux. current val from Larry port */
 
 void CSFLogRegisterThread(const cprThread_t thread);
--- a/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_timers_using_select.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_timers_using_select.c
@@ -1231,80 +1231,10 @@ cprRC_t start_timer_service_loop (void)
  *
  * Process the timers expired. Generally this is called when head timer
  * has expired.
  * @note we need to process the list as there could be
  * other timers too in the list which have expired.
  *
  */
 void process_expired_timers() {
-    static const char fname[] = "process_expired_timer";
-    cprCallBackTimerMsg_t *timerMsg;
-    void *syshdr;
-    boolean processingTimers;
-
-    /* nothing to do if no timers running */
-    if (timerListHead == NULL) {
-        return;
-    }
-
-    /* nothing to do if head has not expired */
-    if (timerListHead->duration > 0) {
-        return;
-    }
-
-
-    /* There are one or more expired timers on the list */
-    processingTimers = TRUE;
-    while (processingTimers) {
-        if (timerListHead != NULL) {
-            /*
-             * Send msg to queue to indicate this timer has expired
-             */
-            if (timerListHead->duration <= 0) {
-                timerMsg = (cprCallBackTimerMsg_t *)
-                    cpr_malloc(sizeof(cprCallBackTimerMsg_t));
-                if (timerMsg) {
-                    timerMsg->expiredTimerName =
-                        timerListHead->cprTimerPtr->name;
-                    //CPR_INFO("%s: timer %s expired..\n",fname,
-                    //       timerMsg->expiredTimerName);
-
-                    timerMsg->expiredTimerId =
-                        timerListHead->cprTimerPtr->applicationTimerId;
-                    timerMsg->usrData =
-                        timerListHead->cprTimerPtr->data;
-                    syshdr = cprGetSysHeader(timerMsg);
-                    if (syshdr) {
-                        fillInSysHeader(syshdr,
-                                        timerListHead->cprTimerPtr->applicationMsgId,
-                                        sizeof(cprCallBackTimerMsg_t), timerMsg);
-                        if (cprSendMessage(timerListHead->cprTimerPtr->callBackMsgQueue,
-                                           timerMsg, (void **) &syshdr) == CPR_FAILURE) {
-                            cprReleaseSysHeader(syshdr);
-                            cpr_free(timerMsg);
-                            CPR_ERROR("%s - Call to cprSendMessage failed\n", fname);
-                            CPR_ERROR("%s - Unable to send timer %s expiration msg\n",
-                                      fname, timerListHead->cprTimerPtr->name);
-                        }
-                    } else {
-                        cpr_free(timerMsg);
-                        CPR_ERROR("%s - Call to cprGetSysHeader failed\n", fname);
-                        CPR_ERROR("%s - Unable to send timer %s expiration msg\n",
-                                  fname, timerListHead->cprTimerPtr->name);
-                    }
-                } else {
-                    CPR_ERROR("%s - Call to cpr_malloc failed\n", fname);
-                    CPR_ERROR("%s - Unable to send timer %s expiration msg\n",
-                              fname, timerListHead->cprTimerPtr->name);
-                }
-                (void) removeTimer(timerListHead->cprTimerPtr);
-            } else {
-                /* The rest of the timers on the list have not yet expired */
-                processingTimers = FALSE;
-            }
-        } else {
-            /* The timer list is now empty */
-            processingTimers = FALSE;
-        }
-    } /* still more to process */
 }
 
--- a/media/webrtc/signaling/src/sipcc/cpr/include/cpr_ipc.h
+++ b/media/webrtc/signaling/src/sipcc/cpr/include/cpr_ipc.h
@@ -3,20 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef _CPR_IPC_H_
 #define _CPR_IPC_H_
 
 #include "cpr_types.h"
 #include "cpr_threads.h"
 
-#ifndef SIP_OS_WINDOWS
-#include <pthread.h>
-#endif /* !SIP_OS_WINDOWS */
-
 __BEGIN_DECLS
 
 /**
  * Define handle for message queues
  */
 typedef void* cprMsgQueue_t;
 
 /*
@@ -27,86 +23,17 @@ typedef void* cprMsgQueue_t;
 #define WAIT_FOREVER -1
 
 /* Enable support for cprSetMessageQueueThread API */
 #define CPR_USE_SET_MESSAGE_QUEUE_THREAD
 
 /* Maximum message size allowed by CNU */
 #define CPR_MAX_MSG_SIZE  8192
 
-/* Our CNU msgtype */
-#ifdef SIP_OS_WINDOWS
-#define PHONE_IPC_MSG 0xF005
-
-/* Msg buffer layout */
-struct msgbuffer {
-    int32_t mtype; /* Message type */
-    void *msgPtr;  /* Ptr to msg */
-    void *usrPtr;  /* Ptr to user data */
-};
-
-#else
-#define PHONE_IPC_MSG 1
-
-/*
- * Mutex for updating the message queue list
- */
-extern pthread_mutex_t msgQueueListMutex;
-
-#endif /* SIP_OS_WINDOWS */
-
 /* Function prototypes */
-/**
- * Creates a message queue
- *
- * @brief The cprCreateMessageQueue function is called to allow the OS to
- * perform whatever work is needed to create a message queue.
-
- * If the name is present, CPR should assign this name to the message queue to assist in
- * debugging. The message queue depth is the second input parameter and is for
- * setting the desired queue depth. This parameter may not be supported by all OS.
- * Its primary intention is to set queue depth beyond the default queue depth
- * limitation.
- * On any OS where there is no limit on the message queue depth or
- * its queue depth is sufficiently large then this parameter is ignored on that
- * OS.
- *
- * @param[in] name  - name of the message queue (optional)
- * @param[in] depth - the message queue depth, optional field which should
- *                default if set to zero(0)
- *
- * @return Msg queue handle or NULL if init failed, errno should be provided
- *
- * @note the actual message queue depth will be bounded by the
- *       standard system message queue depth and CPR_MAX_MSG_Q_DEPTH.
- *       If 'depth' is outside of the bounds, the value will be
- *       reset automatically.
- */
-cprMsgQueue_t
-cprCreateMessageQueue(const char *name, uint16_t depth);
-
-
-#ifdef CPR_USE_SET_MESSAGE_QUEUE_THREAD
-/**
-  * cprSetMessageQueueThread
- * @brief Associate a thread with the message queue
- *
- * This method is used by pSIPCC to associate a thread and a message queue.
- * @param[in] msgQueue  - msg queue to set
- * @param[in] thread    - CPR thread to associate with queue
- *
- * @return CPR_SUCCESS or CPR_FAILURE
- *
- * @note Nothing is done to prevent overwriting the thread ID
- *       when the value has already been set.
- */
-cprRC_t
-cprSetMessageQueueThread(cprMsgQueue_t msgQueue, cprThread_t thread);
-#endif
-
 
 /**
   * cprGetMessage
  * @brief Retrieve a message from a particular message queue
  *
  * The cprGetMessage function retrieves the first message from the message queue
  * specified and returns a void pointer to that message.
  *
@@ -124,54 +51,16 @@ cprSetMessageQueueThread(cprMsgQueue_t m
  * @note   If ppUserData is defined, the value will be initialized to NULL
  */
 void *
 cprGetMessage(cprMsgQueue_t msgQueue,
               boolean waitForever,
               void** usrPtr);
 
 /**
-  * cprSendMessage
- * @brief Place a message on a particular queue.  Note that caller may
- * block (see comments below)
- *
- * @param[in] msgQueue   - msg queue on which to place the message
- * @param[in] msg        - pointer to the msg to place on the queue
- * @param[in] ppUserData - pointer to a pointer to user defined data
- *
- * @return CPR_SUCCESS or CPR_FAILURE, errno should be provided
- *
- * @note 1. Messages queues are set to be non-blocking, those cases
- *       where the system call fails with a would-block error code
- *       (EAGAIN) the function will attempt other mechanisms described
- *       below.
- * @note 2. If enabled with an extended message queue, either via a
- *       call to cprCreateMessageQueue with depth value or a call to
- *       cprSetExtendMessageQueueDepth() (when unit testing), the message
- *       will be added to the extended message queue and the call will
- *       return successfully.  When room becomes available on the
- *       system's message queue, those messages will be added.
- * @note 3. If the message queue becomes full and no space is availabe
- *       on the extended message queue, then the function will attempt
- *       to resend the message up to CPR_ATTEMPTS_TO_SEND and the
- *       calling thread will *BLOCK* CPR_SND_TIMEOUT_WAIT_INTERVAL
- *       milliseconds after each failed attempt.  If unsuccessful
- *       after all attempts then EGAIN error code is returned.
- * @note 4. This applies to all CPR threads, including the timer thread.
- *       So it is possible that the timer thread would be forced to
- *       sleep which would have the effect of delaying all active
- *       timers.  The work to fix this rare situation is not considered
- *       worth the effort to fix....so just leaving as is.
- */
-cprRC_t
-cprSendMessage(cprMsgQueue_t msgQueue,
-               void* msg,
-               void** usrPtr);
-
-/**
  * cprGetDepth
  *
  * Get depth of a message queue
  */
 uint16_t cprGetDepth(cprMsgQueue_t msgQueue);
 
 __END_DECLS
 
--- a/media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_init.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_init.c
@@ -121,21 +121,16 @@
 #include <linux/ipc.h>
 #else
 #include <sys/msg.h>
 #include <sys/ipc.h>
 #endif
 #include "plat_debug.h"
 
 /**
-  * Mutex to manage message queue list.
-  */
-extern pthread_mutex_t msgQueueListMutex;
-
-/**
   * Boolean to check that cprPreInit been called
   */
 static boolean pre_init_called = FALSE;
 
 /**
  * cprInfo prints out informational messages that are
  * not necessarily errors, but maybe of interest to
  * someone debugging a problem. Examples of this are
@@ -166,31 +161,18 @@ cprPreInit (void)
 
     /*
      * Make function reentreant
      */
     if (pre_init_called == TRUE) {
         return CPR_SUCCESS;
     }
     pre_init_called = TRUE;
-    /*
-     * Create message queue list mutex
-     */
-    returnCode = pthread_mutex_init(&msgQueueListMutex, NULL);
-    if (returnCode != 0) {
-        CPR_ERROR("%s: MsgQueue Mutex init failure %d\n", fname, returnCode);
-        return CPR_FAILURE;
-    }
-#if CPR_TIMERS_ENABLED
-    returnCode = cpr_timer_pre_init();
-    if (returnCode != 0) {
-        CPR_ERROR("%s: timer pre init failed %d\n", fname, returnCode);
-        return CPR_FAILURE;
-    }
-#endif
+    (void)fname;
+    (void)returnCode;
     return CPR_SUCCESS;
 }
 
 
 /**
  * cprPostInit
  *
  * @brief The cprPostInit function IS called from pSIPCC @b after all the components are initialized.
--- a/media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_threads.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_threads.c
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "cpr.h"
 #include "cpr_stdlib.h"
 #include "cpr_stdio.h"
-#include "thread_monitor.h"
 #include "prtypes.h"
 #include "mozilla/Assertions.h"
 #include <pthread.h>
 #include <errno.h>
 #include <unistd.h>
 #include <sys/resource.h>
 
 #define LINUX_MIN_THREAD_PRIORITY (-20)	/* tbd: check MV linux: current val from Larry port */
--- a/media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_timers_using_select.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/linux/cpr_linux_timers_using_select.c
@@ -1223,83 +1223,13 @@ cprRC_t start_timer_service_loop (void)
  *
  * Process the timers expired. Generally this is called when head timer
  * has expired.
  * @note we need to process the list as there could be
  * other timers too in the list which have expired.
  *
  */
 void process_expired_timers() {
-    static const char fname[] = "process_expired_timer";
-    cprCallBackTimerMsg_t *timerMsg;
-    void *syshdr;
-    boolean processingTimers;
-
-    /* nothing to do if no timers running */
-    if (timerListHead == NULL) {
-        return;
-    }
-
-    /* nothing to do if head has not expired */
-    if (timerListHead->duration > 0) {
-        return;
-    }
-
-
-    /* There are one or more expired timers on the list */
-    processingTimers = TRUE;
-    while (processingTimers) {
-        if (timerListHead != NULL) {
-            /*
-             * Send msg to queue to indicate this timer has expired
-             */
-            if (timerListHead->duration <= 0) {
-                timerMsg = (cprCallBackTimerMsg_t *)
-                    cpr_malloc(sizeof(cprCallBackTimerMsg_t));
-                if (timerMsg) {
-                    timerMsg->expiredTimerName =
-                        timerListHead->cprTimerPtr->name;
-                    //CPR_INFO("%s: timer %s expired..\n",fname,
-                    //       timerMsg->expiredTimerName);
-
-                    timerMsg->expiredTimerId =
-                        timerListHead->cprTimerPtr->applicationTimerId;
-                    timerMsg->usrData =
-                        timerListHead->cprTimerPtr->data;
-                    syshdr = cprGetSysHeader(timerMsg);
-                    if (syshdr) {
-                        fillInSysHeader(syshdr,
-                                        timerListHead->cprTimerPtr->applicationMsgId,
-                                        sizeof(cprCallBackTimerMsg_t), timerMsg);
-                        if (cprSendMessage(timerListHead->cprTimerPtr->callBackMsgQueue,
-                                           timerMsg, (void **) &syshdr) == CPR_FAILURE) {
-                            cprReleaseSysHeader(syshdr);
-                            cpr_free(timerMsg);
-                            CPR_ERROR("%s - Call to cprSendMessage failed\n", fname);
-                            CPR_ERROR("%s - Unable to send timer %s expiration msg\n",
-                                      fname, timerListHead->cprTimerPtr->name);
-                        }
-                    } else {
-                        cpr_free(timerMsg);
-                        CPR_ERROR("%s - Call to cprGetSysHeader failed\n", fname);
-                        CPR_ERROR("%s - Unable to send timer %s expiration msg\n",
-                                  fname, timerListHead->cprTimerPtr->name);
-                    }
-                } else {
-                    CPR_ERROR("%s - Call to cpr_malloc failed\n", fname);
-                    CPR_ERROR("%s - Unable to send timer %s expiration msg\n",
-                              fname, timerListHead->cprTimerPtr->name);
-                }
-                (void) removeTimer(timerListHead->cprTimerPtr);
-            } else {
-                /* The rest of the timers on the list have not yet expired */
-                processingTimers = FALSE;
-            }
-        } else {
-            /* The timer list is now empty */
-            processingTimers = FALSE;
-        }
-    } /* still more to process */
 }
 
 /**
   * @}
   */
--- a/media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_defines.h
+++ b/media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_defines.h
@@ -65,27 +65,12 @@ void cprEnableSwap (void);
 /*
  * tbd: need to finalize placement.
  * Define range of ephemeral ports used for Cisco IP Phones.
  */
 #define CIPPORT_EPH_LOW         0xC000
 #define CIPPORT_EPH_HI          0xCFFF
 
 
-/*
- * Msg queue information needed to hide OS differences in implementation.
- * To use msg queues, the application code may pass in a name to the
- * create function for msg queues. CPR does not use this field, it is
- * solely for the convenience of the application and to aid in debugging.
- */
-typedef struct {
-    const char *name;
-    uint16_t queueId;
-    uint16_t currentCount;
-    void *handlePtr;
-} cpr_msg_queue_t;
-
-
-
 
 __END_DECLS
 
 #endif
--- a/media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_timers.c
+++ b/media/webrtc/signaling/src/sipcc/cpr/win32/cpr_win_timers.c
@@ -44,19 +44,16 @@ typedef struct cprTimerDef {
 } cprTimerBlk;
 
 /* Local data debug info */
 static uint32_t expired_count;  /* Number of timers that expired */
 static uint32_t removed_count;  /* Number of timers removed. */
 static uint32_t inserted_count; /* Number of timers inserted. */
 static uint32_t cpr_timer_init; /* Bool indicating the timer system is initialized */
 
-cprMsgQueue_t tmr_msgq;
-cprThread_t tmr_thread;
-
 
 /*
  * Internal CPR function to fill in data in the sysheader.
  * This is to prevent knowledge of the evil syshdr structure
  * from spreading throughout the CPR code. This thing is
  * like kudzu...
  */
 extern void *fillInSysHeader(void *buffer, uint16_t cmd, uint16_t len,
@@ -528,83 +525,16 @@ cpr_timer_expired (void)
  *   is compared with the sorted list of entries in the timer list.
  *   When a timer is found to have expired, it is removed from the list
  *   and its expiration routine is called.
  *
  *----------------------------------------------------------------------------*/
 void
 cpr_timer_event_process (void)
 {
-    unsigned int now;           /* Current time */
-    cprTimerBlk *timer;         /* User to traverse timer list */
-    cprCallBackTimerMsg_t *timerMsg;
-    void *syshdr;
-
-    cprDisableSwap();
-
-    now = current_time();
-
-    timer = cprTimerPendingList;
-
-    while (timer != NULL) {
-        if (timer->expiration_time <= now) {
-
-            /* Timer has expired. */
-
-            timer_remove(timer);    /* Remove from active list */
-            timer->flags &= ~TIMER_ACTIVE;
-
-            expired_count++;    /* Debug counter */
-
-            cprEnableSwap();
-
-            /* Send msg to queue to indicate this timer has expired */
-            timerMsg = (cprCallBackTimerMsg_t *)
-                    cpr_malloc(sizeof (cprCallBackTimerMsg_t));
-            if (timerMsg) {
-                timerMsg->expiredTimerName = timer->name;
-                timerMsg->expiredTimerId = timer->applicationTimerId;
-                timerMsg->usrData = timer->data;
-                syshdr = cprGetSysHeader(timerMsg);
-                if (syshdr) {
-                    fillInSysHeader(syshdr, timer->applicationMsgId,
-                                    sizeof(cprCallBackTimerMsg_t), timerMsg);
-                    if (cprSendMessage(timer->callBackMsgQueue,
-                            timerMsg, (void **) &syshdr) == CPR_FAILURE) {
-                        cprReleaseSysHeader(syshdr);
-                        cpr_free(timerMsg);
-                        CPR_ERROR("Call to cprSendMessage failed.\n");
-                        CPR_ERROR("Unable to send timer %s expiration msg.\n",
-                                  timer->name);
-                    }
-                } else {
-                    cpr_free(timerMsg);
-                    CPR_ERROR("Call to cprGetSysHeader failed.\n");
-                    CPR_ERROR("Unable to send timer %s expiration msg.\n",
-                              timer->name);
-                }
-            } else {
-                CPR_ERROR("Call to cpr_malloc failed.\n");
-                CPR_ERROR("Unable to send timer %s expiration msg.\n",
-                          timer->name);
-            }
-
-            cprDisableSwap();
-
-            /* Timer expiration function may have manipulated the
-             * timer list.  Need to start over at front of timer list looking
-             * for expired timers.
-             */
-            timer = cprTimerPendingList;    /* Start at front of list */
-        } else {
-            /* No more expired timers. Bail */
-            break;
-        }
-    }
-    cprEnableSwap();
 }
 
 
 
 /*------------------------------------------------------------------------------
  *  NAME:        cpr_timer_tick()
  *
  *  PARAMETERS:
@@ -616,28 +546,16 @@ cpr_timer_event_process (void)
  *  DESCRIPTION:
  *   This routine is called by the timer interrupt routine which on windows
  *   is every 20ms
  *
  *----------------------------------------------------------------------------*/
 void
 cpr_timer_tick (void)
 {
-
-    /* windows is driving this at a 20ms rate */
-    ticker += 20;
-    if (cpr_timer_init) {
-        /* Only kick the timer task if there is a timer which
-         * has expired and ready to be processed.
-         */
-        if (cpr_timer_expired()) {
-            /* Timer task is initialized and we have an expired timer...Kick it. */
-            cprSendMessage(tmr_msgq, tmr_msg, NULL);
-        }
-    }
 }
 
 
 /*------------------------------------------------------------------------------
  *  NAME:        current_time()
  *
  *  PARAMETERS:
  *   None.
@@ -652,52 +570,16 @@ cpr_timer_tick (void)
 unsigned long
 current_time (void)
 {
     return (ticker);
 }
 
 
 /*------------------------------------------------------------------------------
- *  NAME:        CPRTMRTask()
- *
- *  PARAMETERS:
- *   None.
- *
- *  RETURNS:
- *   SUCCESS
- *
- *  DESCRIPTION:
- *   This is the windows version of the CPR timer task
- *
- *----------------------------------------------------------------------------*/
-int32_t
-CPRTMRTask (void *data)
-{
-    void *msg;
-
-    while (cpr_timer_init) {
-        /* Wait for tick */
-        msg = cprGetMessage(tmr_msgq, TRUE, NULL);
-        if (msg) {
-            /*
-             * No need to free the msg here as the only msg
-             * sent to the timer task is a static string to
-             * wake it up.
-             */
-            cpr_timer_event_process();
-        }
-    }
-    return (CPR_SUCCESS);
-}
-
-
-
-
-/*------------------------------------------------------------------------------
  *  NAME:        cprTimerSystemInit()
  *
  *  PARAMETERS:
  *   None.
  *
  *  RETURNS:
  *   void
  *
@@ -707,36 +589,24 @@ CPRTMRTask (void *data)
  *
  *----------------------------------------------------------------------------*/
 void
 cprTimerSystemInit (void)
 {
     /* Create timer lists and free buffer pool */
     cprTimerPendingList = NULL;
 
-    tmr_msgq = cprCreateMessageQueue("TMRQ", 0);
-
     expired_count = 0;
     removed_count = 0;
     inserted_count = 0;
 
     ticker = 0;
     cpr_timer_init = 1;
 
-    tmr_thread = cprCreateThread("CprTmrTsk", (cprThreadStartRoutine)CPRTMRTask,
-                                 CPRTMR_STK, CPRTMR_PRIO, NULL);
-    if (!tmr_thread) {
-        CPR_ERROR("Failed to create CPR Timer Task");
-    }
-    cprSetMessageQueueThread(tmr_msgq, tmr_thread);
-
     //    bind_show_keyword("timers", display_active_timers);
 }
 
 
 void
 cpr_timer_stop (void)
 {
     cpr_timer_init = 0;
-    /* Kick timer to wake it up */
-    cprSendMessage(tmr_msgq, tmr_msg, NULL);
-    cprDestroyThread(tmr_thread);
 }
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.cpp
@@ -25,18 +25,17 @@ using namespace std;
 using namespace CSF;
 
 static const char* logTag = "CC_SIPCCCall";
 
 CSF_IMPLEMENT_WRAP(CC_SIPCCCall, cc_call_handle_t);
 
 CC_SIPCCCall::CC_SIPCCCall (cc_call_handle_t aCallHandle) :
             callHandle(aCallHandle),
-            pMediaData(new CC_SIPCCCallMediaData(nullptr, false, false, -1)),
-            m_lock("CC_SIPCCCall")
+            pMediaData(new CC_SIPCCCallMediaData(nullptr, false, false, -1))
 {
     CSFLogInfo( logTag, "Creating  CC_SIPCCCall %u", callHandle );
 
     AudioControl * audioControl = VcmSIPCCBinding::getAudioControl();
 
     if(audioControl)
     {
          pMediaData->volume = audioControl->getDefaultVolume();
@@ -159,17 +158,16 @@ bool CC_SIPCCCall::resume (cc_sdp_direct
 bool CC_SIPCCCall::endCall()
 {
     return (CCAPI_Call_endCall(callHandle) == CC_SUCCESS);
 }
 
 bool CC_SIPCCCall::sendDigit (cc_digit_t digit)
 {
 	AudioTermination * pAudio = VcmSIPCCBinding::getAudioTermination();
-	mozilla::MutexAutoLock lock(m_lock);
 
     // Convert public digit (as enum or char) to RFC2833 form.
 	int digitId = -1;
 	switch(digit)
 	{
 	case '0':
 		digitId = 0;
 		break;
@@ -340,17 +338,16 @@ bool CC_SIPCCCall::unmuteVideo()
 
 bool CC_SIPCCCall::setAudioMute(bool mute)
 {
 	bool returnCode = false;
 	AudioTermination * pAudio = VcmSIPCCBinding::getAudioTermination();
 	pMediaData->audioMuteState = mute;
 	// we need to set the mute status of all audio streams in the map
 	{
-		mozilla::MutexAutoLock lock(m_lock);
 		for (StreamMapType::iterator entry =  pMediaData->streamMap.begin(); entry !=  pMediaData->streamMap.end(); entry++)
 	    {
 			if (entry->second.isVideo == false)
 			{
 				// first is the streamId
 				if (pAudio->mute(entry->first, mute))
 				{
 					// We have muted at least one stream
@@ -374,17 +371,16 @@ bool CC_SIPCCCall::setAudioMute(bool mut
 
 bool CC_SIPCCCall::setVideoMute(bool mute)
 {
 	bool returnCode = false;
 	VideoTermination * pVideo = VcmSIPCCBinding::getVideoTermination();
 	pMediaData->videoMuteState = mute;
 	// we need to set the mute status of all audio streams in the map
 	{
-		mozilla::MutexAutoLock lock(m_lock);
 		for (StreamMapType::iterator entry =  pMediaData->streamMap.begin(); entry !=  pMediaData->streamMap.end(); entry++)
 	    {
 			if (entry->second.isVideo == true)
 			{
 				// first is the streamId
 				if (pVideo->mute(entry->first, mute))
 				{
 					// We have muted at least one stream
@@ -407,17 +403,16 @@ bool CC_SIPCCCall::setVideoMute(bool mut
 }
 
 void CC_SIPCCCall::addStream(int streamId, bool isVideo)
 {
 
 	CSFLogInfo( logTag, "addStream: %d video=%s callhandle=%u",
         streamId, isVideo ? "TRUE" : "FALSE", callHandle);
 	{
-		mozilla::MutexAutoLock lock(m_lock);
 		pMediaData->streamMap[streamId].isVideo = isVideo;
 	}
 	// The new stream needs to be given any properties that the call has for it.
 	// At the moment the only candidate is the muted state
 	if (isVideo)
 	{
 #ifndef NO_WEBRTC_VIDEO
         VideoTermination * pVideo = VcmSIPCCBinding::getVideoTermination();
@@ -472,31 +467,28 @@ void CC_SIPCCCall::addStream(int streamI
         {
 			CSFLogError( logTag, "setting volume state failed for new stream: %d", streamId);
         }
 	}
 }
 
 void CC_SIPCCCall::removeStream(int streamId)
 {
-	mozilla::MutexAutoLock lock(m_lock);
-
 	if ( pMediaData->streamMap.erase(streamId) != 1)
 	{
 		CSFLogError( logTag, "removeStream stream that was never in the streamMap: %d", streamId);
 	}
 }
 
 bool CC_SIPCCCall::setVolume(int volume)
 {
 	bool returnCode = false;
 
     AudioTermination * pAudio = VcmSIPCCBinding::getAudioTermination();
 	{
-    	mozilla::MutexAutoLock lock(m_lock);
 		for (StreamMapType::iterator entry =  pMediaData->streamMap.begin(); entry !=  pMediaData->streamMap.end(); entry++)
 	    {
 			if (entry->second.isVideo == false)
 			{
 			    // first is the streamId
                 int streamId = entry->first;
 			    if (pAudio->setVolume(streamId, volume))
 			    {
@@ -535,17 +527,16 @@ void CC_SIPCCCall::originateP2PCall (cc_
 void CC_SIPCCCall::createOffer (cc_media_options_t *options, Timecard *tc) {
     CCAPI_CreateOffer(callHandle, options, tc);
 }
 /*
  * This method works asynchronously, there is onCallEvent with the resulting SDP
  */
 void CC_SIPCCCall::createAnswer (Timecard *tc) {
     CCAPI_CreateAnswer(callHandle, tc);
-
 }
 
 void CC_SIPCCCall::setLocalDescription(cc_jsep_action_t action,
                                        const std::string & sdp,
                                        Timecard *tc) {
     CCAPI_SetLocalDescription(callHandle, action, sdp.c_str(), tc);
 }
 
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h
@@ -12,18 +12,16 @@
 #if defined(__cplusplus) && __cplusplus >= 201103L
 typedef struct Timecard Timecard;
 #else
 #include "timecard.h"
 #endif
 
 #include "common/Wrapper.h"
 #include "common/csf_common.h"
-#include "mozilla/Mutex.h"
-#include "base/lock.h"
 
 namespace CSF
 {
     struct StreamInfo
     {
 		// a bit of overkill having a structure just for video, but we may have other properties later
     	bool isVideo;
     };
@@ -33,31 +31,28 @@ namespace CSF
 
     class CC_SIPCCCallMediaData
 	{
           ~CC_SIPCCCallMediaData() {}
 	public:
         NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_SIPCCCallMediaData)
 		CC_SIPCCCallMediaData():
           remoteWindow(nullptr),
-          streamMapMutex("CC_SIPCCCallMediaData"),
           audioMuteState(false),
           videoMuteState(false),
           volume(-1){}
 		CC_SIPCCCallMediaData(VideoWindowHandle remoteWindow,
             bool audioMuteState, bool videoMuteState, int volume):
           remoteWindow(remoteWindow),
-          streamMapMutex("CC_SIPCCCallMediaData"),
           audioMuteState(audioMuteState),
           videoMuteState(videoMuteState),
           volume(volume) {}
         VideoWindowHandle remoteWindow;
 		ExternalRendererHandle extRenderer;
 		VideoFormat videoFormat;
-        mozilla::Mutex streamMapMutex;
         StreamMapType streamMap;
         bool audioMuteState;
         bool videoMuteState;
         int volume;
     private:
         CC_SIPCCCallMediaData(const CC_SIPCCCallMediaData&);
         CC_SIPCCCallMediaData& operator=(const CC_SIPCCCallMediaData&);
 	};
@@ -130,16 +125,14 @@ namespace CSF
         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, Timecard *);
         virtual void foundICECandidate(const std::string & candidate, const std::string & mid, unsigned short level, Timecard *);
 
     private:
         virtual bool setAudioMute(bool mute);
         virtual bool setVideoMute(bool mute);
-
-        mozilla::Mutex m_lock;
     };
 
 }
 
 
 #endif
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCDevice.cpp
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCDevice.cpp
@@ -26,24 +26,25 @@ using namespace CSF;
 CSF_IMPLEMENT_WRAP(CC_SIPCCDevice, cc_device_handle_t);
 
 CC_DevicePtr CC_SIPCCDevice::createDevice ()
 {
     cc_device_handle_t deviceHandle = CCAPI_Device_getDeviceID();
 
     CC_SIPCCDevicePtr pSIPCCDevice = CC_SIPCCDevice::wrap(deviceHandle);
 
+    pSIPCCDevice->enableVideo(true);
+    pSIPCCDevice->enableCamera(true);
+
     return pSIPCCDevice.get();
 }
 
 CC_SIPCCDevice::CC_SIPCCDevice (cc_device_handle_t aDeviceHandle)
 : deviceHandle(aDeviceHandle)
 {
-	enableVideo(true);
-	enableCamera(true);
 }
 
 CC_DeviceInfoPtr CC_SIPCCDevice::getDeviceInfo ()
 {
     cc_deviceinfo_ref_t deviceInfoRef = CCAPI_Device_getDeviceInfo(deviceHandle);
     CC_DeviceInfoPtr deviceInfoPtr =
         CC_SIPCCDeviceInfo::wrap(deviceInfoRef).get();
 
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCService.cpp
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCService.cpp
@@ -308,17 +308,16 @@ namespace CSF
 {
 
 CC_SIPCCService* CC_SIPCCService::_self = nullptr;
 
 CC_SIPCCService::CC_SIPCCService()
 : loggingMask(0),
   bCreated(false),
   bStarted(false),
-  m_lock("CC_SIPCCService"),
   bUseConfig(false)
 {
 	// Only one instance allowed!
     assert(_self == nullptr);
     _self = this;
     // <emannion> Commented as part of media provider removal
     //vcmMediaBridge.setStreamObserver(this);
     //vcmMediaBridge.setMediaProviderObserver(this);
@@ -601,18 +600,16 @@ void CC_SIPCCService::endAllActiveCalls(
 void CC_SIPCCService::onDeviceEvent(ccapi_device_event_e type, cc_device_handle_t handle, cc_deviceinfo_ref_t info)
 {
     if (_self == nullptr)
     {
         CSFLogError( logTag, "CC_SIPCCService::_self is NULL. Unable to notify observers of device event.");
         return;
     }
 
-    mozilla::MutexAutoLock lock(_self->m_lock);
-
     CC_SIPCCDevicePtr devicePtr = CC_SIPCCDevice::wrap(handle);
     if (devicePtr == nullptr)
     {
         CSFLogError( logTag, "Unable to notify device observers for device handle (%u), as failed to create CC_DevicePtr", handle);
         return;
     }
 
     CC_SIPCCDeviceInfoPtr infoPtr = CC_SIPCCDeviceInfo::wrap(info);
@@ -633,18 +630,16 @@ void CC_SIPCCService::onFeatureEvent(cca
 {
 
     if (_self == nullptr)
      {
          CSFLogError( logTag, "CC_SIPCCService::_self is NULL. Unable to notify observers of device event.");
          return;
      }
 
-     mozilla::MutexAutoLock lock(_self->m_lock);
-
      cc_device_handle_t hDevice = CCAPI_Device_getDeviceID();
      CC_DevicePtr devicePtr = CC_SIPCCDevice::wrap(hDevice).get();
      if (devicePtr == nullptr)
      {
          CSFLogError( logTag, "Unable to notify device observers for device handle (%u), as failed to create CC_DevicePtr", hDevice);
          return;
      }
 
@@ -665,18 +660,16 @@ void CC_SIPCCService::onFeatureEvent(cca
 void CC_SIPCCService::onLineEvent(ccapi_line_event_e eventType, cc_lineid_t line, cc_lineinfo_ref_t info)
 {
     if (_self == nullptr)
     {
         CSFLogError( logTag, "CC_SIPCCService::_self is NULL. Unable to notify observers of line event.");
         return;
     }
 
-    mozilla::MutexAutoLock lock(_self->m_lock);
-
     CC_LinePtr linePtr = CC_SIPCCLine::wrap(line).get();
     if (linePtr == nullptr)
     {
         CSFLogError( logTag, "Unable to notify line observers for line lineId (%u), as failed to create CC_LinePtr", line);
         return;
     }
 
     CC_LineInfoPtr infoPtr = CC_SIPCCLineInfo::wrap(info).get();
@@ -695,18 +688,16 @@ void CC_SIPCCService::onLineEvent(ccapi_
 void CC_SIPCCService::onCallEvent(ccapi_call_event_e eventType, cc_call_handle_t handle, cc_callinfo_ref_t info)
 {
     if (_self == nullptr)
     {
         CSFLogError( logTag, "CC_SIPCCService::_self is NULL. Unable to notify observers of call event.");
         return;
     }
 
-    mozilla::MutexAutoLock lock(_self->m_lock);
-
     CC_SIPCCCallPtr callPtr = CC_SIPCCCall::wrap(handle);
     if (callPtr == nullptr)
     {
         CSFLogError( logTag, "Unable to notify call observers for call handle (%u), as failed to create CC_CallPtr", handle);
         return;
     }
 
     CC_SIPCCCallInfoPtr infoPtr = CC_SIPCCCallInfo::wrap(info);
@@ -734,66 +725,60 @@ void CC_SIPCCService::onCallEvent(ccapi_
 
     // Once the call info is dispatched to the observers, we never need to
     // refer to it again. The next operation will contain its own unique info.
     CC_SIPCCCallInfo::release(info);
 }
 
 void CC_SIPCCService::addCCObserver ( CC_Observer * observer )
 {
-	mozilla::MutexAutoLock lock(m_lock);
     if (observer == nullptr)
     {
         CSFLogError( logTag, "NULL value for \"observer\" passed to addCCObserver().");
         return;
     }
 
     ccObservers.insert(observer);
 }
 
 void CC_SIPCCService::removeCCObserver ( CC_Observer * observer )
 {
-	mozilla::MutexAutoLock lock(m_lock);
     ccObservers.erase(observer);
 }
 
 //Notify Observers
 void CC_SIPCCService::notifyDeviceEventObservers (ccapi_device_event_e eventType, CC_DevicePtr devicePtr, CC_DeviceInfoPtr info)
 {
-  // m_lock must be held by the function that called us
 	set<CC_Observer*>::const_iterator it = ccObservers.begin();
 	for ( ; it != ccObservers.end(); it++ )
     {
 	    (*it)->onDeviceEvent(eventType, devicePtr, info);
     }
 }
 
 void CC_SIPCCService::notifyFeatureEventObservers (ccapi_device_event_e eventType, CC_DevicePtr devicePtr, CC_FeatureInfoPtr info)
 {
-  // m_lock must be held by the function that called us
 	set<CC_Observer*>::const_iterator it = ccObservers.begin();
 	for ( ; it != ccObservers.end(); it++ )
     {
 	    (*it)->onFeatureEvent(eventType, devicePtr, info);
     }
 }
 
 void CC_SIPCCService::notifyLineEventObservers (ccapi_line_event_e eventType, CC_LinePtr linePtr, CC_LineInfoPtr info)
 {
-  // m_lock must be held by the function that called us
 	set<CC_Observer*>::const_iterator it = ccObservers.begin();
 	for ( ; it != ccObservers.end(); it++ )
     {
 	    (*it)->onLineEvent(eventType, linePtr, info);
     }
 }
 
 void CC_SIPCCService::notifyCallEventObservers (ccapi_call_event_e eventType, CC_CallPtr callPtr, CC_CallInfoPtr info)
 {
-  // m_lock must be held by the function that called us
 	set<CC_Observer*>::const_iterator it = ccObservers.begin();
 	for ( ; it != ccObservers.end(); it++ )
     {
 	    (*it)->onCallEvent(eventType, callPtr, info);
     }
 }
 
 // This is called when the SIP stack has caused a new stream to be allocated. This function will
@@ -863,17 +848,16 @@ void CC_SIPCCService::dtmfBurst(int digi
 	// Send a DTMF digit on the first one we find.
 
 	AudioTermination * pAudio = VcmSIPCCBinding::getAudioTermination();
 	bool bSent = false;
 	for(vector<CC_SIPCCCallPtr>::iterator it = calls.begin(); it != calls.end() && !bSent; it++)
     {
     	CC_SIPCCCallMediaDataPtr pMediaData = (*it)->getMediaData();
 
-    	mozilla::MutexAutoLock lock(pMediaData->streamMapMutex);
 		for (StreamMapType::iterator entry =  pMediaData->streamMap.begin(); entry !=  pMediaData->streamMap.end(); entry++)
 	    {
 			if (entry->second.isVideo == false)
 			{
 				// first is the streamId
 				if (pAudio->sendDtmf(entry->first, digit))
 				{
 					// We have sent a digit, done.
@@ -974,17 +958,16 @@ void CC_SIPCCService::onKeyFrameRequeste
 	// Using the list of all calls, search for those containing an video stream.
 	// Send the send info SIP message when we find the one with the correct stream id.
 
 	bool bSent = false;
 	for(vector<CC_SIPCCCallPtr>::iterator it = calls.begin(); it != calls.end() && !bSent; it++)
     {
     	CC_SIPCCCallMediaDataPtr pMediaData = (*it)->getMediaData();
 
-    	mozilla::MutexAutoLock lock(pMediaData->streamMapMutex);
 		for (StreamMapType::iterator entry =  pMediaData->streamMap.begin(); entry !=  pMediaData->streamMap.end(); entry++)
 	    {
 			if ((entry->first==stream) && (entry->second.isVideo == true))
 			{
                 CSFLogDebug(logTag, "Send SIP message to originator for stream id %d", stream);
 				if ((*it)->sendInfo ( "","application/media_control+xml", "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
 						"<media_control>\n"
 						"\n"
--- a/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCService.h
+++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCService.h
@@ -18,22 +18,20 @@ extern "C" {
     void CCAPI_CallListener_onCallEvent(ccapi_call_event_e eventType, cc_call_handle_t handle, cc_callinfo_ref_t info);
 }
 
 #include "VcmSIPCCBinding.h"
 #include "CSFAudioControlWrapper.h"
 #include "CSFVideoControlWrapper.h"
 #include "CSFMediaProvider.h"
 
-#include "base/lock.h"
 #include "base/waitable_event.h"
 
 #include <vector>
 #include <set>
-#include "mozilla/Mutex.h"
 
 namespace CSF
 {
     class PhoneConfig;
 	DECLARE_NS_PTR(CC_SIPCCService);
 
 	class CC_SIPCCService : public CC_Service, public StreamObserver, public MediaProviderObserver
     {
@@ -124,17 +122,16 @@ namespace CSF
 
         //IP Address Info
         std::string localAddress;
         std::string defaultGW;
 
 	    // SIPCC lifecycle
         bool bCreated;
         bool bStarted;
-        mozilla::Mutex m_lock;
 
         // Media Lifecycle
         VcmSIPCCBinding vcmMediaBridge;
 
         // Observers
     	std::set<CC_Observer *> ccObservers;
 
 		//AV Control Wrappers