Thank you so much Juha! We are all quite busy right now, and very much appreciate your patch. Sorry that I didn't have the time to solve it.
Cheers, -Raphael. On 23.01.2013, at 02:25, Juha Heinanen wrote: > Module: sems > Branch: master > Commit: 9743f76c9974beb6b42ff655fa5be126ff6bada6 > URL: > http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=9743f76c9974beb6b42ff655fa5be126ff6bada6 > > Author: Juha Heinanen <[email protected]> > Committer: Juha Heinanen <[email protected]> > Date: Wed Jan 23 03:14:08 2013 +0200 > > core: choose media interface based on address family > > - When generating SDP answer, choose media interface based on > address family in the offer. > > - Generate SDP address family string dynamically instead of using hard > coded IP4 string. > > --- > > core/AmSdp.cpp | 8 +++++--- > core/AmSession.cpp | 20 +++++++++++++------- > core/AmSession.h | 2 +- > 3 files changed, 19 insertions(+), 11 deletions(-) > > diff --git a/core/AmSdp.cpp b/core/AmSdp.cpp > index 55e1ed1..6bc7e6a 100644 > --- a/core/AmSdp.cpp > +++ b/core/AmSdp.cpp > @@ -237,7 +237,7 @@ void AmSdp::print(string& body) const > { > string out_buf = "v="+int2str(version)+"\r\n" > "o="+origin.user+" "+int2str(origin.sessId)+" "+ > - int2str(origin.sessV)+" IN IP4 "; > + int2str(origin.sessV)+" IN " + addr_t_2_str(conn.addrType) + " "; > if (!origin.conn.address.empty()) > out_buf += origin.conn.address+"\r\n"; > else if (!conn.address.empty()) > @@ -250,7 +250,8 @@ void AmSdp::print(string& body) const > out_buf += > "s="+sessionName+"\r\n"; > if (!conn.address.empty()) > - out_buf += "c=IN IP4 "+conn.address+"\r\n"; > + out_buf += "c=IN " + addr_t_2_str(conn.addrType) + " " + > + conn.address + "\r\n"; > > out_buf += "t=0 0\r\n"; > > @@ -300,7 +301,8 @@ void AmSdp::print(string& body) const > } > > if (!media_it->conn.address.empty()) > - out_buf += "\r\nc=IN IP4 "+media_it->conn.address; > + out_buf += "\r\nc=IN " + addr_t_2_str(media_it->conn.addrType) + > + " " + media_it->conn.address; > > out_buf += "\r\n" + options; > > diff --git a/core/AmSession.cpp b/core/AmSession.cpp > index 91f1dc7..503fc5f 100644 > --- a/core/AmSession.cpp > +++ b/core/AmSession.cpp > @@ -982,8 +982,8 @@ bool AmSession::getSdpAnswer(const AmSdp& offer, AmSdp& > answer) > //answer.origin.sessV = 1; > answer.sessionName = "sems"; > answer.conn.network = NT_IN; > - answer.conn.addrType = AT_V4; > - answer.conn.address = advertisedIP(); > + answer.conn.addrType = offer.conn.addrType; > + answer.conn.address = advertisedIP(offer.conn.addrType); > answer.media.clear(); > > bool audio_1st_stream = true; > @@ -1233,7 +1233,7 @@ void AmSession::onFailure() > > // Utility for basic NAT handling: allow the config file to specify the IP > // address to use in SDP bodies > -string AmSession::advertisedIP() > +string AmSession::advertisedIP(int addrType) > { > if(rtp_interface < 0){ > // TODO: get default media interface for signaling IF instead > @@ -1248,10 +1248,16 @@ string AmSession::advertisedIP() > assert(rtp_interface >= 0); > assert((unsigned int)rtp_interface < AmConfig::RTP_Ifs.size()); > > - string set_ip = AmConfig::RTP_Ifs[rtp_interface].PublicIP; > - if (set_ip.empty()) > - return AmConfig::RTP_Ifs[rtp_interface].LocalIP; // "media_ip" parameter. > - > + string set_ip = ""; > + for (size_t i = rtp_interface; i < AmConfig::RTP_Ifs.size(); i++) { > + set_ip = AmConfig::RTP_Ifs[i].PublicIP; > + if (set_ip.empty()) > + set_ip = AmConfig::RTP_Ifs[i].LocalIP; // "media_ip" parameter. > + if ((addrType == AT_NONE) || > + ((addrType == AT_V4) && (set_ip.find(".") != std::string::npos)) || > + ((addrType == AT_V6) && (set_ip.find(":") != std::string::npos))) > + return set_ip; > + } > return set_ip; > } > > diff --git a/core/AmSession.h b/core/AmSession.h > index daa227b..ec2a2dc 100644 > --- a/core/AmSession.h > +++ b/core/AmSession.h > @@ -584,7 +584,7 @@ public: > virtual void onBeforeDestroy() { } > > // The IP address to put as c= in SDP bodies > - string advertisedIP(); > + string advertisedIP(int addrType = AT_NONE); > > /** format session id for debugging */ > string sid4dbg(); > > _______________________________________________ > Semsdev mailing list > [email protected] > http://lists.iptel.org/mailman/listinfo/semsdev _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
