i modified AmSession::advertisedIP() so that if optional address type
argument is given, it looks for first media ip of that type instead of
just using ip of first media interface no matter what its type is.

after that i was able to make sems to terminate a call successfully
using  ip4 signaling and either ipv4 or ipv6 media.

the patch below is not yet enough though, because some other piece of
sems code is overwriting sdp answer address type that i correctly set in
AmSession::getSdpAnswer from offer:

bool AmSession::getSdpAnswer(const AmSdp& offer, AmSdp& answer)
{
  DBG("AmSession::getSdpAnswer(...) ...\n");

  answer.version = 0;
  answer.origin.user = "sems";
  //answer.origin.sessId = 1;
  //answer.origin.sessV = 1;
  answer.sessionName = "sems";
  answer.conn.network = NT_IN;
  answer.conn.addrType = offer.conn.addrType;
  INFO("answer.conn.addrType is %d\n", answer.conn.addrType);
  answer.conn.address = advertisedIP(offer.conn.addrType);

the INFO call produces:

Jan 20 04:02:51 sip sems[10241]: [#b5142b70] [getSdpAnswer, AmSession.cpp:986] 
INFO:  answer.conn.addrType is 2

but still when i check with wireshark, address type in SDP is IPv4 and
not IPV6:

o=sems 1818989494 1274961143 IN IP4 2002:c062:660a::1.
s=sems.
c=IN IP4 2002:c062:660a::1.

i would appreciate inside info on this one.  why is answer.conn.addrType
set in AmSession::getSdpAnswer, when its value is later overridden and
how can i prevent the overwriting from happening?

-- juha

diff -c /usr/src/trunk-src/openxg-sems/core/AmSession.cpp AmSession.cpp 
*** /usr/src/trunk-src/openxg-sems/core/AmSession.cpp   2013-01-20 
03:48:06.000000000 +0200
--- AmSession.cpp       2013-01-16 04:49:20.000000000 +0200
***************
*** 982,989 ****
    //answer.origin.sessV = 1;
    answer.sessionName = "sems";
    answer.conn.network = NT_IN;
!   answer.conn.addrType = offer.conn.addrType;
!   answer.conn.address = advertisedIP(offer.conn.addrType);
    answer.media.clear();
    
    bool audio_1st_stream = true;
--- 982,989 ----
    //answer.origin.sessV = 1;
    answer.sessionName = "sems";
    answer.conn.network = NT_IN;
!   answer.conn.addrType = AT_V4;
!   answer.conn.address = advertisedIP();
    answer.media.clear();
    
    bool audio_1st_stream = true;
***************
*** 1233,1239 ****
  
  // Utility for basic NAT handling: allow the config file to specify the IP
  // address to use in SDP bodies 
! string AmSession::advertisedIP(int addrType)
  {
    if(rtp_interface < 0){
      // TODO: get default media interface for signaling IF instead
--- 1233,1239 ----
  
  // Utility for basic NAT handling: allow the config file to specify the IP
  // address to use in SDP bodies 
! string AmSession::advertisedIP()
  {
    if(rtp_interface < 0){
      // TODO: get default media interface for signaling IF instead
***************
*** 1248,1263 ****
    assert(rtp_interface >= 0);
    assert((unsigned int)rtp_interface < AmConfig::RTP_Ifs.size());
  
!   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;
  }  
  
--- 1248,1257 ----
    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.
! 
    return set_ip;
  }  
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to