⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.cxx

📁 softphone client for test
💻 CXX
📖 第 1 页 / 共 5 页
字号:
             "T-h245tunneldisable."  "-no-h245tunneldisable."
#if PTRACING
             "t-trace."              "-no-trace."
#endif
             "-tos:"                 "-no-tos."
             "-translate:"
             "u-user:"               "-no-user."
	     "U-userinputcap:"       "-no-user-input-cap."
             "v-verbose:"            "-no-verbose."
             "-disable-menu."        "-no-disable-menu."
#ifdef HAS_IXJ
             "-aec:"                 "-no-aec."
             "-dial-after-hangup."   "-no-dial-after-hangup."
             "-callerid."            "-no-callerid."
             "-calleridcw."          "-no-calleridcw."
             "-autohook."            "-no-autohook."
             "-quicknet-recvol:"     "-no-quicknet-recvol."
             "-quicknet-playvol:"    "-no-quicknet-playvol."
#endif

             "-g728."                "-no-g728."
#ifdef  G729
             "-g729."                "-no-g729."
#endif
             "-gsm."                 "-no-gsm."
             "-gsmframes:"           "-no-gsmframes."
             "-g711-ulaw."           "-no-g711-ulaw."
             "-g711-alaw."           "-no-g711-alaw."
             "-g711frames:"          "-no-g711frames."
             "-g7231."               "-no-g7231."
             "-h261:"                "-no-h261."
             "-playvol:"             "-no-playvol."
             "-recvol:"              "-no-recvol."
             "-ringfile:"
             "-ringdelay:"

             "-videotransmit."       "-no-videotransmit."
             "-videolocal."          "-no-videolocal."
             "-videosize:"           "-no-videosize."
             "-videoformat:"         "-no-videoformat."
             "-videocolorfmt:"       "-no-videocolorfmt."
             "-videoinput:"          "-no-videoinput."
             "-videodevice:"         "-no-videodevice."

             "-videoreceive:"        "-no-videoreceive."
             "-videoquality:"        "-no-videoquality."
             "-videotxquality:"      "-no-videotxquality."
             "-videotxminquality:"   "-no-videotxminquality."
             "-videoidle:"           "-no-videoidle."
             "-videopip."            "-no-videopip."
             "-videofill:"           "-no-videofill."
             "-videotxfps:"          "-no-videotxfps."
             "-videobitrate:"        "-no-videobitrate."
             "-videotest."           "-no-videotest."
	     "-videolose:"           "-no-videolose."
#ifdef DEPRECATED_CU30
             "-videocu30stats:"      "-no-videocu30stats."
             "-videocu30."           "-no-videocu30."
#endif
             "-autodisconnect:"
             "-autorepeat:"

             "-portbase:"
             "-portmax:"

          , FALSE);

#if PMEMORY_CHECK
  if (args.HasOption("setallocationbreakpoint"))
    PMemoryHeap::SetAllocationBreakpoint(args.GetOptionString("setallocationbreakpoint").AsInteger());
#endif


  int verbose = 255;
  if (args.HasOption('v'))
    verbose = args.GetOptionString('v').AsInteger();

  if (verbose >= 3)
    cout << GetName()
         << " Version " << GetVersion(TRUE)
         << " by " << GetManufacturer()
         << " on " << GetOSClass() << ' ' << GetOSName()
         << " (" << GetOSVersion() << '-' << GetOSHardware() << ")\n\n";

#if PTRACING
  PTrace::Initialise(args.GetOptionCount('t'),
                     args.HasOption('o') ? (const char *)args.GetOptionString('o') : NULL,
         PTrace::Blocks | PTrace::Timestamp | PTrace::Thread | PTrace::FileAndLine);
#endif

  if (args.HasOption('h') || (!args.HasOption('l') && args.GetCount() == 0)) {
    cout << "Usage : " << GetName() << " [options] -l\n"
            "      : " << GetName() << " [options] [-p host] hostname/alias\n"
      "\n   where:  hostname/alias = Remote host/alias to call\n"
            "\nOptions:\n"
            "  -a --auto-answer        : Automatically answer incoming calls\n"
            "  -d --autodial host      : Autodial host if phone off hook\n"
            "  -h --help               : Display this help message.\n"
            "  -l --listen             : Only listen for incoming calls\n"
            "  -v --verbose n          : Set amount of information displayed (0=none)\n"
            "  --disable-menu          : Disable internal menu\n"
            "  --ringfile filename     : Set sound file for \"ring\" annunciation\n"
            "  --ringdelay seconds     : Set delay between playing above file\n"
            "  --save                  : Save parameters in configuration file.\n"

            "\nGatekeeper options:\n"
            "  -g --gatekeeper host    : Specify gatekeeper host.\n"
            "  -G --gatekeeper-id name : Specify gatekeeper by ID.\n"
            "  -n --no-gatekeeper      : Disable gatekeeper discovery.\n"
            "  -r --require-gatekeeper : Exit if gatekeeper discovery fails.\n"
            "     --password pwd       : Password for gatekeeper H.235 authentication.\n"
            "  -p --proxy host         : Proxy/Gateway hostname/ip address\n"

            "\nDivert options:\n"
            "  -F --forward-always party    : Forward to remote party.\n"
            "  -B --forward-busy party      : Forward to remote party if busy.\n"
            "  -N --forward-no-answer party : Forward to remote party if no answer.\n"
            "     --answer-timeout time     : Time in seconds till forward on no answer.\n"

            "\nProtocol options:\n"
            "  -i --interface ipaddr   : Select interface to bind to for incoming connections (default is all interfaces)\n"
            "  --listenport            : Port to listen on for incoming connections (default 1720)\n"
            "  --no-listenport         : No listen port\n"
            "  --connectport port      : Port to connect to for outgoing connections (default 1720)\n"
            "  --connectring num       : Distinctive ring number to send to remote - 0 (default) to 7\n"
            "  -b --bandwidth n        : Limit bandwidth usage to (n * 100) bits/second\n"
            "  -f --fast-disable       : Disable fast start\n"
            "  -T --h245tunneldisable  : Disable H245 tunnelling.\n"
            "  -u --user name          : Set local alias name(s) (defaults to login name)\n"
	    "  -S --disable-h245-in-setup Disable H245 in setup\n"
            "  --tos n                 : Set IP Type of Service byte to n\n"
            "  --setup-param string    : Arbitrary data to be put into H.225 Setup PDU\n"
            "  --portbase port         : Base port for H.245 and RTP data\n"
            "  --portmax port          : Maximum port for H.245 and RTP data\n"
            "  --translate ip          : Set external IP address to ip if masQueraded\n"

            "\nAudio options:\n"
            "  -e --silence            : Disable silence detection for GSM and software G.711\n"
            "  -j --jitter [min-]max   : Set minimum (optional) and maximum jitter buffer (in milliseconds).\n"
            "  --recvol n              : Set record volume\n"
            "  --playvol n             : Set play volume\n"

            "\nVideo transmit options:\n"
            "  --videodevice dev       : Select video capture device (default " DEFAULT_VIDEO ")\n"
            "  --videotransmit         : Enable video transmission\n"
            "  --videolocal            : Enable local video window\n"
            "  --videosize size        : Sets size of transmitted video window\n"
            "                             size can be small (default) or large\n"
            "  --videoformat type      : Set capture video format\n"
            "                             can be auto (default) pal or ntsc\n"
            "  --videocolorfmt format  : Set the preferred capture device color format\n"
            "                             can be RGB24, RGB24F, RGB32, ...\n"
            "  --videoinput num        : Select capture video input (default is 0)\n"
            "  --videotxquality n      : Select sent video quality,(def 9). 1(best)<=n<=31\n"
            "  --videotxminquality n   : Select video quality lower limit,(def 1). 1(best)<=n<=31\n"
            "                             A value of 4 works best for NetMeeting\n" 
            "  --videofill n           : Select number of updated background blocks per frame 2(def)<=n<=99\n"
            "  --videotxfps n          : Maximum number of video frames grabbed per sec 2<10(def)<30\n"
            "  --videosendfps n        : Target minimum number of video frames sent per sec 0.001<6(def)<30\n"
            "  --videobitrate n        : Enable bitrate control.   16< n <2048 kbit/s (net bw)\n"
            "\nVideo receive options:\n"
            "  --videoquality n        : Set received video quality hint - 0 <= n <= 31\n"
            "  --videoreceive viddev   : Receive video to following device\n"
            "                          :      null     do nothing\n"
            "                          :      ppm      create sequence of PPM files\n"
#ifdef HAS_VGALIB
            "                          :      svga256  256 colour VGA (Linux only)\n"
            "                          :      svga     full colour VGA (Linux only)\n"
#endif
#ifdef P_SDL
            "                          :      sdl      Use Simple DirectMedia Library\n"
            " --videopip               : Local video is displayed in adjacent smaller window\n"
#endif
#ifdef HAS_X11
            "                          :      x11       automatically pick best X11 mode\n"
            "                          :      x1124     X11 using 24 bit colour\n"
            "                          :      x1116     X11 using 16 bit colour\n"
            "                          :      x118      X11 using 8 bit grey scale\n"
            "  --videopip              : Local video is displayed in corner of received video\n"
#endif // HAS_X11

            "\nVideo options:\n"
            "  --videotest             : Display local video. Exit after 10 seconds. NO h323 call\n"
            "  --videolose             : Delete this percentage of the video rtp packets.- For videotest only. Default 0\n"
#ifdef DEPRECATED_CU30
            "  --videocu30             : Enable Cu30 codec\n"
            "  --videocu30stats n      : Collect stats for n frames, to optimise subsequent calls. (100-10000)\n"
#endif

            "\nSound card options:\n"
            "  -s --sound device       : Select sound card input/output device\n"
            "  --sound-in device       : Select sound card input device (overrides --sound)\n"
            "  --sound-out device      : Select sound card output device (overrides --sound)\n"
            "  --sound-buffers n       : Set sound buffer depth (default=2)\n"

#ifdef HAS_OSS
            "  --sound-mixer device    : Select sound mixer device (default is " DEFAULT_MIXER ")\n"
            "  --sound-recchan device  : Select sound mixer channel (default is mic)\n"
            "  --sound-recvol n        : Set record volume for sound card only (overrides --recvol)\n"
            "  --sound-playvol n       : Set play volume for sound card only (overrides --playvol)\n"
#endif

#ifdef HAS_IXJ
            "\nQuicknet card options:\n"
            "  -q -quicknet dev        : Use device (number or full device name)\n"
            "  -C --country name       : Set the country code for Quicknet device\n"
            "  --aec n                 : Set Audio Echo Cancellation level (0..3)\n"
            "  --autohook              : Don't use hook switch (for PhoneCard)\n"
            "  -c --callerid           : Enable caller id display\n"
            "  --calleridcw            : Enable caller id on call waiting display\n"
            "  --dial-after-hangup     : Present dial tone after remote hang up\n"
            "  --quicknet-recvol n     : Set record volume for Quicknet card only (overrides recvol)\n"
            "  --quicknet-playvol n    : Set play volume for Quicknet card only (overrides playvol)\n"
#endif

#ifdef HAS_VBLASTER
            "\nVoIPBlaster options:\n"
            "  -V --voipblaster num    : Use device number\n"
#endif

            "\nAudio Codec options:\n"
            "  -D --disable codec      : Disable the specified codec (may be used multiple times)\n"
            "  -P --prefer codec       : Prefer the specified codec (may be used multiple times)\n"
            "  --g711frames count      : Set the number G.711 frames in capabilities (default 30)\n"
            "  --gsmframes count       : Set the number GSM frames in capabilities (default 4)\n"

#if defined(HAS_LIDDEVICE)
            "  --g7231                 : Set G.723.1 as preferred codec\n"
#endif
            "  --gsm                   : Set GSM 06.10 as preferred codec (default)\n"
            "  --g711-ulaw             : Set G.711 uLaw as preferred codec\n"
            "  --g711-alaw             : Set G.711 ALaw as preferred codec\n"
            "  --g728                  : Set G.728 as preferred codec\n"
#ifdef  G729
            "  --g729                  : Set G.729 as preferred codec\n"
#endif
            "  --g7231                 : Set G.723.1 as preferred codec\n"
            "  -I --input-mode mode    : Set the mode for sending User Input Indications (DTMF)\n"
            "                             can be string, signal, q931 or rfc2833 (default is string)\n"
            "  -U --user-input-cap mode : Set the mode for User Input Capabilities\n"
            "                             can be string, signal, rfc2833 or none (default is all)\n"

#if PTRACING || PMEMORY_CHECK
            "\nDebug options:\n"
#endif
#if PTRACING
            "  -t --trace              : Enable trace, use multiple times for more detail\n"
            "  -o --output             : File for trace output, default is stderr\n"
#endif
#ifdef PMEMORY_CHECK
      "  --setallocationbreakpoint n : Enable breakpoint on memory allocation n\n"
#endif
            << endl;
    return;
  }

  BOOL hasMenu = !args.HasOption("disable-menu");

  int autoRepeat;
  if (!args.HasOption("autorepeat"))
    autoRepeat = -1;
  else {
    autoRepeat = args.GetOptionString("autorepeat").AsInteger();
    if (autoRepeat < 1) {
      cout << "autorepeat must be >= 1" << endl;
      return;
    }
    hasMenu = FALSE;
  }

  args.Save("save");

  MyH323EndPoint * endpoint = new MyH323EndPoint;
  if (endpoint->Initialise(args, verbose, hasMenu)) {
    if (!args.HasOption("videotest")) {
      if (autoRepeat < 0) {
  if (args.HasOption('l')) {
    if (verbose >= 2)
      cout << "Waiting for incoming calls for \"" << endpoint->GetLocalUserName() << "\"\n";
  } else
    endpoint->MakeOutgoingCall(args[0], args.GetOptionString('p'));
  endpoint->AwaitTermination();
      } else {
  int i;
  endpoint->terminateOnHangup = TRUE;
  for (i = 1; i <= autoRepeat; i++) {
    if (!args.HasOption('l')) {
      cout << "Making automatic call " << i << endl;
      endpoint->MakeOutgoingCall(args[0], args.GetOptionString('p'));
    }
    endpoint->AwaitTermination();

    cout << "Call #" << i;
#ifdef P_LINUX
    struct rusage usage;
    if (getrusage(RUSAGE_SELF, &usage) == 0)
      cout << ": memory = " << usage.ru_ixrss << ", " << usage.ru_idrss;
#endif
    cout << endl;
    if (i == autoRepeat)
      break;
  }
      }
    }else
      endpoint->TestVideoGrabber(args);
  } //initialised OK

  endpoint->WaitForSdlTermination();

  delete endpoint;

  if (verbose >= 3)
    cout << GetName() << " ended." << endl;
}


///////////////////////////////////////////////////////////////


BOOL MyH323EndPoint::Initialise(PConfigArgs & args, int _verbose, BOOL _hasMenu)
{
  PTRACE(3, "H323ep\tInitialise program. Arguments are " << args);

  PINDEX i;

  verbose = _verbose;
  hasMenu = _hasMenu;
  uiState = uiDialtone;

  channelsOpenLimit = 2;   //Guaranteed to have 2 open audio channels.

  localVideoChannel = NULL;

  if (!InitialiseSdl(args))
    return FALSE;

  // get local username

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -