OPAL  Version 3.18.8
skinnyep.h
Go to the documentation of this file.
1 /*
2  * skinnyep.h
3  *
4  * Cisco SCCP (Skinny Client Control Protocol) support.
5  *
6  * Open Phone Abstraction Library (OPAL)
7  * Formally known as the Open H323 project.
8  *
9  * Copyright (c) 2014 Vox Lucida Pty. Ltd.
10  *
11  * The contents of this file are subject to the Mozilla Public License
12  * Version 1.0 (the "License"); you may not use this file except in
13  * compliance with the License. You may obtain a copy of the License at
14  * http://www.mozilla.org/MPL/
15  *
16  * Software distributed under the License is distributed on an "AS IS"
17  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18  * the License for the specific language governing rights and limitations
19  * under the License.
20  *
21  * The Original Code is Open Phone Abstraction Library.
22  *
23  * The Initial Developer of the Original Code is Vox Lucida Pty. Ltd.
24  *
25  * Contributor(s): Robert Jongbloed (robertj@voxlucida.com.au).
26  */
27 
28 #ifndef OPAL_SKINNY_H
29 #define OPAL_SKINNY_H
30 
31 #include <opal_config.h>
32 
33 #if OPAL_SKINNY
34 
35 #include <rtp/rtpep.h>
36 #include <rtp/rtpconn.h>
37 
38 
39 class OpalSkinnyConnection;
40 
41 
44 class OpalSkinnyEndPoint : public OpalRTPEndPoint
45 {
46  PCLASSINFO(OpalSkinnyEndPoint, OpalRTPEndPoint);
47  public:
52  OpalSkinnyEndPoint(
53  OpalManager & manager,
54  const char *prefix = "sccp"
55  );
56 
59  virtual ~OpalSkinnyEndPoint();
61 
68  virtual void ShutDown();
69 
73  virtual PString GetDefaultTransport() const;
74 
77  virtual WORD GetDefaultSignalPort() const;
78 
86  virtual OpalMediaFormatList GetMediaFormats() const;
87 
90  virtual void NewIncomingConnection(
91  OpalListener & listener,
92  const OpalTransportPtr & transport
93  );
94 
122  virtual PSafePtr<OpalConnection> MakeConnection(
123  OpalCall & call,
124  const PString & party,
125  void * userData,
126  unsigned int options,
127  OpalConnection::StringOptions * stringOptions
128  );
129 
133  virtual PBoolean GarbageCollection();
135 
136 
137  class PhoneDevice;
138 
143  virtual OpalSkinnyConnection * CreateConnection(
144  OpalCall & call,
145  PhoneDevice & client,
146  unsigned callIdentifier,
147  const PString & dialNumber,
148  void * userData,
149  unsigned int options,
150  OpalConnection::StringOptions * stringOptions = NULL
151  );
153 
156  enum { DefaultDeviceType = 30016 }; // Cisco IP Communicator
157 
160  bool Register(
161  const PString & server,
162  const PString & name,
163  unsigned deviceType = DefaultDeviceType,
164  const PString & localInterface = PString::Empty()
165  );
166 
169  bool Unregister(
170  const PString & name
171  );
172 
174  PhoneDevice * CreatePhoneDevice(
175  const PString & name,
176  unsigned deviceType,
177  const PIPAddressAndPort & binding
178  );
179 
180  PhoneDevice * GetPhoneDevice(
181  const PString & name
182  ) const { return m_phoneDevices.GetAt(name); }
183 
184  PArray<PString> GetPhoneDeviceNames() const { return m_phoneDevices.GetKeys(); }
186 
187 
188  class SkinnyMsg;
189 
190  class PhoneDevice : public PObject
191  {
192  PCLASSINFO(PhoneDevice, PObject);
193  public:
194  PhoneDevice(OpalSkinnyEndPoint & ep, const PString & name, unsigned deviceType, const PIPAddressAndPort & binding);
195  ~PhoneDevice() { Close(); }
196 
197  virtual void PrintOn(ostream & strm) const;
198 
199  bool Start(const PString & server);
200  bool Stop();
201  void Close();
202 
203  bool SendSkinnyMsg(const SkinnyMsg & msg);
204 
205  const PString & GetName() const { return m_name; }
206  unsigned GetDeviceType() const { return m_deviceType; }
207  const PString & GetStatus() const { return m_status; }
208  OpalTransportAddress GetRemoteAddress() const { return m_transport.GetRemoteAddress(); }
209 
210  protected:
211  void HandleTransport();
212  bool SendRegisterMsg();
213  PDECLARE_NOTIFIER(PTimer, OpalSkinnyEndPoint::PhoneDevice, OnKeepAlive);
214 
215  template <class MSG> bool OnReceiveMsg(const MSG & msg)
216  {
217  PTRACE(3, "Skinny", "Received " << msg);
218  return m_endpoint.OnReceiveMsg(*this, msg);
219  }
220 
221  OpalSkinnyEndPoint & m_endpoint;
222  PString m_name;
223  unsigned m_deviceType;
224  OpalTransportTCP m_transport;
225  PTimeInterval m_delay;
226  PString m_status;
227  PSyncPoint m_exit;
228  PTimer m_keepAliveTimer;
229 
230  // Currently only support one call at a time
231  PSafePtr<OpalSkinnyConnection> m_activeConnection;
232 
233  friend class OpalSkinnyEndPoint;
234  friend class OpalSkinnyConnection;
235  };
236 
237 
238 #pragma pack(1)
239  class SkinnyMsg : public PObject
240  {
241  PCLASSINFO(SkinnyMsg, PObject);
242  protected:
243  SkinnyMsg(uint32_t id, PINDEX len, PINDEX extraSpace);
244  void Construct(const PBYTEArray & pdu);
245 
246  public:
247  uint32_t GetID() const { return m_messageId; }
248 
249  const BYTE * GetPacketPtr() const { return (const BYTE *)&m_length; }
250  PINDEX GetPacketLen() const { return m_length + sizeof(m_length) + sizeof(m_headerVersion); }
251 
252  protected:
253  PINDEX m_extraSpace;
254 
255  // Data after here is mapped to "over the wire" PDU, no polymorhic classes
256  PUInt32l m_length;
257  PUInt32l m_headerVersion;
258  PUInt32l m_messageId;
259  };
260 
261  // Note: all derived classes MUST NOT have composite members, e.g. PString
262 #define OPAL_SKINNY_MSG2(cls, base, id, extraSpace, vars) \
263  class cls : public base \
264  { \
265  PCLASSINFO(cls, base); \
266  public: \
267  enum { ID = id }; \
268  cls() : base(ID, sizeof(*this), extraSpace) { } \
269  cls(const PBYTEArray & pdu) : base(ID, sizeof(*this), extraSpace) { Construct(pdu); } \
270  vars \
271  }; \
272  virtual bool OnReceiveMsg(PhoneDevice & client, const cls & msg)
273 
274 #define OPAL_SKINNY_MSG(cls, id, vars) OPAL_SKINNY_MSG2(cls, SkinnyMsg, id, 0, vars)
275 
276  OPAL_SKINNY_MSG(KeepAliveMsg, 0x0000,
277  PUInt32l m_unknown;
278  );
279 
280  OPAL_SKINNY_MSG(KeepAliveAckMsg, 0x0100,
281  );
282 
283  struct Proto {
284  uint8_t m_version;
285  uint8_t m_flags;
286  BYTE m_unknown1;
287  uint8_t m_features; // 0x01=Dynamic Messages, 0x80=Abbreviated dialing
288 
289  friend ostream & operator<<(ostream & strm, const Proto & protocol);
290  };
291 
292  OPAL_SKINNY_MSG(RegisterMsg, 0x0001,
293  enum { MaxNameSize = 15 };
294  char m_deviceName[MaxNameSize+1];
295  PUInt32l m_userId;
296  PUInt32l m_instance;
297  in_addr m_ip;
298  PUInt32l m_deviceType;
299  PUInt32l m_maxStreams;
300  PUInt32l m_activeStreams;
301  Proto m_protocol;
302  PUInt32l m_socketType; // 0=ASCII, 1=HEX
303  BYTE m_unknown2[4];
304  char m_macAddress[12];
305 
306  virtual void PrintOn(ostream & strm) const;
307  );
308 
309  OPAL_SKINNY_MSG(RegisterAckMsg, 0x0081,
310  PUInt32l m_keepAlive;
311  char m_dateFormat[6];
312  BYTE m_unknown1[2];
313  PUInt32l m_secondaryKeepAlive;
314  Proto m_protocol;
315 
316  virtual void PrintOn(ostream & strm) const;
317  );
318 
319  OPAL_SKINNY_MSG(RegisterRejectMsg, 0x009d,
320  char m_errorText[32];
321  );
322 
323  OPAL_SKINNY_MSG(UnregisterMsg, 0x0027,
324  );
325 
326  OPAL_SKINNY_MSG(UnregisterAckMsg, 0x0118,
327  PUInt32l m_status;
328  );
329 
330  OPAL_SKINNY_MSG(PortMsg, 0x0002,
331  PUInt16l m_port;
332 
333  virtual void PrintOn(ostream & strm) const;
334  );
335 
336  OPAL_SKINNY_MSG(CapabilityRequestMsg, 0x009B,
337  );
338 
339  OPAL_SKINNY_MSG(CapabilityResponseMsg, 0x0010,
340  PUInt32l m_count;
341  struct Info
342  {
343  PUInt32l m_codec;
344  PUInt32l m_maxFramesPerPacket;
345  PUInt32l m_g7231BitRate; // 1=5.3 Kbps, 2=6.4 Kbps
346  char m_unknown[4];
347  } m_capability[32];
348 
349  virtual void PrintOn(ostream & strm) const;
350  void SetCount(PINDEX count);
351  );
352 
353  P_DECLARE_STREAMABLE_ENUM(CallStates,
354  eUnknownState,
355  eStateOffHook,
356  eStateOnHook,
357  eStateRingOut,
358  eStateRingIn,
359  eStateConnected,
360  eStateBusy,
361  eStateCongestion,
362  eStateHold,
363  eStateCallWaiting,
364  eStateCallTransfer,
365  eStateCallPark,
366  eStateProceed,
367  eStateCallRemoteMultiline,
368  eStateInvalidNumber
369  );
370  OPAL_SKINNY_MSG(CallStateMsg, 0x0111,
371  PUInt32l m_state;
372  PUInt32l m_lineInstance;
373  PUInt32l m_callIdentifier;
374  BYTE m_unknown[12];
375 
376  __inline CallStates GetState() const { return (CallStates)(uint32_t)m_state; }
377  virtual void PrintOn(ostream & strm) const;
378  );
379 
380  P_DECLARE_STREAMABLE_ENUM(CallType,
381  eTypeUnknownCall,
382  eTypeInboundCall,
383  eTypeOutboundCall,
384  eTypeForwardCall
385  );
386 
387  class CallInfoCommon : public SkinnyMsg
388  {
389  protected:
390  CallInfoCommon(uint32_t id, PINDEX len, PINDEX extraSpace) : SkinnyMsg(id, len, extraSpace) { }
391  public:
392  virtual const PUInt32l & GetLineInstance() const = 0;
393  virtual const PUInt32l & GetCallIdentifier() const = 0;
394  virtual CallType GetType() const = 0;
395  virtual const char * GetCalledPartyName() const = 0;
396  virtual const char * GetCalledPartyNumber() const = 0;
397  virtual const char * GetCallingPartyName() const = 0;
398  virtual const char * GetCallingPartyNumber() const = 0;
399  virtual const char * GetRedirectingPartyNumber() const = 0;
400 
401  virtual void PrintOn(ostream & strm) const;
402  };
403 
404  OPAL_SKINNY_MSG2(CallInfoMsg, CallInfoCommon, 0x008f, 0,
405  char m_callingPartyName[40];
406  char m_callingPartyNumber[24];
407  char m_calledPartyName[40];
408  char m_calledPartyNumber[24];
409  PUInt32l m_lineInstance;
410  PUInt32l m_callIdentifier;
411  PUInt32l m_callType;
412  char m_originalCalledPartyName[40];
413  char m_originalCalledPartyNumber[24];
414  char m_lastRedirectingPartyName[40];
415  char m_lastRedirectingPartyNumber[24];
416  PUInt32l m_originalCalledPartyRedirectReason;
417  PUInt32l m_lastRedirectingReason;
418  char m_callingPartyVoiceMailbox[24];
419  char m_calledPartyVoiceMailbox[24];
420  char m_originalCalledPartyVoiceMailbox[24];
421  char m_lastRedirectingVoiceMailbox[24];
422  PUInt32l m_callInstance;
423  PUInt32l m_callSecurityStatus;
424  PUInt32l m_partyPIRestrictionBits;
425 
426  virtual const PUInt32l & GetLineInstance() const { return m_lineInstance; }
427  virtual const PUInt32l & GetCallIdentifier() const { return m_callIdentifier; }
428  virtual CallType GetType() const { return (CallType)(uint32_t)m_callType; }
429  virtual const char * GetCalledPartyName() const { return m_calledPartyName; }
430  virtual const char * GetCalledPartyNumber() const { return m_calledPartyNumber; }
431  virtual const char * GetCallingPartyName() const { return m_callingPartyName; }
432  virtual const char * GetCallingPartyNumber() const { return m_callingPartyNumber; }
433  virtual const char * GetRedirectingPartyNumber() const { return m_lastRedirectingPartyNumber; }
434  );
435 
436  enum { CallInfo5MsgStringSpace = 200 };
437  OPAL_SKINNY_MSG2(CallInfo5Msg, CallInfoCommon, 0x014a, CallInfo5MsgStringSpace,
438  PUInt32l m_lineInstance;
439  PUInt32l m_callIdentifier;
440  PUInt32l m_callType;
441  PUInt32l m_originalCalledPartyRedirectReason;
442  PUInt32l m_lastRedirectingReason;
443  PUInt32l m_callInstance;
444  PUInt32l m_callSecurityStatus;
445  PUInt32l m_partyPIRestrictionBits;
446  char m_strings[CallInfo5MsgStringSpace+11]; // Allow space for strings
447 
448  virtual const PUInt32l & GetLineInstance() const { return m_lineInstance; }
449  virtual const PUInt32l & GetCallIdentifier() const { return m_callIdentifier; }
450  virtual CallType GetType() const { return (CallType)(uint32_t)m_callType; }
451  virtual const char * GetCalledPartyName() const { return GetStringByIndex(9); }
452  virtual const char * GetCalledPartyNumber() const { return GetStringByIndex(1); }
453  virtual const char * GetCallingPartyName() const { return GetStringByIndex(8); }
454  virtual const char * GetCallingPartyNumber() const { return GetStringByIndex(0); }
455  virtual const char * GetRedirectingPartyNumber() const { return GetStringByIndex(3); }
456 
457  protected:
458  const char * GetStringByIndex(PINDEX idx) const;
459  );
460 
461  enum RingType
462  {
463  eRingOff = 1,
464  eRingInside,
465  eRingOutside,
466  eRingFeature
467  };
468  OPAL_SKINNY_MSG(SetRingerMsg, 0x0085,
469  PUInt32l m_ringType;
470  PUInt32l m_ringMode;
471  PUInt32l m_lineInstance;
472  PUInt32l m_callIdentifier;
473 
474  __inline RingType GetType() const { return (RingType)(uint32_t)m_ringType; }
475  __inline bool IsForever() const { return m_ringMode == 1; }
476  virtual void PrintOn(ostream & strm) const;
477  );
478 
479  OPAL_SKINNY_MSG(OffHookMsg, 0x0006,
480  PUInt32l m_lineInstance;
481  PUInt32l m_callIdentifier;
482 
483  virtual void PrintOn(ostream & strm) const;
484  );
485 
486  OPAL_SKINNY_MSG(OnHookMsg, 0x0007,
487  PUInt32l m_lineInstance;
488  PUInt32l m_callIdentifier;
489 
490  virtual void PrintOn(ostream & strm) const;
491  );
492 
493  enum Tones
494  {
495  eToneSilence = 0,
496  eToneDial = 33,
497  eToneBusy = 35,
498  eToneAlert = 36,
499  eToneReorder = 37,
500  eToneCallWaiting = 45,
501  eToneNoTone = 0x7f
502  };
503  OPAL_SKINNY_MSG(StartToneMsg, 0x0082,
504  PUInt32l m_tone;
505  BYTE m_unknown[4];
506  PUInt32l m_lineInstance;
507  PUInt32l m_callIdentifier;
508 
509  __inline Tones GetType() const { return (Tones)(uint32_t)m_tone; }
510  virtual void PrintOn(ostream & strm) const;
511  );
512 
513  OPAL_SKINNY_MSG(StopToneMsg, 0x0083,
514  PUInt32l m_lineInstance;
515  PUInt32l m_callIdentifier;
516 
517  virtual void PrintOn(ostream & strm) const;
518  );
519 
520  OPAL_SKINNY_MSG(KeyPadButtonMsg, 0x0003,
521  BYTE m_dtmf;
522  BYTE m_padding[3];
523  PUInt32l m_lineInstance;
524  PUInt32l m_callIdentifier;
525 
526  virtual void PrintOn(ostream & strm) const;
527  );
528 
529  P_DECLARE_STREAMABLE_ENUM(SoftKeyEvents,
530  eSoftUnknown,
531  eSoftKeyRedial,
532  eSoftKeyNewCall,
533  eSoftKeyHold,
534  eSoftKeyTransfer,
535  eSoftKeyCfwdall,
536  eSoftKeyCfwdBusy,
537  eSoftKeyCfwdNoAnswer,
538  eSoftKeyBackspace,
539  eSoftKeyEndcall,
540  eSoftKeyResume,
541  eSoftKeyAnswer,
542  eSoftKeyInfo,
543  eSoftKeyConf,
544  eSoftKeyPark,
545  eSoftKeyJoin,
546  eSoftKeyMeetMe,
547  eSoftKeyCallPickup,
548  eSoftKeyGrpCallPickup,
549  eSoftKeyDND,
550  eSoftKeyDivert
551  );
552  OPAL_SKINNY_MSG(SoftKeyEventMsg, 0x0026,
553  PUInt32l m_event;
554  PUInt32l m_lineInstance;
555  PUInt32l m_callIdentifier;
556 
557  __inline SoftKeyEvents GetEvent() const { return (SoftKeyEvents)(uint32_t)m_event; }
558  virtual void PrintOn(ostream & strm) const;
559  );
560 
561  OPAL_SKINNY_MSG(OpenReceiveChannelMsg, 0x0105,
562  PUInt32l m_callIdentifier;
563  PUInt32l m_passThruPartyId;
564  PUInt32l m_msPerPacket;
565  PUInt32l m_payloadCapability;
566  PUInt32l m_echoCancelType;
567  PUInt32l m_g723Bitrate;
568  BYTE m_unknown[68];
569 
570  virtual void PrintOn(ostream & strm) const;
571  );
572 
573  OPAL_SKINNY_MSG(OpenReceiveChannelAckMsg, 0x0022,
574  PUInt32l m_status;
575  in_addr m_ip;
576  PUInt16l m_port;
577  BYTE m_padding[2];
578  PUInt32l m_passThruPartyId;
579  virtual void PrintOn(ostream & strm) const;
580  );
581 
582  OPAL_SKINNY_MSG(CloseReceiveChannelMsg, 0x0106,
583  PUInt32l m_callIdentifier;
584  PUInt32l m_passThruPartyId;
585  PUInt32l m_conferenceId2;
586 
587  virtual void PrintOn(ostream & strm) const;
588  );
589 
590  OPAL_SKINNY_MSG(StartMediaTransmissionMsg, 0x008a,
591  PUInt32l m_callIdentifier;
592  PUInt32l m_passThruPartyId;
593  in_addr m_ip;
594  PUInt16l m_port;
595  BYTE m_padding[2];
596  PUInt32l m_msPerPacket;
597  PUInt32l m_payloadCapability;
598  PUInt32l m_precedence;
599  PUInt32l m_silenceSuppression;
600  PUInt32l m_maxFramesPerPacket;
601  PUInt32l m_g723Bitrate;
602  BYTE m_unknown[68];
603 
604  virtual void PrintOn(ostream & strm) const;
605  );
606 
607  OPAL_SKINNY_MSG(StopMediaTransmissionMsg, 0x008b,
608  PUInt32l m_callIdentifier;
609  PUInt32l m_passThruPartyId;
610  PUInt32l m_conferenceId2;
611 
612  virtual void PrintOn(ostream & strm) const;
613  );
614 #pragma pack()
615 
616 
617  const PFilePath & GetSimulatedFarAudioFile() const { return m_simulatedFarAudioFile; }
618  void SetSimulatedFarAudioFile(const PString str) { m_simulatedFarAudioFile = str; }
619  const PFilePath & GetSimulatedNearAudioFile() const { return m_simulatedNearAudioFile; }
620  void SetSimulatedNearAudioFile(const PString str) { m_simulatedNearAudioFile = str; }
621 
622  const PDirectory & GetSimulatedAudioFolder() const { return m_simulatedAudioFolder; }
623  void SetSimulatedAudioFolder(const PString str) { m_simulatedAudioFolder = str; }
624 
625  PFilePath GetEndpointSimulatedAudioFile(const PString& name, unsigned sessionId) const;
626 
627  bool IsSecondaryAudioAlwaysSimulated() const { return m_secondaryAudioAlwaysSimulated; }
628  void SetSecondaryAudioAlwaysSimulated(bool v) { m_secondaryAudioAlwaysSimulated = v; }
629 
630  void SetServerInterfaces(const PString & addresses) { m_serverInterfaces = OpalTransportAddressArray(addresses); }
631 
632  protected:
633  template <class MSG> bool DelegateMsg(const PhoneDevice & client, const MSG & msg);
634 
635  typedef PDictionary<PString, PhoneDevice> PhoneDeviceDict;
636  PhoneDeviceDict m_phoneDevices;
637  PDECLARE_MUTEX(m_phoneDevicesMutex);
638  OpalTransportAddressArray m_serverInterfaces;
639  PFilePath m_simulatedFarAudioFile;
640  PFilePath m_simulatedNearAudioFile;
641  PDirectory m_simulatedAudioFolder;
642  bool m_secondaryAudioAlwaysSimulated;
643 };
644 
645 
648 class OpalSkinnyConnection : public OpalRTPConnection
649 {
650  PCLASSINFO(OpalSkinnyConnection, OpalRTPConnection);
651  public:
656  OpalSkinnyConnection(
657  OpalCall & call,
658  OpalSkinnyEndPoint & ep,
659  OpalSkinnyEndPoint::PhoneDevice & client,
660  unsigned callIdentifier,
661  const PString & dialNumber,
662  void * /*userData*/,
663  unsigned options,
664  OpalConnection::StringOptions * stringOptions
665  );
667 
678  virtual bool IsNetworkConnection() const { return true; }
679 
684  virtual PBoolean SetUpConnection();
685 
701  virtual void OnReleased();
702 
707  virtual OpalMediaFormatList GetMediaFormats() const;
708 
717  virtual PBoolean SetAlerting(
718  const PString & calleeName,
719  PBoolean withMedia
720  );
721 
724  virtual PBoolean SetConnected();
725 
732  virtual OpalMediaType::AutoStartMode GetAutoStart(
733  const OpalMediaType & mediaType
734  ) const;
735 
747  virtual PString GetAlertingType() const;
748 
753  virtual void OnClosedMediaStream(
754  const OpalMediaStream & stream
755  );
756 
759  virtual OpalTransportAddress GetRemoteAddress() const;
761 
764  virtual bool OnReceiveMsg(const OpalSkinnyEndPoint::CallStateMsg & msg);
765  virtual bool OnReceiveMsg(const OpalSkinnyEndPoint::CallInfoMsg & msg);
766  virtual bool OnReceiveMsg(const OpalSkinnyEndPoint::CallInfo5Msg & msg);
767  virtual bool OnReceiveMsg(const OpalSkinnyEndPoint::SetRingerMsg & msg);
768  virtual bool OnReceiveMsg(const OpalSkinnyEndPoint::StartToneMsg & msg);
769  virtual bool OnReceiveMsg(const OpalSkinnyEndPoint::OpenReceiveChannelMsg & msg);
770  virtual bool OnReceiveMsg(const OpalSkinnyEndPoint::CloseReceiveChannelMsg & msg);
771  virtual bool OnReceiveMsg(const OpalSkinnyEndPoint::StartMediaTransmissionMsg & msg);
772  virtual bool OnReceiveMsg(const OpalSkinnyEndPoint::StopMediaTransmissionMsg & msg);
774 
775  protected:
776  bool OnReceiveCallInfo(const OpalSkinnyEndPoint::CallInfoCommon & msg);
777 
778  struct MediaInfo
779  {
780  MediaInfo(const OpalSkinnyEndPoint::OpenReceiveChannelMsg & msg);
781  MediaInfo(const OpalSkinnyEndPoint::CloseReceiveChannelMsg & msg);
782  MediaInfo(const OpalSkinnyEndPoint::StartMediaTransmissionMsg & msg);
783  MediaInfo(const OpalSkinnyEndPoint::StopMediaTransmissionMsg & msg);
784 
785  bool operator<(const MediaInfo & other) const;
786 
787  bool m_receiver;
788  uint32_t m_passThruPartyId;
789  uint32_t m_payloadCapability;
790  OpalTransportAddress m_mediaAddress;
791  mutable unsigned m_sessionId;
792  };
793  void OpenMediaChannel(const MediaInfo & info);
794  void OpenSimulatedMediaChannel(const MediaInfo & info, const OpalMediaFormat & mediaFormat);
795  void DelayCloseMediaStream(OpalMediaStreamPtr mediaStream);
796 
797  OpalSkinnyEndPoint & m_endpoint;
798  OpalSkinnyEndPoint::PhoneDevice & m_phoneDevice;
799 
800  uint32_t m_lineInstance;
801  uint32_t m_callIdentifier;
802  PString m_alertingType;
803  bool m_needSoftKeyEndcall;
804  bool m_remoteHold;
805 
806  OpalMediaFormatList m_remoteMediaFormats;
807  std::set<MediaInfo> m_passThruMedia;
808  std::set<unsigned> m_simulatedTransmitters;
809 };
810 
811 
812 template <class MSG> bool OpalSkinnyEndPoint::DelegateMsg(const PhoneDevice & phone, const MSG & msg)
813 {
814  PSafePtr<OpalSkinnyConnection> connection = phone.m_activeConnection;
815  PTRACE_CONTEXT_ID_PUSH_THREAD(connection);
816  return connection == NULL || !connection.SetSafetyMode(PSafeReadWrite) || connection->OnReceiveMsg(msg);
817 }
818 
819 
820 #endif // OPAL_SKINNY
821 
822 #endif // OPAL_SKINNY_H
void PrintOn(ostream &strm) const
Definition: manager.h:150
Definition: rtpconn.h:57
PString GetName(const OpalMediaType &mediaType)
PSafePtr< OpalMediaStream > OpalMediaStreamPtr
Definition: mediastrm.h:493
Definition: mediatype.h:66
virtual void OnReleased()
PDECLARE_MUTEX(m_connectionsByRtpMutex)
Definition: transports.h:1104
Definition: transports.h:411
virtual PBoolean SetConnected()
virtual PSafePtr< OpalConnection > MakeConnection(OpalCall &call, const PString &party, void *userData=NULL, unsigned int options=0, OpalConnection::StringOptions *stringOptions=NULL)=0
Definition: mediafmt.h:112
OpalEndPoint & m_endpoint
Definition: connection.h:1961
Definition: connection.h:530
virtual WORD GetDefaultSignalPort() const
virtual PBoolean SetAlerting(const PString &calleeName, PBoolean withMedia)
Definition: mediafmt.h:806
#define PTRACE(level, section, args)
Definition: opalplugin.hpp:84
virtual PBoolean SetUpConnection()
Definition: call.h:62
virtual void ShutDown()
ostream & operator<<(ostream &strm, OpalSilenceDetector::Mode mode)
virtual void OnClosedMediaStream(const OpalMediaStream &stream)
virtual bool IsNetworkConnection() const =0
PSafePtr< OpalTransport > OpalTransportPtr
Definition: transports.h:50
Definition: mediastrm.h:110
virtual PString GetAlertingType() const
virtual PBoolean GarbageCollection()
virtual OpalMediaType::AutoStartMode GetAutoStart(const OpalMediaType &mediaType) const
Definition: transports.h:151
Definition: transports.h:326
virtual OpalMediaFormatList GetMediaFormats() const
Definition: rtpep.h:77
virtual PString GetDefaultTransport() const
virtual OpalTransportAddress GetRemoteAddress() const
Definition: connection.h:1738