1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/signaling/src/softphonewrapper/CC_SIPCCCall.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,144 @@ 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 +#ifndef _CC_SIPCCCALL_H 1.9 +#define _CC_SIPCCCALL_H 1.10 + 1.11 +#include "CC_Call.h" 1.12 + 1.13 +#include <map> 1.14 + 1.15 +#if defined(__cplusplus) && __cplusplus >= 201103L 1.16 +typedef struct Timecard Timecard; 1.17 +#else 1.18 +#include "timecard.h" 1.19 +#endif 1.20 + 1.21 +#include "common/Wrapper.h" 1.22 +#include "common/csf_common.h" 1.23 +#include "mozilla/Mutex.h" 1.24 +#include "base/lock.h" 1.25 + 1.26 +namespace CSF 1.27 +{ 1.28 + struct StreamInfo 1.29 + { 1.30 + // a bit of overkill having a structure just for video, but we may have other properties later 1.31 + bool isVideo; 1.32 + }; 1.33 + typedef std::map<int, StreamInfo> StreamMapType; 1.34 + 1.35 + DECLARE_NS_PTR(CC_SIPCCCallMediaData); 1.36 + 1.37 + class CC_SIPCCCallMediaData 1.38 + { 1.39 + public: 1.40 + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_SipCCCAllMediaData) 1.41 + CC_SIPCCCallMediaData(): 1.42 + remoteWindow(nullptr), 1.43 + streamMapMutex("CC_SIPCCCallMediaData"), 1.44 + audioMuteState(false), 1.45 + videoMuteState(false), 1.46 + volume(-1){} 1.47 + CC_SIPCCCallMediaData(VideoWindowHandle remoteWindow, 1.48 + bool audioMuteState, bool videoMuteState, int volume): 1.49 + remoteWindow(remoteWindow), 1.50 + streamMapMutex("CC_SIPCCCallMediaData"), 1.51 + audioMuteState(audioMuteState), 1.52 + videoMuteState(videoMuteState), 1.53 + volume(volume) {} 1.54 + VideoWindowHandle remoteWindow; 1.55 + ExternalRendererHandle extRenderer; 1.56 + VideoFormat videoFormat; 1.57 + mozilla::Mutex streamMapMutex; 1.58 + StreamMapType streamMap; 1.59 + bool audioMuteState; 1.60 + bool videoMuteState; 1.61 + int volume; 1.62 + private: 1.63 + CC_SIPCCCallMediaData(const CC_SIPCCCallMediaData&); 1.64 + CC_SIPCCCallMediaData& operator=(const CC_SIPCCCallMediaData&); 1.65 + }; 1.66 + 1.67 + DECLARE_NS_PTR(CC_SIPCCCall); 1.68 + class CC_SIPCCCall : public CC_Call 1.69 + { 1.70 + 1.71 + CSF_DECLARE_WRAP(CC_SIPCCCall, cc_call_handle_t); 1.72 + private: 1.73 + cc_call_handle_t callHandle; 1.74 + CC_SIPCCCall (cc_call_handle_t aCallHandle); 1.75 + CC_SIPCCCallMediaDataPtr pMediaData; 1.76 + std::string peerconnection; // The peerconnection handle 1.77 + 1.78 + public: 1.79 + virtual inline std::string toString() { 1.80 + std::string result; 1.81 + char tmpString[11]; 1.82 + csf_sprintf(tmpString, sizeof(tmpString), "%X", callHandle); 1.83 + result = tmpString; 1.84 + return result; 1.85 + }; 1.86 + 1.87 + virtual void setRemoteWindow (VideoWindowHandle window); 1.88 + virtual int setExternalRenderer(VideoFormat vFormat, ExternalRendererHandle renderer); 1.89 + virtual void sendIFrame(); 1.90 + 1.91 + virtual CC_CallInfoPtr getCallInfo (); 1.92 + 1.93 + virtual bool originateCall (cc_sdp_direction_t video_pref, const std::string & digits); 1.94 + virtual bool answerCall (cc_sdp_direction_t video_pref); 1.95 + virtual bool hold (cc_hold_reason_t reason); 1.96 + virtual bool resume (cc_sdp_direction_t video_pref); 1.97 + virtual bool endCall(); 1.98 + virtual bool sendDigit (cc_digit_t digit); 1.99 + virtual bool backspace(); 1.100 + virtual bool redial (cc_sdp_direction_t video_pref); 1.101 + virtual bool initiateCallForwardAll(); 1.102 + virtual bool endConsultativeCall(); 1.103 + virtual bool conferenceStart (cc_sdp_direction_t video_pref); 1.104 + virtual bool conferenceComplete (CC_CallPtr otherLog, cc_sdp_direction_t video_pref); 1.105 + virtual bool transferStart (cc_sdp_direction_t video_pref); 1.106 + virtual bool transferComplete (CC_CallPtr otherLeg, 1.107 + cc_sdp_direction_t video_pref); 1.108 + virtual bool cancelTransferOrConferenceFeature(); 1.109 + virtual bool directTransfer (CC_CallPtr target); 1.110 + virtual bool joinAcrossLine (CC_CallPtr target); 1.111 + virtual bool blfCallPickup (cc_sdp_direction_t video_pref, const std::string & speed); 1.112 + virtual bool select(); 1.113 + virtual bool updateVideoMediaCap (cc_sdp_direction_t video_pref); 1.114 + virtual bool sendInfo (const std::string & infopackage, const std::string & infotype, const std::string & infobody); 1.115 + virtual bool muteAudio(); 1.116 + virtual bool unmuteAudio(); 1.117 + virtual bool muteVideo(); 1.118 + virtual bool unmuteVideo(); 1.119 + virtual void addStream(int streamId, bool isVideo); 1.120 + virtual void removeStream(int streamId); 1.121 + virtual bool setVolume(int volume); 1.122 + virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip); 1.123 + virtual void createOffer(cc_media_constraints_t *constraints, Timecard *); 1.124 + virtual void createAnswer(cc_media_constraints_t *constraints, Timecard *); 1.125 + virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *); 1.126 + virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *); 1.127 + virtual void setPeerConnection(const std::string& handle); 1.128 + virtual const std::string& getPeerConnection() const; 1.129 + virtual void addStream(cc_media_stream_id_t stream_id, 1.130 + cc_media_track_id_t track_id, 1.131 + cc_media_type_t media_type, 1.132 + cc_media_constraints_t *constraints); 1.133 + virtual void removeStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type); 1.134 + virtual CC_SIPCCCallMediaDataPtr getMediaData(); 1.135 + virtual void addICECandidate(const std::string & candidate, const std::string & mid, unsigned short level, Timecard *); 1.136 + 1.137 + private: 1.138 + virtual bool setAudioMute(bool mute); 1.139 + virtual bool setVideoMute(bool mute); 1.140 + 1.141 + mozilla::Mutex m_lock; 1.142 + }; 1.143 + 1.144 +} 1.145 + 1.146 + 1.147 +#endif