Re: [OpenSIPStack] STUN support bug?
Brought to you by:
joegenbaclor
From: Ilian J. C. P. <ip...@so...> - 2007-07-26 09:18:34
|
I still can't reproduce this problem. But I'll check why these are needed on their side. Regards, Ilian Joegen E. Baclor wrote: > Hi, > > Thanks for sending in the patches. > > Hi Ilian, > > Can we validate this patch and come back with a problem analysis? I'm > not particularly sure which part is broken and why modifications are > needed to make it work. > > Joegen > > H.Kropf wrote: > >> Hi >> >> Now in my project STUN-support works correctly >> >> For this purpose i has made such changes of a code >> >> ********************************************************* >> SIPNATMethods.h >> ********************************************************* >> class SIPSTUNClient : public PNatMethod >> { >> ............... >> public: >> // [+] >> virtual BOOL GetExternalPort( WORD & externalPort ); >> ............... >> protected: >> // [+] >> WORD cachedExternalPort; >> ............... >> }; >> >> ********************************************************* >> SIPNATMethods.cxx >> ********************************************************* >> //------------------------------------------------------------------------------------- >> //------------------------------------------------------------------------------------- >> SIPSTUNClient::SIPSTUNClient(const PString & server, >> WORD portBase, WORD portMax, >> WORD portPairBase, WORD portPairMax) >> ................. >> cachedExternalPort(0), // [+] >> ................. >> { >> ..................... >> ..................... >> } >> >> //------------------------------------------------------------------------------------- >> //------------------------------------------------------------------------------------- >> SIPSTUNClient::SIPSTUNClient(const PIPSocket::Address & address, WORD port, >> WORD portBase, WORD portMax, >> WORD portPairBase, WORD portPairMax) >> ..................... >> cachedExternalPort(0), // [+] >> ..................... >> { >> ..................... >> } >> >> //------------------------------------------------------------------------------------- >> //------------------------------------------------------------------------------------- >> BOOL SIPSTUNClient::GetExternalAddress(PIPSocket::Address & externalAddress, >> const PTimeInterval & maxAge) >> { >> ..................... >> ..................... >> externalAddress = cachedExternalAddress = mappedAddress->GetIP(); >> >> // [+] >> cachedExternalPort = (WORD)mappedAddress->port; >> ..................... >> } >> >> >> ********************************************************* >> SIPTransportManager.h >> ********************************************************* >> >> class SIPTransportManager : public PObject, public Logger >> { >> ............... >> public: >> // [+] >> BOOL TranslateIPAddress( PIPSocket::Address & localAddress, WORD >> & localPort ); >> ............... >> protexted: >> // [+] >> WORD m_TranslationPort; >> ............... >> }; >> >> >> ********************************************************* >> SIPTransportManager.cxx >> ********************************************************* >> >> //------------------------------------------------------------------------------------- >> //------------------------------------------------------------------------------------- >> SIPSTUNClient::NatTypes SIPTransportManager::SetSTUNServer( >> const OString & server, >> WORD udpPortBase, >> WORD udpPortMax, >> WORD rtpPortBase, >> WORD rtpPortMax >> ) >> { >> ............................................. >> m_STUNClient = new SIPSTUNClient(server, >> udpPortBase, udpPortMax, >> rtpPortBase, rtpPortMax ); >> >> SIPSTUNClient::NatTypes type = m_STUNClient->GetNatType(); >> >> if (type != SIPSTUNClient::BlockedNat && type != SIPSTUNClient::OpenNat) >> { >> m_STUNClient->GetExternalAddress(m_TranslationAddress); >> >> // [+] >> m_STUNClient->GetExternalPort(m_TranslationPort); >> } >> ............................................. >> ............................................. >> ............................................. >> } >> >> //------------------------------------------------------------------------------------- >> //------------------------------------------------------------------------------------- >> BOOL SIPTransportManager::TranslateIPAddress( >> PIPSocket::Address & localAddress, >> WORD & localPort >> ) >> { >> ............................................. >> ............................................. >> //if (SIPTransport::IsLocalAddress(remoteAddress)) >> // return FALSE; // Does not need to be translated >> >> // Tranlsate it! >> localAddress = m_TranslationAddress; >> >> // [+] >> localPort = m_TranslationPort; >> >> return TRUE; >> } >> >> >> ********************************************************* >> SoftPhone.cxx >> ********************************************************* >> >> BOOL SoftPhoneManager::InitializeSIP() >> { >> ............................................. >> ............................................. >> ............................................. >> ............................................. >> >> BOOL ok = TRUE; >> >> if( !m_IsInitialized ) >> { >> >> // [+] begin >> >> NAT::SIPSTUNClient::NatTypes ntNatType = SetSTUNServer("stun.mysrv.com"); >> >> if(ntNatType == NAT::SIPSTUNClient::ConeNat) >> GetSoftPhoneInterface()->Event_STUNInit(( true, (char)ntNatType ); >> else >> { >> SetSTUNServer(""); >> flip_core::Event_STUNInit( false , (char)ntNatType ); >> GetSoftPhoneInterface()->Event_STUNInit(( false , (char)ntNatType ); >> } >> >> // [+] end >> >> m_SIPEndPoint->GetProfile().GetTransportProfile().EnableUDP( >> sipIface, sipPort ); >> >> #if ENABLE_TCP_TRANSPORT >> m_SIPEndPoint->GetProfile().GetTransportProfile().EnableTCP( >> sipIface, sipPort); >> #endif >> >> ............................................. >> ............................................. >> ............................................. >> ............................................. >> } >> >> >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Splunk Inc. >> Still grepping through log files to find problems? Stop. >> Now Search log events and configuration files using AJAX and a browser. >> Download your FREE copy of Splunk now >> http://get.splunk.com/ >> _______________________________________________ >> opensipstack-devel mailing list >> ope...@li... >> https://lists.sourceforge.net/lists/listinfo/opensipstack-devel >> >> >> > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > opensipstack-devel mailing list > ope...@li... > https://lists.sourceforge.net/lists/listinfo/opensipstack-devel > > > |