media/webrtc/signaling/src/softphonewrapper/CC_SIPCCLine.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCLine.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "CSFLog.h"
     1.9 +
    1.10 +#include "CC_Common.h"
    1.11 +
    1.12 +#include "CC_SIPCCLine.h"
    1.13 +#include "CC_SIPCCCall.h"
    1.14 +#include "CC_SIPCCLineInfo.h"
    1.15 +
    1.16 +extern "C"
    1.17 +{
    1.18 +#include "ccapi_line.h"
    1.19 +#include "ccapi_line_listener.h"
    1.20 +}
    1.21 +
    1.22 +using namespace std;
    1.23 +using namespace CSF;
    1.24 +
    1.25 +CSF_IMPLEMENT_WRAP(CC_SIPCCLine, cc_lineid_t);
    1.26 +
    1.27 +cc_lineid_t CC_SIPCCLine::getID()
    1.28 +{
    1.29 +    return lineId;
    1.30 +}
    1.31 +
    1.32 +CC_LineInfoPtr CC_SIPCCLine::getLineInfo ()
    1.33 +{
    1.34 +    cc_lineinfo_ref_t lineInfoRef = CCAPI_Line_getLineInfo(lineId);
    1.35 +    CC_LineInfoPtr lineInfoPtr = CC_SIPCCLineInfo::wrap(lineInfoRef).get();
    1.36 +
    1.37 +    //A call to CCAPI_Line_getLineInfo() needs a matching call to CCAPI_Line_releaseLineInfo()
    1.38 +    //However, the CC_SIPCCLineInfo() ctor/dtor does a retain/release internally, so I need to explicitly release
    1.39 +    //here to match up with the call to CCAPI_Line_getLineInfo().
    1.40 +
    1.41 +    CCAPI_Line_releaseLineInfo(lineInfoRef);
    1.42 +
    1.43 +    //CCAPI_Line_getLineInfo() --> requires release be called.
    1.44 +    //CC_SIPCCLineInfo::CC_SIPCCLineInfo() -> Call retain (wrapped in smart_ptr)
    1.45 +    //CCAPI_Line_releaseLineInfo() --> this maps to the call to CCAPI_Line_getLineInfo()
    1.46 +    //CC_SIPCCLineInfo::~CC_SIPCCLineInfo() --> CCAPI_Line_releaseLineInfo() (when smart pointer destroyed)
    1.47 +
    1.48 +    return lineInfoPtr;
    1.49 +}
    1.50 +
    1.51 +CC_CallPtr CC_SIPCCLine::createCall ()
    1.52 +{
    1.53 +    cc_call_handle_t callHandle = CCAPI_Line_CreateCall(lineId);
    1.54 +
    1.55 +    return CC_SIPCCCall::wrap(callHandle).get();
    1.56 +}
    1.57 +
    1.58 +

mercurial