📄 callmanager.h
字号:
// // // Copyright (C) 2005, 2006 SIPez LLC// Licensed to SIPfoundry under a Contributor Agreement.//// Copyright (C) 2005, 2006 SIPfoundry Inc.// Licensed by SIPfoundry under the LGPL license.// // Copyright (C) 2004, 2005 Pingtel Corp.// Licensed to SIPfoundry under a Contributor Agreement.// // $$//////////////////////////////////////////////////////////////////////////////// Author: Dan Petrie (dpetrie AT SIPez DOT com)#ifndef _CallManager_h_#define _CallManager_h_// SYSTEM INCLUDES//#include <...>// APPLICATION INCLUDES#include <cp/CpCallManager.h>#include <cp/Connection.h>#include <mi/CpMediaInterfaceFactoryImpl.h>#include <net/QoS.h>#include <tao/TaoObjectMap.h>#include <os/OsProtectEventMgr.h>// DEFINES#ifdef LONG_EVENT_RESPONSE_TIMEOUTS# define CP_MAX_EVENT_WAIT_SECONDS 2592000 // 30 days in seconds#else# define CP_MAX_EVENT_WAIT_SECONDS 30 // time out, seconds#endif#define CP_CALL_HISTORY_LENGTH 50#define CP_MAXIMUM_RINGING_EXPIRE_SECONDS 180#define CALL_DELETE_DELAY_SECS 10 // Number of seconds between a drop // request (call) and call deletion // (call manager)// MACROS// EXTERNAL FUNCTIONS// EXTERNAL VARIABLES// CONSTANTS// STRUCTS// TYPEDEFS// FORWARD DECLARATIONSclass SdpCodec;class CpCall;class SipUserAgent;class OsConfigDb;class TaoObjectMap;class TaoReference;class SdpCodecFactory;class CpMultiStringMessage;class SipSession;class SipDialog;class SipLineMgr;class CpMediaInterfaceFactory;//:Class short description which may consist of multiple lines (note the ':')// Class detailed description which may extend to multiple linesclass CallManager : public CpCallManager{/* //////////////////////////// PUBLIC //////////////////////////////////// */public:/* ============================ CREATORS ================================== */ CallManager(UtlBoolean isRequiredUserIdMatch, SipLineMgr* lineMgrTask, UtlBoolean isEarlyMediaFor180Enabled, SdpCodecFactory* pCodecFactory, int rtpPortStart, int rtpPortEnd, const char* localAddress, const char* publicAddress, SipUserAgent* userAgent, int sipSessionReinviteTimer, // Suggested value: 0 void* mgcpStackTask, // Deprecated, Suggested value: NULL const char* defaultCallExtension, // Suggested value: NULL int availableBehavior, // Suggested value: Connection::RING const char* unconditionalForwardUrl, // Suggested value: NULL int forwardOnNoAnswerSeconds, // Suggested value: -1 const char* forwardOnNoAnswerUrl, // Suggested value: NULL int busyBehavior, // Suggested value: Connection::BUSY const char* sipForwardOnBusyUrl, // Suggested value: NULL OsConfigDb* speedNums, // Suggested value: NULL CallTypes phonesetOutgoingCallProtocol, // Suggested value: CallManager::SIP_CALL int numDialPlanDigits, // Suggested value: 4 int holdType, // Suggested value: CallManager::NEAR_END_HOLD int offeringDelay, // Suggested value: Connection::IMMEDIATE const char* pLocal, // Suggested value: "" int inviteExpireSeconds, // Suggested value: CP_MAXIMUM_RINGING_EXPIRE_SECONDS int expeditedIpTos, // Suggested value: QOS_LAYER3_LOW_DELAY_IP_TOS int maxCalls, // Suggested value: 10 CpMediaInterfaceFactory* pMediaFactory); // Suggested value: NULL) ; virtual ~CallManager(); //:Destructor/* ============================ MANIPULATORS ============================== */ virtual OsStatus addTaoListener(OsServerTask* pListener, char* callId = NULL, int ConnectId = 0, int mask = 0); //:Register as a listener for call and connection events. virtual UtlBoolean handleMessage(OsMsg& eventMessage); virtual void requestShutdown(void); virtual void setOutboundLine(const char* lineUrl); virtual void setOutboundLineForCall(const char* callId, const char* address, CONTACT_TYPE eType = AUTO); // Operations for calls virtual void createCall(UtlString* callId, int metaEventId = 0, int metaEventType = PtEvent::META_EVENT_NONE, int numMetaEventCalls = 0, const char* metaEventCallIds[] = NULL, UtlBoolean assumeFocusIfNoInfocusCall = TRUE); virtual OsStatus getCalls(int maxCalls, int& numCalls, UtlString callIds[]); virtual PtStatus connect(const char* callId, const char* toAddress, const char* fromAddress = NULL, const char* desiredConnectionCallId = NULL, CONTACT_ID contactId = 0, const void* pDisplay = NULL) ; virtual PtStatus consult(const char* idleTargetCallId, const char* activeOriginalCallId, const char* originalCallControllerAddress, const char* originalCallControllerTerminalId, const char* consultAddressUrl, UtlString& targetCallControllerAddress, UtlString& targetCallConsultAddress); virtual void drop(const char* callId); virtual PtStatus transfer_blind(const char* callId, const char* transferToUrl, UtlString* targetCallId, UtlString* targetConnectionAddress = NULL, bool remoteHoldBeforeTransfer = true ); // Blind transfer virtual PtStatus transfer(const char* targetCallId, const char* originalCallId); // Consultative transfer // The couple targetCallId & targetConnectionAddress return/define // the transfer target connection in the resulting new transfer // target call PtStatus transfer(const char* sourceCallId, const char* sourceAddress, const char* targetCallId, const char* targetAddress, bool remoteHoldBeforeTransfer = true ) ; //: Transfer an individual participant from one end point to another using //: REFER w/replaces. virtual PtStatus split(const char* szSourceCallId, const char* szSourceAddress, const char* szTargetCallId) ; //: Split szSourceAddress from szSourceCallId and join it to the specified //: target call id. The source call/connection MUST be on hold prior //: to initiating the split/join. virtual void toneStart(const char* callId, int toneId, UtlBoolean local, UtlBoolean remote); virtual void toneStop(const char* callId); virtual void audioPlay(const char* callId, const char* audioUrl, UtlBoolean repeat, UtlBoolean local, UtlBoolean remote); virtual void bufferPlay(const char* callId, int audiobuf, int bufSize, int type, UtlBoolean repeat, UtlBoolean local, UtlBoolean remote); virtual void audioStop(const char* callId); virtual void stopPremiumSound(const char* callId); //: Set a media property on the media interface for the given call /* * @param callId - call id string for the conference * @param propertyName string id for the property to set * @param propertyValue for the new value of the property * Media interfaces that wish to interoperate should implement the following properties * and values: * * Property Name Property Values * ======================= =============== * "audioInput1.muteState" "true", "false" for systems that may have a microphone for each conference or 2-way call * "audioInput1.device" same value as szDevice in sipxAudioSetCallInputDevice * "audioOutput1.deviceType" "speaker", "ringer" same as sipxAudioEnableSpeaker, but for specific conference or 2-way call * "audioOutput1.ringerDevice" same value as szDevice in sipxAudioSetRingerOutputDevice * "audioOutput1.speakerDevice" same values as szDevice in sipxAudioSetCallOutputDevice * "audioOutput1.volume" string value of iLevel in sipxAudioSetVolume */ virtual OsStatus setCallMediaProperty(const char* callId, const char* propertyName, const char* propertyValue);#ifndef EXCLUDE_STREAMING virtual void createPlayer(const char* callid, MpStreamPlaylistPlayer** ppPlayer) ; virtual void createPlayer(int type, const char* callid, const char* szStream, int flags, MpStreamPlayer** ppPlayer) ; virtual void destroyPlayer(const char* callid, MpStreamPlaylistPlayer* pPlayer) ; virtual void destroyPlayer(int type, const char* callid, MpStreamPlayer* pPlayer) ;#endif // Operations for calls & connections virtual void acceptConnection(const char* callId, const char* address, CONTACT_TYPE contactType = AUTO, const void* hWnd = NULL); virtual void rejectConnection(const char* callId, const char* address); virtual PtStatus redirectConnection(const char* callId, const char* address, const char* forwardAddressUrl); virtual void dropConnection(const char* callId, const char* address); virtual void getNumConnections(const char* callId, int& numConnections); virtual OsStatus getConnections(const char* callId, int maxConnections, int& numConnections, UtlString addresses[]); virtual OsStatus getCalledAddresses(const char* callId, int maxConnections, int& numConnections, UtlString addresses[]); virtual OsStatus getCallingAddresses(const char* callId, int maxConnections, int& numConnections, UtlString addresses[]); // Operations for calls & terminal connections virtual void answerTerminalConnection(const char* callId, const char* address, const char* terminalId, const void* pDisplay = NULL); virtual void holdTerminalConnection(const char* callId, const char* address, const char* terminalId); virtual void holdAllTerminalConnections(const char* callId); virtual void holdLocalTerminalConnection(const char* callId); virtual void unholdLocalTerminalConnection(const char* callId); virtual void unholdAllTerminalConnections(const char* callId); virtual void unholdTerminalConnection(const char* callId, const char* addresss, const char* terminalId); virtual void renegotiateCodecsTerminalConnection(const char* callId, const char* addresss, const char* terminalId); virtual void renegotiateCodecsAllTerminalConnections(const char* callId); //! Change the identity used in SIP PAssertedIdentity header for INVITEs sent /*! Set the SIP AOR which used in the SIP PAssertedIdentity header for * INVITE requests send from this side. The callId and remoteAddress * identity the SIP dialog to which the local identity is to be changed. * signalNow TRUE indicates that a SIP reINVITE should be forced to occur now * as opposed when the next reINVITE occurs during a on/off hold operation. * * This method is used to change the identity when some local operation * occurs that does not get reflected in the SIP signalling. Setting * the PAssertedIdentity allows the signalling to indicate the the * identity change has occurred. */ virtual UtlBoolean setLocalPAssertedIdentity(const char* callId, const char* remoteAddress, const char* newPAssertedId, const UtlBoolean signalNow); virtual void getNumTerminalConnections(const char* callId, const char* address, int& numTerminalConnections); virtual OsStatus getTerminalConnections(const char* callId, const char* address, int maxTerminalConnections, int& numTerminalConnections, UtlString terminalNames[]); virtual UtlBoolean isTerminalConnectionLocal(const char* callId, const char* address, const char* terminalId); virtual OsStatus getSession(const char* callId, const char* address, SipSession& session); virtual OsStatus getSipDialog(const char* callId, const char* address, SipDialog& dialog); virtual OsStatus getInvite(const char* callId, const char* address, SipMessage& invite); //! Send a SIP request in the context of the dialog of the given call/session /*! The response gets queued to the optional response message queue. * \param responseQueue - optional queue in which to put response(s) to request * \param requestListenerData - data to be attached to response(s) added to queue */ virtual UtlBoolean sendInDialog(const char* callId, const char* address, SipMessage& request, OsMsgQ* responseQueue = NULL, void* requestListenerData = NULL); // Stimulus based operations DEPRICATED DO NOT USE virtual void unhold(const char* callId); virtual void dialString(const char* url); virtual UtlBoolean disconnectConnection(const char* callId, const char* addressUrl); virtual void setTransferType(int type); virtual void addToneListener(const char* callId, int pListener);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -