void OpenAm::Main() {
cout << GetName()
<< \<< \
<< \
<< \// 分析命令行了
PConfigArgs args(GetArguments());
args.Parse( \\
\\\\\
\\
\\
\
\\\
\\\\\#if PTRACING \#endif
\
\
\\
\\\
\
\
#if PMEMORY_CHECK
\#endif
#if PTRACING \#endif
\, FALSE);
#if PMEMORY_CHECK
if (args.HasOption(\
PMemoryHeap::SetAllocationBreakpoint(args.GetOptionString(\ionbreakp
oint\#endif
#if PTRACING
PTrace::Initialise(args.GetOptionCount( ),
args.HasOption(o) ? (const char *)args.GetOptionString(o) : NULL); #endif
if (args.HasOption(h)) {
cout << \\
\
\<< DEF
AULT_MSG_LIMIT << \
\(G.711/GSM) to fn\\n\
\\\
\#ifdef SPEEX_CODEC
\#endif
\\\\
\
\\\\
\
\-D --disable codec : Disable the specified codec (may be used multiple times )\\n\
\times)\\ n\
#if PTRACING
\\#endif
\\return; }
args.Save(\
//是指有IXJ卡吗? 我想你肯定没有, 那是电话卡 不用管他 #if HAS_IXJ
if (args.GetCount() > 0) { if (args[0] *= \RecordFile(args);
else if (args[0] *= \PlayFile(args); else
cerr << \return; }
#endif
unsigned callLimit = DEFAULT_MSG_LIMIT; if (args.HasOption(l)) {
callLimit = args.GetOptionString(l).AsInteger(); if (callLimit > 3600) {
cout << \maximum call length \<< callLimit << \is out of range. Usi
ng \callLimit = DEFAULT_MSG_LIMIT; } else if (callLimit == 0)
cout << \
}
cout << \PString runCmd;
if (args.HasOption( )) {
runCmd = args.GetOptionString( );
cout << \}
PDirectory dir;
if (args.HasOption(d))
dir = args.GetOptionString(d); int flags = 0;
if (args.HasOption(\
cout << \flags |= MyH323EndPoint::NoRecordG7231; }
if (args.HasOption(k)) {
cout << \if (runCmd.IsEmpty()) cout << \recorded files will be deleted even though no run command is
present\
flags |= MyH323EndPoint::DeleteAfterRecord; }
if (args.HasOption(H))
flags |= MyH323EndPoint::HangupAfterPlay;
//创建H323 EndPoint
MyH323EndPoint endpoint(callLimit, runCmd, dir, flags);
PString userName = \if (args.HasOption(u))
userName = args.GetOptionString(u); endpoint.SetLocalUserName(userName); if (!endpoint.Initialise(args)) return;
// start the H.323 listener
// 开始监听 H323有个默认的端口应该是1572 之类的 DefaultSignalPort, 我忘了
H323ListenerTCP * listener;
PIPSocket::Address interfaceAddress(INADDR_ANY);
WORD listenPort = H323ListenerTCP::DefaultSignalPort;
if (args.HasOption(\
listenPort = (WORD)args.GetOptionString(\if (args.HasOption(i))
interfaceAddress = PIPSocket::Address(args.GetOptionString(i)); listener = new H323ListenerTCP(endpoint, interfaceAddress, listenPort); if (!endpoint.StartListener(listener)) {
cout << \<< listener->GetListenerPort() << endl; delete listener; return; }
//gatekeeper 相关的东西我们也不必考虑 用-n这个参数这个端点就不会 //去找gatekeeper
if (args.HasOption(g)) {
PString gkName = args.GetOptionString(g);
if (endpoint.SetGatekeeper(gkName, new H323TransportUDP(endpoint))) cout << \else {
cout << \registering with gatekeeper at \\\<< gkName << \\\<< endl; return; } }
else if (!args.HasOption( )) {
cout << \
if (endpoint.DiscoverGatekeeper(new H323TransportUDP(endpoint)))
cout << \else {
cout << \if (args.HasOption(\return; } }
cout << \for incoming calls for \\\<< endpoint.GetLocalUserName() <<
\\\