|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "CSFLog.h" |
|
6 |
|
7 #include "CC_Common.h" |
|
8 |
|
9 #include "CC_SIPCCLine.h" |
|
10 #include "CC_SIPCCCall.h" |
|
11 #include "CC_SIPCCLineInfo.h" |
|
12 |
|
13 extern "C" |
|
14 { |
|
15 #include "ccapi_line.h" |
|
16 #include "ccapi_line_listener.h" |
|
17 } |
|
18 |
|
19 using namespace std; |
|
20 using namespace CSF; |
|
21 |
|
22 CSF_IMPLEMENT_WRAP(CC_SIPCCLine, cc_lineid_t); |
|
23 |
|
24 cc_lineid_t CC_SIPCCLine::getID() |
|
25 { |
|
26 return lineId; |
|
27 } |
|
28 |
|
29 CC_LineInfoPtr CC_SIPCCLine::getLineInfo () |
|
30 { |
|
31 cc_lineinfo_ref_t lineInfoRef = CCAPI_Line_getLineInfo(lineId); |
|
32 CC_LineInfoPtr lineInfoPtr = CC_SIPCCLineInfo::wrap(lineInfoRef).get(); |
|
33 |
|
34 //A call to CCAPI_Line_getLineInfo() needs a matching call to CCAPI_Line_releaseLineInfo() |
|
35 //However, the CC_SIPCCLineInfo() ctor/dtor does a retain/release internally, so I need to explicitly release |
|
36 //here to match up with the call to CCAPI_Line_getLineInfo(). |
|
37 |
|
38 CCAPI_Line_releaseLineInfo(lineInfoRef); |
|
39 |
|
40 //CCAPI_Line_getLineInfo() --> requires release be called. |
|
41 //CC_SIPCCLineInfo::CC_SIPCCLineInfo() -> Call retain (wrapped in smart_ptr) |
|
42 //CCAPI_Line_releaseLineInfo() --> this maps to the call to CCAPI_Line_getLineInfo() |
|
43 //CC_SIPCCLineInfo::~CC_SIPCCLineInfo() --> CCAPI_Line_releaseLineInfo() (when smart pointer destroyed) |
|
44 |
|
45 return lineInfoPtr; |
|
46 } |
|
47 |
|
48 CC_CallPtr CC_SIPCCLine::createCall () |
|
49 { |
|
50 cc_call_handle_t callHandle = CCAPI_Line_CreateCall(lineId); |
|
51 |
|
52 return CC_SIPCCCall::wrap(callHandle).get(); |
|
53 } |
|
54 |
|
55 |