使用openh323开发(7)

2019-01-18 22:26

//瞧瞧, 这就是主进程干的这点事, Sleep的是毫秒 for (;;)

PThread::Current()->Sleep(5000); }

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

MyH323EndPoint::MyH323EndPoint(unsigned _callLimit, const PString & _runCmd, const PDirectory & _dir, int _flags)

: callLimit(_callLimit), runCmd(_runCmd), dir(_dir), flags(_flags) { }

BOOL MyH323EndPoint::OnIncomingCall(H323Connection & _conn, const H323SignalPDU & setupPDU, H323SignalPDU &) {

//传过来的是引用, 引用这个东西必须马上赋值

MyH323Connection & conn = (MyH323Connection &)_conn; // see if incoming call is to a getway address PString number;

if (setupPDU.GetDestinationE164(number)) conn.SetE164Number(number);

return TRUE; }

//这个没什么异常, 都这样做

H323Connection * MyH323EndPoint::CreateConnection(unsigned callReference) {

return new MyH323Connection(*this, callReference); }

//分析命令, 看看应该使用什么样的能力去交换, // 我们在使用的时候指定—g711message //就是说只是用g711 的alaw或者mulaw //很多废话就不用看了

//除了和g711相关的其他都没有用处了

BOOL MyH323EndPoint::Initialise(PConfigArgs & args) {

// format for record files, raw or wav if (args.HasOption(\SetRecordWav(FALSE); else

SetRecordWav(TRUE);

// get G723.1 OGM

if (args.HasOption(\

g7231Ogm = args.GetOptionString(\else if (args.HasOption(m)) {

if (PFile::Exists(args.GetOptionString(m) + \g7231Ogm = args.GetOptionString(m) + \}

else if (PFile::Exists(args.GetOptionString(m) + PCMExt)) { g7231Ogm = args.GetOptionString(m) + G7231Ext; } }

if (!g7231Ogm.IsEmpty()) {

if ((g7231Ogm.Find(\== P_MAX_INDEX) && !PFile::Exists(g7231Ogm)) { cout << \endl;

g7231Ogm = \} }

if (g7231Ogm.IsEmpty())

cout << \else {

cout << \}

// Get the OGM message for the PCM codecs

// Check if the file specified exists. If it does, use it. // If it does not exist, try with .wav and .sw extensions. if (args.HasOption(\

pcmOgm = args.GetOptionString(\}

else if (args.HasOption(m)) {

if (g7231Ogm.Find(\pcmOgm = args.GetOptionString(m);

} else {

if (PFile::Exists(args.GetOptionString(m))) { pcmOgm = args.GetOptionString(m); }

else if (PFile::Exists(args.GetOptionString(m) + WAVExt)) { pcmOgm = args.GetOptionString(m) + WAVExt; }

else if (PFile::Exists(args.GetOptionString(m) + PCMExt)) { pcmOgm = args.GetOptionString(m) + PCMExt; } } }

// By default, use the pcmOgm for all the PCM codecs, but allow the user // to override them. gsmOgm = pcmOgm; g711Ogm = pcmOgm; lpc10Ogm = pcmOgm; #ifdef SPEEX_CODEC speexOgm = pcmOgm; #endif

// We can set the filename for specific codecs. if (args.HasOption(\

gsmOgm = args.GetOptionString(\

//这句话用的着

if (args.HasOption(\

g711Ogm = args.GetOptionString(\if (args.HasOption(\

lpc10Ogm = args.GetOptionString(\//这是一个codec设备, 你没有! #ifdef SPEEX_CODEC

if (args.HasOption(\

speexOgm = args.GetOptionString(\#endif

// Check GSM OGM message if (!gsmOgm.IsEmpty()) {

if ((g7231Ogm.Find(\cout << \cannot open GSM OGM file \\\<< gsmOgm << \<< endl;

gsmOgm = \} }

if (gsmOgm.IsEmpty())

cout << \else {

cout << \}

// Check G.711 OGM message if (!g711Ogm.IsEmpty()) {

if ((g7231Ogm.Find(\cout << \cannot open G711 OGM file \\\<< g711Ogm << \<< endl; g711Ogm = \} }

if (g711Ogm.IsEmpty())

cout << \else {

cout << \}

// Check LPC10 OGM message if (!lpc10Ogm.IsEmpty()) {

if ((g7231Ogm.Find(\== P_MAX_INDEX) && !PFile::Exists(lpc10Ogm)) { cout << \endl;

lpc10Ogm = \} }

if (lpc10Ogm.IsEmpty())

cout << \else {

cout << \}

#ifdef SPEEX_CODEC

// Check Speex OGM message if (!speexOgm.IsEmpty()) {

if ((g7231Ogm.Find(\== P_MAX_INDEX) && !PFile::Exists(speexOgm)) { cout << \endl;

speexOgm = \} }

if (speexOgm.IsEmpty())

cout << \else {

cout << \}

#endif

if (g7231Ogm.IsEmpty() && gsmOgm.IsEmpty() && g711Ogm.IsEmpty() && lpc10Ogm.IsEmpty() #ifdef SPEEX_CODEC && speexOgm.IsEmpty() #endif ) {

cerr << \return FALSE; }

if (!g7231Ogm.IsEmpty())

SetCapability(0, 0, new G7231_File_Capability); if (!gsmOgm.IsEmpty())

SetCapability(0, 0, new H323_GSM0610Capability); if (!gsmOgm.IsEmpty())

SetCapability(0, 0, new MicrosoftGSMAudioCapability);

//这是 AM Endpoint的能力 支持g711的alaw和ulaw if (!g711Ogm.IsEmpty())

SetCapability(0, 0, new H323_G711Capability(H323_G711Capability::muLaw, H323_G

711Capability::At64k));

if (!g711Ogm.IsEmpty())

SetCapability(0, 0, new H323_G711Capability(H323_G711Capability::ALaw, H323_G7

11Capability::At64k));

//没有用了

if (!lpc10Ogm.IsEmpty())

SetCapability(0, 0, new H323_LPC10Capability(*this));


使用openh323开发(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:(2018年秋)人教版小学六年级语文上册第一单元1.山中访友 教案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: