From: Robert J. <rjo...@us...> - 2004-09-29 12:47:49
|
Update of /cvsroot/openh323/opal/samples/openphone In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23802/samples/openphone Modified Files: main.cpp main.h Log Message: Added gatekeeper support Index: main.cpp =================================================================== RCS file: /cvsroot/openh323/opal/samples/openphone/main.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** main.cpp 29 Sep 2004 12:02:40 -0000 1.23 --- main.cpp 29 Sep 2004 12:47:39 -0000 1.24 *************** *** 26,29 **** --- 26,32 ---- * * $Log$ + * Revision 1.24 2004/09/29 12:47:39 rjongbloed + * Added gatekeeper support + * * Revision 1.23 2004/09/29 12:02:40 rjongbloed * Added popup menu to edit Speed DIals *************** *** 983,1005 **** LOAD_FIELD_BOOL(DisableH245inSETUP, h323EP->DisableH245inSetup); ! PwxString hostname, username, password; ! int mode; ! config->Read(GatekeeperModeKey, &mode, 0); ! if (mode > 0) { ! config->Read(GatekeeperAddressKey, &hostname, ""); ! config->Read(GatekeeperIdentifierKey, &username, ""); ! if (h323EP->UseGatekeeper(hostname, username)) { ! if (config->Read(GatekeeperTTLKey, &value1)) ! h323EP->SetGatekeeperTimeToLive(PTimeInterval(0, value1)); ! config->Read(GatekeeperLoginKey, &username, ""); ! config->Read(GatekeeperPasswordKey, &password, ""); ! h323EP->SetGatekeeperPassword(password, username); ! } ! else { ! if (mode > 1) { ! return false; ! } ! } } --- 986,1003 ---- LOAD_FIELD_BOOL(DisableH245inSETUP, h323EP->DisableH245inSetup); ! PwxString username, password; ! config->Read(GatekeeperModeKey, &m_gatekeeperMode, 0); ! if (m_gatekeeperMode > 0) { ! if (config->Read(GatekeeperTTLKey, &value1)) ! h323EP->SetGatekeeperTimeToLive(PTimeInterval(0, value1)); ! config->Read(GatekeeperLoginKey, &username, ""); ! config->Read(GatekeeperPasswordKey, &password, ""); ! h323EP->SetGatekeeperPassword(password, username); ! ! config->Read(GatekeeperAddressKey, &m_gatekeeperAddress, ""); ! config->Read(GatekeeperIdentifierKey, &m_gatekeeperIdentifier, ""); ! if (!StartGatekeeper()) ! return false; } *************** *** 1008,1011 **** --- 1006,1010 ---- config->SetPath(SIPGroup); const SIPURL & proxy = sipEP->GetProxy(); + PwxString hostname; config->Read(SIPProxyKey, &hostname, PwxString(proxy.GetHostName())); config->Read(SIPProxyUsernameKey, &username, PwxString(proxy.GetUserName())); *************** *** 1018,1025 **** if (config->Read(RegistrarNameKey, &m_registrarName) && config->Read(RegistrarUsernameKey, &m_registrarUser) && ! config->Read(RegistrarPasswordKey, &m_registrarPassword)) { ! sipEP->Register(m_registrarName, m_registrarUser, m_registrarPassword); ! LogWindow << "SIP registration started for " << m_registrarUser << '@' << m_registrarName << endl; ! } //////////////////////////////////////// --- 1017,1022 ---- if (config->Read(RegistrarNameKey, &m_registrarName) && config->Read(RegistrarUsernameKey, &m_registrarUser) && ! config->Read(RegistrarPasswordKey, &m_registrarPassword)) ! StartRegistrar(); //////////////////////////////////////// *************** *** 1072,1075 **** --- 1069,1098 ---- + bool MyFrame::StartGatekeeper() + { + LogWindow << "H.323 registration started for " << m_gatekeeperIdentifier; + if (!m_gatekeeperIdentifier.IsEmpty() || !m_gatekeeperAddress.IsEmpty()) + LogWindow << '@'; + LogWindow << m_gatekeeperAddress << endl; + + if (h323EP->UseGatekeeper(m_gatekeeperAddress, m_gatekeeperIdentifier)) { + LogWindow << "H.323 registration successful to " << *h323EP->GetGatekeeper() << endl; + return true; + } + + return m_gatekeeperMode < 2; + } + + + bool MyFrame::StartRegistrar() + { + if (!sipEP->Register(m_registrarName, m_registrarUser, m_registrarPassword)) + return false; + + LogWindow << "SIP registration started for " << m_registrarUser << '@' << m_registrarName << endl; + return true; + } + + void MyFrame::InitMediaInfo(const char * source, const OpalMediaFormatList & mediaFormats) { *************** *** 1262,1265 **** --- 1285,1294 ---- INIT_FIELD(DisableH245Tunneling, m_frame.h323EP->IsH245TunnelingDisabled() != FALSE); INIT_FIELD(DisableH245inSETUP, m_frame.h323EP->IsH245inSetupDisabled() != FALSE); + INIT_FIELD(GatekeeperMode, m_frame.m_gatekeeperMode); + INIT_FIELD(GatekeeperAddress, m_frame.m_gatekeeperAddress); + INIT_FIELD(GatekeeperIdentifier, m_frame.m_gatekeeperIdentifier); + INIT_FIELD(GatekeeperTTL, m_frame.h323EP->GetGatekeeperTimeToLive().GetSeconds()); + INIT_FIELD(GatekeeperLogin, m_frame.h323EP->GetGatekeeperUsername()); + INIT_FIELD(GatekeeperPassword, m_frame.h323EP->GetGatekeeperPassword()); //////////////////////////////////////// *************** *** 1449,1453 **** SAVE_FIELD(DisableH245Tunneling, m_frame.h323EP->DisableH245Tunneling); SAVE_FIELD(DisableH245inSETUP, m_frame.h323EP->DisableH245inSetup); ! SAVE_FIELD2(GatekeeperPassword, GatekeeperLogin, m_frame.h323EP->SetGatekeeperPassword); //////////////////////////////////////// --- 1478,1499 ---- SAVE_FIELD(DisableH245Tunneling, m_frame.h323EP->DisableH245Tunneling); SAVE_FIELD(DisableH245inSETUP, m_frame.h323EP->DisableH245inSetup); ! ! config->Write(GatekeeperTTLKey, m_GatekeeperTTL); ! m_frame.h323EP->SetGatekeeperTimeToLive(PTimeInterval(0, m_GatekeeperTTL)); ! ! if (m_frame.m_gatekeeperMode != m_GatekeeperMode || ! m_frame.m_gatekeeperAddress != m_GatekeeperAddress || ! m_frame.m_gatekeeperIdentifier != m_GatekeeperIdentifier || ! m_frame.h323EP->GetGatekeeperUsername() != m_GatekeeperLogin.c_str() || ! m_frame.h323EP->GetGatekeeperPassword() != m_GatekeeperPassword.c_str()) { ! SAVE_FIELD(GatekeeperMode, m_frame.m_gatekeeperMode = ); ! SAVE_FIELD(GatekeeperAddress, m_frame.m_gatekeeperAddress = ); ! SAVE_FIELD(GatekeeperIdentifier, m_frame.m_gatekeeperIdentifier = ); ! SAVE_FIELD2(GatekeeperPassword, GatekeeperLogin, m_frame.h323EP->SetGatekeeperPassword); ! ! if (!m_frame.StartGatekeeper()) { ! // exit app ! } ! } //////////////////////////////////////// *************** *** 1468,1473 **** SAVE_FIELD(RegistrarUsername, m_frame.m_registrarUser =); SAVE_FIELD(RegistrarPassword, m_frame.m_registrarPassword =); ! m_frame.sipEP->Register(m_RegistrarName, m_RegistrarUsername, m_RegistrarPassword); ! LogWindow << "SIP registration started for " << m_RegistrarUsername << '@' << m_RegistrarName << endl; } --- 1514,1518 ---- SAVE_FIELD(RegistrarUsername, m_frame.m_registrarUser =); SAVE_FIELD(RegistrarPassword, m_frame.m_registrarPassword =); ! m_frame.StartRegistrar(); } *************** *** 1816,1820 **** void MyH323EndPoint::OnRegistrationConfirm() { ! LogWindow << "H.323 registration successful." << endl; } --- 1861,1865 ---- void MyH323EndPoint::OnRegistrationConfirm() { ! // LogWindow << "H.323 registration successful." << endl; } Index: main.h =================================================================== RCS file: /cvsroot/openh323/opal/samples/openphone/main.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** main.h 29 Sep 2004 12:02:40 -0000 1.16 --- main.h 29 Sep 2004 12:47:39 -0000 1.17 *************** *** 26,29 **** --- 26,32 ---- * * $Log$ + * Revision 1.17 2004/09/29 12:47:39 rjongbloed + * Added gatekeeper support + * * Revision 1.16 2004/09/29 12:02:40 rjongbloed * Added popup menu to edit Speed DIals *************** *** 465,474 **** MyPCSSEndPoint * pcssEP; OpalPOTSEndPoint * potsEP; #if OPAL_H323 ! MyH323EndPoint * h323EP; #endif #if OPAL_SIP ! MySIPEndPoint * sipEP; #endif #if P_EXPAT OpalIVREndPoint * ivrEP; --- 468,488 ---- MyPCSSEndPoint * pcssEP; OpalPOTSEndPoint * potsEP; + #if OPAL_H323 ! MyH323EndPoint * h323EP; ! int m_gatekeeperMode; ! PwxString m_gatekeeperAddress; ! PwxString m_gatekeeperIdentifier; ! bool StartGatekeeper(); #endif + #if OPAL_SIP ! MySIPEndPoint * sipEP; ! PwxString m_registrarName; ! PwxString m_registrarUser; ! PwxString m_registrarPassword; ! bool StartRegistrar(); #endif + #if P_EXPAT OpalIVREndPoint * ivrEP; *************** *** 479,487 **** void ApplyMediaInfo(); bool m_enableTracing; wxString m_traceFileName; ! PwxString m_registrarName; ! PwxString m_registrarUser; ! PwxString m_registrarPassword; PString m_currentCallToken; --- 493,500 ---- void ApplyMediaInfo(); + #if PTRACING bool m_enableTracing; wxString m_traceFileName; ! #endif PString m_currentCallToken; |