Thread: [OpenSIPStack] STUN support bug?
Brought to you by:
joegenbaclor
From: H.Kropf <mai...@gl...> - 2007-07-24 08:35:14
|
Hello I try to use OSS SoftPhone client (OSS 1.1.7 CVS) with server OpenSER and with NAT of type NAT::SIPSTUNClient::ConeNat Calling of function SetSTUNServer connect succefully to my STUN-server. SoftPhone receive true NAT IP-address and NAT port. But after, when i call SoftPhone::SendRegister() then OpenSER register client like "NAT, without STUN" Exemples: (correct and wrong) =============================== REGISTER requests via NAT using STUN: (aliases: 111.111.111.111 - instead of local SIP-client IP, 222.222.222.222 - instead of NAT IP, 333.333.333.333 - instead of SIP-server IP) CORRECT (hardware Zyxel SIP-client) ************************************ REGISTER sip:mysrv.com:5060 SIP/2.0 Via: SIP/2.0/UDP 222.222.222.222:30796; branch=z9hG4bK332ccb85f16c5cbd Max-Forwards: 69 To: <sip:10...@my...> From: <sip:10...@my...>; tag=xIjMzUDMxID\015\012 Call-ID: 1464D22DC9741212@222.222.222.222 CSeq: 2 REGISTER Contact: <sip:100010@222.222.222.222:30796> Authorization: Digest username="zzz", realm="mysrv.com", nonce="46a5adc49a3608ebdb26cc2664302ba9a7cc47ca", uri="sip:mysrv.com:5060", response="c5b3f9967cb1ce70e847ce446b7705ec", cnonce="0a4f113b", qop="auth", nc=0000001 Content-Length: 0 Expires: 3600 REGISTER sip:mysrv.com:5060 SIP/2.0 Via: SIP/2.0/UDP 222.222.222.222:30796;branch=z9hG4bK44e19947d5df8012 Max-Forwards: 69 To: <sip:10...@my...> From: <sip:10...@my...>;tag=xIjMzUDMxID Call-ID: 1464D22DC9741212@222.222.222.222 CSeq: 1 REGISTER Contact: <sip:100010@222.222.222.222:30796> Content-Length: 0 Expires: 3600 *********************** WRONG (OSS SIP-Client) *********************** REGISTER sip:mysrv.com SIP/2.0 From: 100008 <sip:10...@my...>;tag=396528833cf9181096d6882afa23793b To: 100008 <sip:10...@ip...> Via: SIP/2.0/UDP 222.222.222.222:31007;iid=3501;branch=z9hG4bK396528833cf9181096d7882afa23793b;uas-addr=333.333.333.333;rport CSeq: 2 REGISTER Call-ID: bcdbfa82-3cf9-1810-8d66-882afa23793b Contact: "100008" <sip:100008@222.222.222.222:5060;transport=udp> // ????????????????? 5060????????????????? User-Agent: OpenSIPStack-1.1.7-1 Expires: 3600 Max-Forwards: 9 Authorization: Digest username="olden1", realm="mysrv.com", nonce="46a5b1b01f9b24a48429cf395d82288132141766", uri="sip:mysrv.com", response="d48c234555217113d91ec016c92bd612", algorithm=MD5 Allow: INVITE, BYE, ACK, REFER, MESSAGE, INFO, NOTIFY, OPTIONS Content-Length: 0 REGISTER sip:mysrv.com SIP/2.0 From: 100008 <sip:10...@my...>;tag=bcdbfa823cf9181096d5882afa23793b To: 100008 <sip:10...@my...> Via: SIP/2.0/UDP 222.222.222.222:31007;iid=3501;branch=z9hG4bKcf4c28833cf9181096d6882afa23793b;uas-addr=333.333.333.333;rport CSeq: 2 REGISTER Call-ID: bcdbfa82-3cf9-1810-8d66-882afa23793b Contact: * User-Agent: OpenSIPStack-1.1.7-1 Expires: 0 Max-Forwards: 9 Allow: INVITE, BYE, ACK, REFER, MESSAGE, INFO, NOTIFY, OPTIONS Content-Length: 0 ========================================================================= Why Contact == 100008@222.222.222.222:5060 instead of 100008@222.222.222.222:31007 ???? and why Contact == * ? |
From: Ilian J. C. P. <ip...@so...> - 2007-07-24 09:54:31
|
Hi, SetSTUNServer should work when it is called before the transport has been set up. Have you tried calling this during initialization? Regards, Ilian H.Kropf wrote: > Hello > > I try to use OSS SoftPhone client (OSS 1.1.7 CVS) with server OpenSER > and with NAT of type NAT::SIPSTUNClient::ConeNat > Calling of function SetSTUNServer connect succefully to my STUN-server. > SoftPhone receive true NAT IP-address and NAT port. > But after, when i call SoftPhone::SendRegister() then OpenSER register > client like "NAT, without STUN" > > Exemples: (correct and wrong) > =============================== > > REGISTER requests via NAT using STUN: (aliases: 111.111.111.111 - > instead of local SIP-client IP, 222.222.222.222 - instead of NAT IP, > 333.333.333.333 - instead of SIP-server IP) > > CORRECT (hardware Zyxel SIP-client) > <snip> |
From: Joegen E. B. <joe...@gm...> - 2007-07-24 10:11:01
|
Hi Ilian, Can we change the STUN code so that it asserts when called after the transport has already been initialized? Ilian Jeri C. Pinzon wrote: > Hi, > > SetSTUNServer should work when it is called before the transport has > been set up. Have you tried calling this during initialization? > > Regards, > Ilian > > H.Kropf wrote: > >> Hello >> >> I try to use OSS SoftPhone client (OSS 1.1.7 CVS) with server OpenSER >> and with NAT of type NAT::SIPSTUNClient::ConeNat >> Calling of function SetSTUNServer connect succefully to my STUN-server. >> SoftPhone receive true NAT IP-address and NAT port. >> But after, when i call SoftPhone::SendRegister() then OpenSER register >> client like "NAT, without STUN" >> >> Exemples: (correct and wrong) >> =============================== >> >> REGISTER requests via NAT using STUN: (aliases: 111.111.111.111 - >> instead of local SIP-client IP, 222.222.222.222 - instead of NAT IP, >> 333.333.333.333 - instead of SIP-server IP) >> >> CORRECT (hardware Zyxel SIP-client) >> >> > <snip> > > > ------------------------------------------------------------------------- > 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 > > |
From: Ilian J. C. P. <ip...@so...> - 2007-07-24 10:44:13
|
Will do. Regards, Ilian Joegen E. Baclor wrote: > Hi Ilian, > > Can we change the STUN code so that it asserts when called after the > transport has already been initialized? > > > Ilian Jeri C. Pinzon wrote: > >> Hi, >> >> SetSTUNServer should work when it is called before the transport has >> been set up. Have you tried calling this during initialization? >> >> Regards, >> Ilian >> >> H.Kropf wrote: >> >> >>> Hello >>> >>> I try to use OSS SoftPhone client (OSS 1.1.7 CVS) with server OpenSER >>> and with NAT of type NAT::SIPSTUNClient::ConeNat >>> Calling of function SetSTUNServer connect succefully to my STUN-server. >>> SoftPhone receive true NAT IP-address and NAT port. >>> But after, when i call SoftPhone::SendRegister() then OpenSER register >>> client like "NAT, without STUN" >>> >>> Exemples: (correct and wrong) >>> =============================== >>> >>> REGISTER requests via NAT using STUN: (aliases: 111.111.111.111 - >>> instead of local SIP-client IP, 222.222.222.222 - instead of NAT IP, >>> 333.333.333.333 - instead of SIP-server IP) >>> >>> CORRECT (hardware Zyxel SIP-client) >>> >>> >>> >> <snip> >> >> >> ------------------------------------------------------------------------- >> 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 > > > |
From: tomach <to...@dg...> - 2007-07-25 10:11:44
|
Sorry but I do not know whats wrong. I tried to use STUN server. So in OSSPhone I set everthing as it should be: Registrar, OutboundProxy and STUN server then I tried to register and I got no respond from my registrar server. Using ethereal I sniffed my eth and I noticed that: 1. Ossphone sends request to stun. 2. Stun answers with this kind of answer. (public address of ossphone is 192.168.2.14 and local is 192.168.44.46): Simple Traversal of UDP Through NAT Message Type: Binding Response (0x0101) Message Length: 0x0044 Message Transaction ID: 0163E14BE5515702A2407C07C23C6073 Attributes Attribute: MAPPED-ADDRESS Attribute Type: MAPPED-ADDRESS (0x0001) Attribute Length: 8 Protocol Family: IPv4 (0x0001) Port: 50666 IP: 192.168.44.46 (192.168.44.46) Attribute: SOURCE-ADDRESS Attribute Type: SOURCE-ADDRESS (0x0004) Attribute Length: 8 Protocol Family: IPv4 (0x0001) Port: 3478 IP: 192.168.44.254 (192.168.44.254) Attribute: CHANGED-ADDRESS Attribute Type: CHANGED-ADDRESS (0x0005) Attribute Length: 8 Protocol Family: IPv4 (0x0001) Port: 3479 IP: 192.168.2.14 (192.168.2.14) Attribute: XOR_MAPPED_ADDRESS Attribute Type: XOR_MAPPED_ADDRESS (0x8020) Attribute Length: 8 Protocol Family: IPv4 (0x0001) Port (XOR-d): 50313 Port: 50666 IP (XOR-d): 193.203.205.101 (193.203.205.101) IP: 192.168.44.46 (192.168.44.46) Attribute: SERVER Attribute Type: SERVER (0x8022) Attribute Length: 16 Server version: Vovida.org 0.96 3. Then ossphone sends register message to sipserver. Where Contact and Via headers have incorrect ossphone address. Should be public 192.168.2.14 and there is local 192.168.44.46. 4. Sip server does not response because in Contact and Via headers is wrong ossphone address. Do you have the same behaviour? why Contact field and via arent changed to public in register message? |
From: Ilian J. C. P. <ip...@so...> - 2007-07-25 12:44:56
|
Hi Tom, Thanks for reporting this. I'll have to confirm this first and see what's wrong. Regards, Ilian tomach wrote: > Sorry but I do not know whats wrong. I tried to use STUN server. So in OSSPhone I set everthing as it should be: > Registrar, OutboundProxy and STUN server > > then I tried to register and I got no respond from my registrar server. > > Using ethereal I sniffed my eth and I noticed that: > 1. Ossphone sends request to stun. > 2. Stun answers with this kind of answer. (public address of ossphone is 192.168.2.14 and local is 192.168.44.46): > > Simple Traversal of UDP Through NAT > Message Type: Binding Response (0x0101) > Message Length: 0x0044 > Message Transaction ID: 0163E14BE5515702A2407C07C23C6073 > Attributes > Attribute: MAPPED-ADDRESS > Attribute Type: MAPPED-ADDRESS (0x0001) > Attribute Length: 8 > Protocol Family: IPv4 (0x0001) > Port: 50666 > IP: 192.168.44.46 (192.168.44.46) > Attribute: SOURCE-ADDRESS > Attribute Type: SOURCE-ADDRESS (0x0004) > Attribute Length: 8 > Protocol Family: IPv4 (0x0001) > Port: 3478 > IP: 192.168.44.254 (192.168.44.254) > Attribute: CHANGED-ADDRESS > Attribute Type: CHANGED-ADDRESS (0x0005) > Attribute Length: 8 > Protocol Family: IPv4 (0x0001) > Port: 3479 > IP: 192.168.2.14 (192.168.2.14) > Attribute: XOR_MAPPED_ADDRESS > Attribute Type: XOR_MAPPED_ADDRESS (0x8020) > Attribute Length: 8 > Protocol Family: IPv4 (0x0001) > Port (XOR-d): 50313 > Port: 50666 > IP (XOR-d): 193.203.205.101 (193.203.205.101) > IP: 192.168.44.46 (192.168.44.46) > Attribute: SERVER > Attribute Type: SERVER (0x8022) > Attribute Length: 16 > Server version: Vovida.org 0.96 > > 3. Then ossphone sends register message to sipserver. Where Contact and Via headers have incorrect ossphone address. Should be public 192.168.2.14 and there is local 192.168.44.46. > 4. Sip server does not response because in Contact and Via headers is wrong ossphone address. > > Do you have the same behaviour? why Contact field and via arent changed to public in register message? > > ------------------------------------------------------------------------- > 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 > > > |
From: Ilian J. C. P. <ip...@so...> - 2007-07-25 13:07:11
|
Hi Tom, It works fine in my end. However, you could try moving ATLSIP->InitializeSIP() to void DoLogin() from System::Void Form1_Load. I'm assuming you're using the OSSPhone .NET version. This guarantees that the transport is initialized *AFTER* setting the STUN address. But I'm encountering one-way audio (inbound is silent) with calls using STUN. Logs says I'm in a Port Restricted NAT. I'll still have to check why this is happening. Regards, Ilian Ilian Jeri C. Pinzon wrote: > Hi Tom, > > Thanks for reporting this. I'll have to confirm this first and see > what's wrong. > > Regards, > Ilian > > tomach wrote: > >> Sorry but I do not know whats wrong. I tried to use STUN server. So in OSSPhone I set everthing as it should be: >> Registrar, OutboundProxy and STUN server >> >> then I tried to register and I got no respond from my registrar server. >> >> Using ethereal I sniffed my eth and I noticed that: >> 1. Ossphone sends request to stun. >> 2. Stun answers with this kind of answer. (public address of ossphone is 192.168.2.14 and local is 192.168.44.46): >> >> Simple Traversal of UDP Through NAT >> Message Type: Binding Response (0x0101) >> Message Length: 0x0044 >> Message Transaction ID: 0163E14BE5515702A2407C07C23C6073 >> Attributes >> Attribute: MAPPED-ADDRESS >> Attribute Type: MAPPED-ADDRESS (0x0001) >> Attribute Length: 8 >> Protocol Family: IPv4 (0x0001) >> Port: 50666 >> IP: 192.168.44.46 (192.168.44.46) >> Attribute: SOURCE-ADDRESS >> Attribute Type: SOURCE-ADDRESS (0x0004) >> Attribute Length: 8 >> Protocol Family: IPv4 (0x0001) >> Port: 3478 >> IP: 192.168.44.254 (192.168.44.254) >> Attribute: CHANGED-ADDRESS >> Attribute Type: CHANGED-ADDRESS (0x0005) >> Attribute Length: 8 >> Protocol Family: IPv4 (0x0001) >> Port: 3479 >> IP: 192.168.2.14 (192.168.2.14) >> Attribute: XOR_MAPPED_ADDRESS >> Attribute Type: XOR_MAPPED_ADDRESS (0x8020) >> Attribute Length: 8 >> Protocol Family: IPv4 (0x0001) >> Port (XOR-d): 50313 >> Port: 50666 >> IP (XOR-d): 193.203.205.101 (193.203.205.101) >> IP: 192.168.44.46 (192.168.44.46) >> Attribute: SERVER >> Attribute Type: SERVER (0x8022) >> Attribute Length: 16 >> Server version: Vovida.org 0.96 >> >> 3. Then ossphone sends register message to sipserver. Where Contact and Via headers have incorrect ossphone address. Should be public 192.168.2.14 and there is local 192.168.44.46. >> 4. Sip server does not response because in Contact and Via headers is wrong ossphone address. >> >> Do you have the same behaviour? why Contact field and via arent changed to public in register message? >> >> ------------------------------------------------------------------------- >> 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 > > > |
From: tomach <to...@dg...> - 2007-07-26 06:38:54
|
hmmm its weird that it works in your end. Moving initialize() i tried even before but still were bad header Contact. Can you compare my stun message with yours? Is it correct? Maybe ATL sip can not parse it or something.... maybe I should force somehow ATLSIP to use stun cos setSTUN is obviously not enough. Even it ask STUN for public Ip, it does not use it later at all.... any ideas? |
From: Ilian J. C. P. <ip...@so...> - 2007-07-26 09:46:45
|
Hi Tom, Can you get a fresh copy of OssPhone.NET and then run it? Also make sure that you have no mods in the OpenSIPStack/ATLSIP projects. Tell me if you still encounter that problem. Regards, Ilian tomach wrote: > hmmm its weird that it works in your end. Moving initialize() i tried even before but still were bad header Contact. > > Can you compare my stun message with yours? Is it correct? Maybe ATL sip can not parse it or something.... > > maybe I should force somehow ATLSIP to use stun cos setSTUN is obviously not enough. > Even it ask STUN for public Ip, it does not use it later at all.... > > any ideas? > > ------------------------------------------------------------------------- > 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 > > > |
From: tomach <to...@dg...> - 2007-07-26 13:31:40
|
Hi Ilian, Still nothing. I checkout whole new project wiht CVS, compile etc...And there is still the same problem...Field contact is with bad local IP address. There is only one change I did in ATLSIP it is: in file ptbuildopts.h: I removed that: (because otherwise I couldnt compile the code) ///////////////////////////////////////////////// // // SAPI speech API (Windows only) // #undef P_SAPI #if defined(_MSC_VER) && P_SAPI #pragma include_alias(<sphelper.h>, <@SAPI_DIR@/include/sphelper.h>) #pragma include_alias(<sapi.h>, <@SAPI_DIR@/include/sapi.h>) #pragma include_alias(<sapiddk.h>, <@SAPI_DIR@/include/sapiddk.h>) #pragma include_alias(<SPError.h>, <@SAPI_DIR@/include/SPError.h>) #pragma include_alias(<SPDebug.h>, <@SAPI_DIR@/include/SPDebug.h>) #define P_SAPI_LIBRARY "@SAPI_DIR@/Lib/i386/sapi.lib" #endif |
From: H.Kropf <mai...@gl...> - 2007-07-26 07:35:02
|
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 ............................................. ............................................. ............................................. ............................................. } |
From: Joegen E. B. <joe...@gm...> - 2007-07-26 07:56:36
|
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 > > |
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 > > > |
From: Ilian J. C. P. <ip...@so...> - 2007-07-27 07:19:54
|
Hi, Now I'm reproducing this problem when using a different server. You're right. The external port is never set. Thanks for this! Regards, Ilian 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 > > > |
From: Ilian J. C. P. <ip...@so...> - 2007-07-27 09:58:34
|
I'm still cleaning up some issues. Please wait for updates. Probably within next week. Thanks. - Ilian Ilian Jeri C. Pinzon wrote: > Hi, > > Now I'm reproducing this problem when using a different server. You're > right. The external port is never set. > > Thanks for this! > > Regards, > Ilian > > H.Kropf wrote: > >> Hi >> >> Now in my project STUN-support works correctly >> >> For this purpose i has made such changes of a code >> >> |
From: Ilian J. C. P. <ip...@so...> - 2007-08-02 11:20:58
|
Hi, I've checked in the fix for this plus some other modifications which are also STUN-related. The default behavior of the softphone sets the STUN only when it is behind a Full Cone NAT. You can change this behavior however by overriding SoftPhoneInterface::OnConfirmSetStun(..). For ATLSIP/OSSPhone, it's ATLSIP_OnConfirmSetStun(..). Regards, Ilian |
From: H.Kropf <mai...@gl...> - 2007-07-26 15:54:26
|
Hi I could not force STUN-client to work correctly It is necessary : 1. Check NAT presence and Nat type 2. If Nat type is ConeNat, in that case it is necessary to enable STUN support 3. If Nat type is other, in that case it is necessary to disable STUN support How to make it? I have tried to use such method: in SoftPhoneManager::InitializeSIP() function before m_SIPEndPoint->GetProfile().GetTransportProfile().EnableUDP( sipIface, sipPort ); this piece of code has been inserted if( SetSTUNServer("stun.mysrv.com") != NAT::SIPSTUNClient::ConeNat ) SetSTUNServer(""); and... nothing... NAT type is SymmetricNat, (for ConeNat it work correctly) The call of function SetSTUNServer("") destroys object SIPTransportManager::m_STUNClient and object OpalManager::stun but OSS for some reason remembers (where? how?) NAT address after SetSTUNServer("stun.mysrv.com") and inserts it into fields of REGISTER requests Via: SIP/2.0/UDP [NAT IP-address]:5060;.... Contact: "100008" <sip:100008@[NAT IP-address]:5060;...... Tell me please how to solve a problem using only OSS, without other libraries? |
From: Joegen E. B. <joe...@gm...> - 2007-07-27 02:27:32
|
Hi, You can use SIPSTUNClient::NatTypes SIPTransportTools::STUNGetNATType( const OString & server ); To get the NAT type instead of calling SetSTUNServer(). Only call SetSTUNSErver() once you have decided whether you want to use STUN or not. Setting the STUN server is a point of no return and will always use the stun address through out the lifetime of the application. H.Kropf wrote: > Hi > I could not force STUN-client to work correctly > > It is necessary : > 1. Check NAT presence and Nat type > 2. If Nat type is ConeNat, in that case it is necessary to enable STUN > support > 3. If Nat type is other, in that case it is necessary to disable STUN > support > > How to make it? > > I have tried to use such method: > > in > > SoftPhoneManager::InitializeSIP() function > > > before > > m_SIPEndPoint->GetProfile().GetTransportProfile().EnableUDP( > sipIface, sipPort ); > > > this piece of code has been inserted > > if( SetSTUNServer("stun.mysrv.com") != NAT::SIPSTUNClient::ConeNat ) SetSTUNServer(""); > > and... nothing... > > NAT type is SymmetricNat, (for ConeNat it work correctly) > > The call of function SetSTUNServer("") destroys object SIPTransportManager::m_STUNClient and > object OpalManager::stun > > but OSS for some reason remembers (where? how?) NAT address after SetSTUNServer("stun.mysrv.com") > and inserts it into fields of REGISTER requests > > Via: SIP/2.0/UDP [NAT IP-address]:5060;.... > Contact: "100008" <sip:100008@[NAT IP-address]:5060;...... > > > > Tell me please how to solve a problem using only OSS, without other libraries? > > > > > > > > > > > ------------------------------------------------------------------------- > 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 > > |
From: H.Kropf <mai...@gl...> - 2007-07-24 14:01:27
|
Ilian Jeri C. Pinzon wrote: Thanks. I shall try it. Also look at it =================================================== OpalOSSEndPoint.cxx =================================================== BOOL OpalOSSEndPoint::SendRegister( const PString & userName, const PString & password, const PString & uri, const PString & _domain, BOOL synchronous ) { ........ WORD contactPort; ........ ........ if( !transport->GetListenerAddress( SIPTransport::UDP, targetAddress, contactAddress, contactPort ) ) return FALSE; OStringStream contact; contact << contactAddress << ":" << contactPort; profile.AppendContact( contact.str() ); ........ ........ ........ } =================================================== SIPTransportManager.cxx =================================================== BOOL SIPTransportManager::GetListenerAddress( SIPTransport::Protocol proto, const PIPSocket::Address & target, PIPSocket::Address & listenerAddress, WORD & listenerPort ) { .... .... TranslateIPAddress( listenerAddress, listenerPort ); //// WORD listenerPort? instead of const PIPSocket::Address ? return ok; } //---------------------------------------------------------------- BOOL SIPTransportManager::TranslateIPAddress( PIPSocket::Address & localAddress, const PIPSocket::Address & remoteAddress ) { if (m_TranslationAddress.IsLoopback()) return FALSE; // Have nothing to translate it to if (!m_TranslationAddress.IsValid()) return FALSE; // Have nothing to translate it to if (!SIPTransport::IsLocalAddress(localAddress)) return FALSE; // Is already translated if (SIPTransport::IsLocalAddress(remoteAddress)) // !!! return FALSE; // Does not need to be translated // Tranlsate it! localAddress = m_TranslationAddress; return TRUE; } //---------------------------------------------------------------- > Hi, > > SetSTUNServer should work when it is called before the transport has > been set up. Have you tried calling this during initialization? > > Regards, > Ilian > > H.Kropf wrote: > >> Hello >> >> I try to use OSS SoftPhone client (OSS 1.1.7 CVS) with server OpenSER >> and with NAT of type NAT::SIPSTUNClient::ConeNat >> Calling of function SetSTUNServer connect succefully to my STUN-server. >> SoftPhone receive true NAT IP-address and NAT port. >> But after, when i call SoftPhone::SendRegister() then OpenSER register >> client like "NAT, without STUN" >> >> Exemples: (correct and wrong) >> =============================== >> >> REGISTER requests via NAT using STUN: (aliases: 111.111.111.111 - >> instead of local SIP-client IP, 222.222.222.222 - instead of NAT IP, >> 333.333.333.333 - instead of SIP-server IP) >> >> CORRECT (hardware Zyxel SIP-client) >> >> |