OPAL  Version 3.18.8
console_mgr.h
Go to the documentation of this file.
1 /*
2  * console_mgs.h
3  *
4  * An OpalManager derived class for use in a console application, providing
5  * a standard set of command line arguments for configuring many system
6  * parameters. Used by the sample applications such as faxopal, ovropal etc.
7  *
8  * Copyright (c) 2010 Vox Lucida Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Open Phone Abstraction Library.
21  *
22  * The Initial Developer of the Original Code is Vox Lucida Pty. Ltd.
23  *
24  * Contributor(s): ______________________________________.
25  */
26 
27 #ifndef OPAL_OPAL_CONSOLE_MGR_H
28 #define OPAL_OPAL_CONSOLE_MGR_H
29 
30 #ifdef P_USE_PRAGMA
31 #pragma interface
32 #endif
33 
34 #include <opal.h>
35 #include <opal/manager.h>
36 #include <h323/h323ep.h>
37 #include <sip/sipep.h>
38 #include <sdp/sdphttpep.h>
39 #include <lids/lidep.h>
40 #include <lids/capi_ep.h>
41 #include <ep/pcss.h>
42 #include <ep/ivr.h>
43 #include <ep/opalmixer.h>
44 #include <ep/skinnyep.h>
45 #include <ep/lyncep.h>
46 
47 #include <ptclib/cli.h>
48 
49 
50 class OpalManagerConsole;
51 class OpalH281Client;
52 
53 
54 #define OPAL_CONSOLE_PREFIXES OPAL_PREFIX_SIP " " \
55  OPAL_PREFIX_H323 " " \
56  OPAL_PREFIX_SDP " " \
57  OPAL_PREFIX_SKINNY" " \
58  OPAL_PREFIX_LYNC" " \
59  OPAL_PREFIX_PSTN " " \
60  OPAL_PREFIX_CAPI " "
61 
62 
67 {
68 protected:
70 
71  void AddRoutesFor(const OpalEndPoint * endpoint, const PString & defaultRoute);
72 
73 public:
74  virtual ~OpalConsoleEndPoint() { }
75  virtual void GetArgumentSpec(ostream & strm) const = 0;
76  enum InitResult {
80  };
81  virtual bool Initialise(PArgList & args, bool verbose, const PString & defaultRoute) = 0;
82 #if P_CLI
83  virtual void AddCommands(PCLI & cli) = 0;
84 #endif
85 
86  void SetEndpointDisabled(bool disabled) { m_endpointDisabled = disabled; }
87 
88 protected:
91 };
92 
93 
94 #if OPAL_SIP || OPAL_H323
95 class OpalRTPEndPoint;
96 
98 {
99 protected:
101 
102  void GetArgumentSpec(ostream & strm) const;
103  bool Initialise(PArgList & args, ostream & output, bool verbose);
104 
105 #if P_CLI
106  PDECLARE_NOTIFIER(PCLI::Arguments, OpalRTPConsoleEndPoint, CmdInterfaces);
107  PDECLARE_NOTIFIER(PCLI::Arguments, OpalRTPConsoleEndPoint, CmdCryptoSuites);
108  PDECLARE_NOTIFIER(PCLI::Arguments, OpalRTPConsoleEndPoint, CmdBandwidth);
109  PDECLARE_NOTIFIER(PCLI::Arguments, OpalRTPConsoleEndPoint, CmdUserInputMode);
110  PDECLARE_NOTIFIER(PCLI::Arguments, OpalRTPConsoleEndPoint, CmdStringOption);
111  void AddCommands(PCLI & cli);
112 #endif //P_CLI
113 
114  bool SetUIMode(const PCaselessString & str);
115 
116 protected:
118 };
119 #endif // OPAL_SIP || OPAL_H323
120 
121 
122 #if OPAL_SIP
124 {
125  PCLASSINFO(SIPConsoleEndPoint, SIPEndPoint)
126 public:
128 
129  virtual void GetArgumentSpec(ostream & strm) const;
130  virtual bool Initialise(PArgList & args, bool verbose, const PString & defaultRoute);
131 
132 #if P_CLI
133  PDECLARE_NOTIFIER(PCLI::Arguments, SIPConsoleEndPoint, CmdProxy);
134  PDECLARE_NOTIFIER(PCLI::Arguments, SIPConsoleEndPoint, CmdRegister);
135  virtual void AddCommands(PCLI & cli);
136 #endif // P_CLI
137 
138  virtual void OnRegistrationStatus(const RegistrationStatus & status);
139  bool DoRegistration(ostream & output,
140  bool verbose,
141  const PString & aor,
142  const PString & pwd,
143  const PArgList & args,
144  const char * authId,
145  const char * realm,
146  const char * proxy,
147  const char * mode,
148  const char * ttl);
149 };
150 #endif // OPAL_SIP
151 
152 
153 #if OPAL_SDP && OPAL_PTLIB_HTTP
154 class OpalSDPHTTPConsoleEndPoint : public OpalSDPHTTPEndPoint, public OpalRTPConsoleEndPoint
155 {
156  PCLASSINFO(OpalSDPHTTPConsoleEndPoint, OpalSDPHTTPEndPoint)
157 public:
158  OpalSDPHTTPConsoleEndPoint(OpalManagerConsole & manager);
159  virtual void GetArgumentSpec(ostream & strm) const;
160  virtual bool Initialise(PArgList & args, bool verbose, const PString & defaultRoute);
161 };
162 #endif // OPAL_SDP && OPAL_PTLIB_HTTP
163 
164 
165 #if OPAL_H323
167 {
168  PCLASSINFO(H323ConsoleEndPoint, H323EndPoint)
169 public:
171  virtual void GetArgumentSpec(ostream & strm) const;
172  virtual bool Initialise(PArgList & args, bool verbose, const PString & defaultRoute);
173 
174 #if P_CLI
175  PDECLARE_NOTIFIER(PCLI::Arguments, H323ConsoleEndPoint, CmdTerminalType);
176  PDECLARE_NOTIFIER(PCLI::Arguments, H323ConsoleEndPoint, CmdAlias);
177  PDECLARE_NOTIFIER(PCLI::Arguments, H323ConsoleEndPoint, CmdGatekeeper);
178  PDECLARE_NOTIFIER(PCLI::Arguments, H323ConsoleEndPoint, CmdCompatibility);
179  virtual void AddCommands(PCLI & cli);
180 #endif // P_CLI
181 
182  virtual void OnGatekeeperStatus(H323Gatekeeper & gk, H323Gatekeeper::RegistrationFailReasons status);
183  bool UseGatekeeperFromArgs(const PArgList & args, const char * host, const char * ident, const char * pass, const char * inter);
184 };
185 #endif // OPAL_H323
186 
187 
188 #if OPAL_SKINNY
189 class OpalConsoleSkinnyEndPoint : public OpalSkinnyEndPoint, public OpalConsoleEndPoint
190 {
191  PCLASSINFO(OpalConsoleSkinnyEndPoint, OpalSkinnyEndPoint)
192 public:
193  OpalConsoleSkinnyEndPoint(OpalManagerConsole & manager);
194 
195  virtual void GetArgumentSpec(ostream & strm) const;
196  virtual bool Initialise(PArgList & args, bool verbose, const PString & defaultRoute);
197 
198 #if P_CLI
199  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsoleSkinnyEndPoint, CmdRegister);
200  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsoleSkinnyEndPoint, CmdStatus);
201  virtual void AddCommands(PCLI & cli);
202 #endif // P_CLI
203 };
204 #endif // OPAL_SKINNY
205 
206 
207 #if OPAL_LYNC
208 class OpalConsoleLyncEndPoint : public OpalLyncEndPoint, public OpalConsoleEndPoint
209 {
210  PCLASSINFO(OpalConsoleLyncEndPoint, OpalLyncEndPoint)
211 public:
212  OpalConsoleLyncEndPoint(OpalManagerConsole & manager);
213 
214  virtual void GetArgumentSpec(ostream & strm) const;
215  virtual bool Initialise(PArgList & args, bool verbose, const PString & defaultRoute);
216 
217 #if P_CLI
218  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsoleLyncEndPoint, CmdRegister);
219  virtual void AddCommands(PCLI & cli);
220 #endif // P_CLI
221 };
222 #endif // OPAL_LYNC
223 
224 
225 #if OPAL_LID
227 {
229 public:
231 
232  virtual void GetArgumentSpec(ostream & strm) const;
233  virtual bool Initialise(PArgList & args, bool verbose, const PString & defaultRoute);
234 
235 #if P_CLI
236  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsoleLineEndPoint, CmdCountry);
237  virtual void AddCommands(PCLI & cli);
238 #endif // P_CLI
239 };
240 #endif // OPAL_LID
241 
242 
243 #if OPAL_CAPI
244 class OpalConsoleCapiEndPoint : public OpalCapiEndPoint, public OpalConsoleEndPoint
245 {
246  PCLASSINFO(OpalConsoleCapiEndPoint, OpalCapiEndPoint)
247 public:
248  OpalConsoleCapiEndPoint(OpalManagerConsole & manager);
249 
250  virtual void GetArgumentSpec(ostream & strm) const;
251  virtual bool Initialise(PArgList & args, bool verbose, const PString & defaultRoute);
252 
253 #if P_CLI
254  virtual void AddCommands(PCLI & cli);
255 #endif // P_CLI
256 };
257 #endif // OPAL_CAPI
258 
259 
260 #if OPAL_HAS_PCSS
262 {
264 public:
266 
267  virtual void GetArgumentSpec(ostream & strm) const;
268  virtual bool Initialise(PArgList & args, bool verbose, const PString &);
269 
270 #if P_CLI
271  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdRingFileAndDevice);
272  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdRingbackTone);
273  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdVolume);
274  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdDefaultAudioDevice);
275  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdChangeAudioDevice);
276  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdAudioBuffers);
277 #if OPAL_VIDEO
278  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdDefaultVideoDevice);
279  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdChangeVideoDevice);
280  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdOpenVideoStream);
281  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdCloseVideoStream);
282 
283  bool SetPresentationVideoDevice(const PVideoDevice::OpenArgs & args) { return m_manager.SetVideoInputDevice(args, OpalVideoFormat::ePresentation); }
284  const PVideoDevice::OpenArgs & GetPresentationVideoDevice() const { return m_manager.GetVideoInputDevice(OpalVideoFormat::ePresentation); }
285  bool SetPresentationPreviewDevice(const PVideoDevice::OpenArgs & args) { return m_manager.SetVideoPreviewDevice(args, OpalVideoFormat::ePresentation); }
286  const PVideoDevice::OpenArgs & GetPresentationPreviewDevice() const { return m_manager.GetVideoPreviewDevice(OpalVideoFormat::ePresentation); }
287  bool SetPresentationOutputDevice(const PVideoDevice::OpenArgs & args) { return m_manager.SetVideoOutputDevice(args, OpalVideoFormat::ePresentation); }
288  const PVideoDevice::OpenArgs & GetPresentationOutputDevice() const { return m_manager.GetVideoOutputDevice(OpalVideoFormat::ePresentation); }
289  bool SetSpeakerVideoDevice(const PVideoDevice::OpenArgs & args) { return m_manager.SetVideoInputDevice(args, OpalVideoFormat::eSpeaker); }
290  const PVideoDevice::OpenArgs & GetSpeakerVideoDevice() const { return m_manager.GetVideoInputDevice(OpalVideoFormat::eSpeaker); }
291  bool SetSpeakerPreviewDevice(const PVideoDevice::OpenArgs & args) { return m_manager.SetVideoPreviewDevice(args, OpalVideoFormat::eSpeaker); }
292  const PVideoDevice::OpenArgs & GetSpeakerPreviewDevice() const { return m_manager.GetVideoPreviewDevice(OpalVideoFormat::eSpeaker); }
293  bool SetSpeakerOutputDevice(const PVideoDevice::OpenArgs & args) { return m_manager.SetVideoOutputDevice(args, OpalVideoFormat::eSpeaker); }
294  const PVideoDevice::OpenArgs & GetSpeakerOutputDevice() const { return m_manager.GetVideoOutputDevice(OpalVideoFormat::eSpeaker); }
295  bool SetSignVideoDevice(const PVideoDevice::OpenArgs & args) { return m_manager.SetVideoInputDevice(args, OpalVideoFormat::eSignLanguage); }
296  const PVideoDevice::OpenArgs & GetSignVideoDevice() const { return m_manager.GetVideoInputDevice(OpalVideoFormat::eSignLanguage); }
297  bool SetSignPreviewDevice(const PVideoDevice::OpenArgs & args) { return m_manager.SetVideoPreviewDevice(args, OpalVideoFormat::eSignLanguage); }
298  const PVideoDevice::OpenArgs & GetSignPreviewDevice() const { return m_manager.GetVideoPreviewDevice(OpalVideoFormat::eSignLanguage); }
299  bool SetSignOutputDevice(const PVideoDevice::OpenArgs & args) { return m_manager.SetVideoOutputDevice(args, OpalVideoFormat::eSignLanguage); }
300  const PVideoDevice::OpenArgs & GetSignOutputDevice() const { return m_manager.GetVideoOutputDevice(OpalVideoFormat::eSignLanguage); }
301 #endif // OPAL_VIDEO
302 #if OPAL_HAS_H281
303  PDECLARE_NOTIFIER(PCLI::Arguments, OpalConsolePCSSEndPoint, CmdExternalCameraControl);
304  PDECLARE_NOTIFIER(OpalH281Client, OpalConsolePCSSEndPoint, ExternalCameraControlNotification);
305 #endif
306 
307  virtual void AddCommands(PCLI & cli);
308 #endif // P_CLI
309 
310  void SetRingInfo(ostream & out, bool verbose, const PString & filename, const PString & device, const PString & driver);
311 
312  // Various call backs
313  virtual bool OnIncomingCall(OpalLocalConnection & connection);
314  virtual void OnConnected(OpalConnection & connection);
315  virtual void OnReleased(OpalConnection & connection);
316  virtual void ShutDown();
317 
318  protected:
319  PFilePath m_ringFileName;
320  PSoundChannel::Params m_ringChannelParams;
321  PThread * m_ringThread;
322  PSyncPoint m_ringSignal;
324  {
327  e_RingShutDown
328  } m_ringState;
329  void RingThreadMain();
330 };
331 #endif // OPAL_HAS_PCSS
332 
333 
334 #if OPAL_IVR
336 {
338 public:
340 
341  virtual void GetArgumentSpec(ostream & strm) const;
342  virtual bool Initialise(PArgList & args, bool, const PString &);
343 
344 #if P_CLI
345  virtual void AddCommands(PCLI &);
346 #endif // P_CLI
347 };
348 #endif // OPAL_IVR
349 
350 
351 #if OPAL_HAS_MIXER
353 {
355 public:
357 
358  virtual void GetArgumentSpec(ostream & strm) const;
359  virtual bool Initialise(PArgList & args, bool, const PString &);
360 
361 #if P_CLI
362  virtual void AddCommands(PCLI &);
363 #endif // P_CLI
364 };
365 #endif // OPAL_HAS_MIXER
366 
367 
374 {
375  PCLASSINFO(OpalManagerConsole, OpalManager);
376 
377  public:
379  const char * endpointPrefixes = OPAL_CONSOLE_PREFIXES
380  );
382 
383  virtual PString GetArgumentSpec() const;
384  virtual void Usage(ostream & strm, const PArgList & args);
385 
386  bool PreInitialise(PArgList & args, bool verbose = false);
387 
388  virtual bool Initialise(
389  PArgList & args,
390  bool verbose = false,
391  const PString & defaultRoute = PString::Empty()
392  );
393  virtual void Run();
394  virtual void EndRun(bool interrupt = false);
395  virtual void Broadcast(const PString & msg);
396 
397  virtual bool OnLocalOutgoingCall(const OpalLocalConnection & connection);
398  virtual void OnEstablishedCall(OpalCall & call);
399  virtual void OnHold(OpalConnection & connection, bool fromRemote, bool onHold);
400  virtual bool OnChangedPresentationRole(OpalConnection & connection, const PString & newChairURI, bool request);
401  virtual void OnStartMediaPatch(OpalConnection & connection, OpalMediaPatch & patch);
402  virtual void OnClosedMediaStream(const OpalMediaStream & stream);
403  virtual void OnFailedMediaStream(OpalConnection & connection, bool fromRemote, const PString & reason);
404  virtual void OnUserInputString(OpalConnection & connection, const PString & value);
405  virtual void OnClearedCall(OpalCall & call);
406 
407  class LockedStream : PWaitAndSignal
408  {
409  protected:
410  ostream & m_stream;
411  public:
413  : PWaitAndSignal(mgr.m_outputMutex)
414  , m_stream(*mgr.m_outputStream)
415  {
416  }
417 
418  ostream & operator *() const { return m_stream; }
419  operator ostream & () const { return m_stream; }
420  };
421  friend class LockedStream;
422  __inline LockedStream LockedOutput() const { return *this; }
423 
424 
425  bool GetCallFromArgs(PCLI::Arguments & args, PSafePtr<OpalCall> & call);
426 
427  template <class CONTYPE> bool GetConnectionFromArgs(PCLI::Arguments & args, PSafePtr<CONTYPE> & connection)
428  {
429  PSafePtr<OpalCall> call;
430  if (!GetCallFromArgs(args, call))
431  return false;
432 
433  if ((connection = call->GetConnectionAs<CONTYPE>(0)) != NULL)
434  return true;
435 
436  args.WriteError("Not a suitable call for operation.");
437  return false;
438  }
439 
440  bool GetStreamFromArgs(
441  PCLI::Arguments & args,
442  const OpalMediaType & mediaType,
443  bool source,
444  PSafePtr<OpalMediaStream> & stream
445  );
446 
447  protected:
448  OpalConsoleEndPoint * GetConsoleEndPoint(const PString & prefix);
449 
450 #if OPAL_H323
451  virtual H323ConsoleEndPoint * CreateH323EndPoint();
452 #endif
453 #if OPAL_SIP
454  virtual SIPConsoleEndPoint * CreateSIPEndPoint();
455 #endif
456 #if OPAL_SDP_HTTP
457  virtual OpalSDPHTTPConsoleEndPoint * CreateSDPHTTPEndPoint();
458 #endif
459 #if OPAL_SKINNY
460  virtual OpalConsoleSkinnyEndPoint * CreateSkinnyEndPoint();
461 #endif
462 #if OPAL_LYNC
463  virtual OpalConsoleLyncEndPoint * CreateLyncEndPoint();
464 #endif
465 #if OPAL_LID
466  virtual OpalConsoleLineEndPoint * CreateLineEndPoint();
467 #endif
468 #if OPAL_CAPI
469  virtual OpalConsoleCapiEndPoint * CreateCapiEndPoint();
470 #endif
471 
472 #if OPAL_HAS_PCSS
473  virtual OpalConsolePCSSEndPoint * CreatePCSSEndPoint();
474 #endif
475 #if OPAL_IVR
476  virtual OpalConsoleIVREndPoint * CreateIVREndPoint();
477 #endif
478 #if OPAL_HAS_MIXER
479  virtual OpalConsoleMixerEndPoint * CreateMixerEndPoint();
480 #endif
481 
482  PStringArray m_endpointPrefixes;
483 
484  PSyncPoint m_endRun;
485  unsigned m_interrupted;
486  bool m_verbose;
487  ostream * m_outputStream;
488  PDECLARE_MUTEX(m_outputMutex, OpalConsoleOutput);
489 
491 
492 #if OPAL_STATISTICS
493  PTimeInterval m_statsPeriod;
494  PFilePath m_statsFile;
495  typedef map<PString, OpalMediaStatistics> StatsMap;
497  PDECLARE_MUTEX(m_statsMutex, OpalConsoleStats);
498  virtual bool OutputStatistics();
499  virtual bool OutputStatistics(ostream & strm);
500  virtual bool OutputCallStatistics(ostream & strm, OpalCall & call);
501  virtual bool OutputStreamStatistics(ostream & strm, const OpalMediaStream & stream);
502 #endif
503 };
504 
505 typedef OpalManagerConsole OpalConsoleManager; // Backward compatibility
506 
507 #if P_CLI
508 
515 class OpalManagerCLI : public OpalManagerConsole
516 {
517  PCLASSINFO(OpalManagerCLI, OpalManagerConsole);
518 
519  public:
520  OpalManagerCLI(
521  const char * endpointPrefixes = OPAL_CONSOLE_PREFIXES
522  );
523  ~OpalManagerCLI();
524 
525  // Overrides from OpalManagerConsole
526  virtual PString GetArgumentSpec() const;
527  virtual bool Initialise(
528  PArgList & args,
529  bool verbose,
530  const PString & defaultRoute = PString::Empty()
531  );
532  virtual void Run();
533  virtual void EndRun(bool interrupt = false);
534  virtual void Broadcast(const PString & msg);
535 
536  protected:
537  PCLI * CreateCLIStandard();
538 #if P_TELNET
539  PCLITelnet * CreateCLITelnet(WORD port);
540 #endif
541 #if P_CURSES
542  PCLICurses * CreateCLICurses();
543 #endif
544 
545  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdIpTcpPorts);
546  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdIpUdpPorts);
547  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdIpRtpPorts);
548  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdIpRtpTos);
549  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdIpRtpSize);
550  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdIpQoS);
551  #if OPAL_PTLIB_SSL
552  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdSSL);
553 #endif
554 #if P_NAT
555  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdNatList);
556  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdNatServer);
557 #endif
558 
559 #if PTRACING
560  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdTrace);
561 #endif
562 
563 #if OPAL_STATISTICS
564  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdStatistics);
565 #endif
566 
567 #if OPAL_HAS_H281
568  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdFarEndCamera);
569 #endif
570 
571  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdAudioCodec);
572 #if OPAL_VIDEO
573  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdVideoCodec);
574  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdVideoDefault);
575  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdVideoTransmit);
576  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdVideoReceive);
577  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdPresentationToken);
578 #endif // OPAL_VIDEO
579 
580 #if OPAL_HAS_MIXER
581  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdRecord);
582 #endif
583  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdSilenceDetect);
584  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdAutoStart);
585  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdCodecList);
586  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdCodecOrder);
587  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdCodecMask);
588  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdCodecOption);
589 
590  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdCall);
591  virtual void AdjustCmdCallArguments(PString & from, PString & to);
592  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdHold);
593  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdRetrieve);
594  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdTransfer);
595  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdHangUp);
596  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdSendUserInput);
597  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdWaitPhase);
598 #if OPAL_STATISTICS
599  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdWaitPackets);
600 #endif
601  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdShowCalls);
602 
603  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdDelay);
604  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdVersion);
605  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdQuit);
606  PDECLARE_NOTIFIER(PCLI::Arguments, OpalManagerCLI, CmdShutDown);
607 
608  PCLI * m_cli;
609 };
610 
611 #endif // P_CLI
612 
613 
616 template <class Manager,
617  const char Manuf[],
618  const char Name[],
619  unsigned MajorVersion = OPAL_MAJOR,
620  unsigned MinorVersion = OPAL_MINOR,
621  PProcess::CodeStatus Status = PProcess::ReleaseCode,
622  unsigned PatchVersion = OPAL_PATCH,
623  unsigned OemVersion = OPAL_OEM,
624  bool Verbose = true>
625 class OpalConsoleProcess : public PProcess
626 {
627  PCLASSINFO(OpalConsoleProcess, PProcess)
628  public:
630  : PProcess(Manuf, Name, MajorVersion, MinorVersion, Status, PatchVersion, false, false, OemVersion)
631  , m_manager(NULL)
632  {
633  }
634 
636  {
637  delete this->m_manager;
638  }
639 
640  virtual void Main()
641  {
642  this->SetTerminationValue(1);
643  this->m_manager = new Manager;
644  if (this->m_manager->Initialise(this->GetArguments(), Verbose)) {
645  this->SetTerminationValue(0);
646  this->m_manager->Run();
647  }
648  }
649 
650  virtual bool OnInterrupt(bool)
651  {
652  if (this->m_manager == NULL)
653  return false;
654 
655  this->m_manager->EndRun(true);
656  return true;
657  }
658 
659  private:
660  Manager * m_manager;
661 };
662 
663 
664 #endif // OPAL_OPAL_CONSOLE_MGR_H
665 
666 
#define OPAL_PATCH
Definition: opal_config.h:41
Definition: console_mgr.h:97
OpalManagerConsole OpalConsoleManager
Definition: console_mgr.h:505
Definition: manager.h:150
Definition: endpoint.h:65
virtual void OnRegistrationStatus(const RegistrationStatus &status)
Definition: console_mgr.h:325
This file contains a simplified API to the OPAL system. It provides a pure &quot;C&quot; language interface as ...
Definition: console_mgr.h:326
PStringArray m_endpointPrefixes
Definition: console_mgr.h:482
Definition: localep.h:469
bool GetConnectionFromArgs(PCLI::Arguments &args, PSafePtr< CONTYPE > &connection)
Definition: console_mgr.h:427
map< PString, OpalMediaStatistics > StatsMap
Definition: console_mgr.h:495
~OpalConsoleProcess()
Definition: console_mgr.h:635
LockedStream(const OpalManagerConsole &mgr)
Definition: console_mgr.h:412
Definition: sipep.h:52
InitResult
Definition: console_mgr.h:76
Definition: mediatype.h:66
void AddRoutesFor(const OpalEndPoint *endpoint, const PString &defaultRoute)
Definition: console_mgr.h:66
RegistrationFailReasons
Definition: gkclient.h:274
#define OPAL_MAJOR
Definition: opal_config.h:39
OpalRTPEndPoint & m_endpoint
Definition: console_mgr.h:117
virtual ~OpalConsoleEndPoint()
Definition: console_mgr.h:74
PSyncPoint m_ringSignal
Definition: console_mgr.h:322
unsigned m_interrupted
Definition: console_mgr.h:485
void GetArgumentSpec(ostream &strm) const
OpalRTPConsoleEndPoint(OpalManagerConsole &console, OpalRTPEndPoint *endpoint)
PFilePath m_ringFileName
Definition: console_mgr.h:319
virtual bool Initialise(PArgList &args, bool verbose, const PString &defaultRoute)
Definition: lidep.h:53
virtual bool OnInterrupt(bool)
Definition: console_mgr.h:650
Definition: patch.h:56
Definition: console_mgr.h:79
PSoundChannel::Params m_ringChannelParams
Definition: console_mgr.h:320
SIPConsoleEndPoint(OpalManagerConsole &manager)
bool SetUIMode(const PCaselessString &str)
Definition: call.h:62
Definition: console_mgr.h:78
Definition: console_mgr.h:166
Definition: pcss.h:51
Definition: opalmixer.h:588
void SetEndpointDisabled(bool disabled)
Definition: console_mgr.h:86
PFilePath m_statsFile
Definition: console_mgr.h:494
Definition: console_mgr.h:261
bool m_verbose
Definition: console_mgr.h:486
__inline LockedStream LockedOutput() const
Definition: console_mgr.h:422
Definition: sipep.h:440
OpalConsoleProcess()
Definition: console_mgr.h:629
OpalConsoleEndPoint(OpalManagerConsole &console)
Definition: console_mgr.h:69
RingState
Definition: console_mgr.h:323
bool Initialise(PArgList &args, ostream &output, bool verbose)
virtual void GetArgumentSpec(ostream &strm) const =0
Definition: h281handler.h:44
Definition: console_mgr.h:77
Definition: console_mgr.h:226
PThread * m_ringThread
Definition: console_mgr.h:321
Definition: mediastrm.h:110
Definition: console_mgr.h:407
Definition: gkclient.h:60
Definition: connection.h:415
bool m_endpointDisabled
Definition: console_mgr.h:90
#define OPAL_MINOR
Definition: opal_config.h:40
virtual bool Initialise(PArgList &args, bool verbose, const PString &defaultRoute)=0
#define OPAL_OEM
Definition: opal_config.h:42
#define OPAL_CONSOLE_PREFIXES
Definition: console_mgr.h:54
virtual void Main()
Definition: console_mgr.h:640
virtual void GetArgumentSpec(ostream &strm) const
Definition: console_mgr.h:123
Definition: h323ep.h:82
bool DoRegistration(ostream &output, bool verbose, const PString &aor, const PString &pwd, const PArgList &args, const char *authId, const char *realm, const char *proxy, const char *mode, const char *ttl)
Definition: console_mgr.h:335
Definition: rtpep.h:77
PString m_lastCallToken
Definition: console_mgr.h:490
Definition: console_mgr.h:625
OpalManagerConsole & m_console
Definition: console_mgr.h:89
Definition: console_mgr.h:352
ostream & m_stream
Definition: console_mgr.h:410
PTimeInterval m_statsPeriod
Definition: console_mgr.h:493
PSyncPoint m_endRun
Definition: console_mgr.h:484
StatsMap m_statistics
Definition: console_mgr.h:496
ostream * m_outputStream
Definition: console_mgr.h:487
Definition: console_mgr.h:373
Definition: ivr.h:53