Commit b38622b8 authored by YannGarcia's avatar YannGarcia
Browse files

Bug fixed in multipart message body encoding/decoding (hardcoded content-type)

parent 6a7ab123
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -94,7 +94,9 @@ namespace LibSip__Interface {
      return;
      return;
    }
    }


    if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::INVITE__E) {
    if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::REGISTER__E) {
      incoming_message(LibSip__SIPTypesAndValues::REGISTER__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
    } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::INVITE__E) {
      incoming_message(LibSip__SIPTypesAndValues::INVITE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
      incoming_message(LibSip__SIPTypesAndValues::INVITE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
    } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::SUBSCRIBE__E) {
    } else if (p_ind.requestLine().method() == LibSip__SIPTypesAndValues::Method::SUBSCRIBE__E) {
      incoming_message(LibSip__SIPTypesAndValues::SUBSCRIBE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
      incoming_message(LibSip__SIPTypesAndValues::SUBSCRIBE__Request(p_ind.requestLine(), p_ind.msgHeader(), p_ind.messageBody(), p_ind.payload()));
+15 −3
Original line number Original line Diff line number Diff line
@@ -119,8 +119,14 @@ int sip_codec_message_body::encode_message_body(const LibSip__MessageBodyTypes::
            loggers::get_instance().warning("sip_codec_message_body::encode_message_body: Failed to set XML body content-type");
            loggers::get_instance().warning("sip_codec_message_body::encode_message_body: Failed to set XML body content-type");
            return -1;
            return -1;
          }
          }
          const char* ct = static_cast<const char*>(p.content__type());
          loggers::get_instance().log("sip_codec_message_body::encode_message_body: content-type: %s", ct);
          if (ct != nullptr) {
            ::osip_body_set_contenttype(body, ct);
          } else { // Use a default value
            ::osip_body_set_contenttype(body, "application/sdp");
            ::osip_body_set_contenttype(body, "application/sdp");
          }
          }
        }
      } else if (ps.ischosen(LibSip__MessageBodyTypes::MIME__Encapsulated__Parts::ALT_xmlBody)) {
      } else if (ps.ischosen(LibSip__MessageBodyTypes::MIME__Encapsulated__Parts::ALT_xmlBody)) {
        const LibSip__XMLTypes::XmlBody& xml = ps.xmlBody();
        const LibSip__XMLTypes::XmlBody& xml = ps.xmlBody();
        osip_body_t* body;
        osip_body_t* body;
@@ -141,10 +147,16 @@ int sip_codec_message_body::encode_message_body(const LibSip__MessageBodyTypes::
        body = nullptr;
        body = nullptr;
        loggers::get_instance().log("sip_codec_message_body::encode_message_body: get item #%d", ::osip_list_size(&p_sip_message->bodies) - 1);
        loggers::get_instance().log("sip_codec_message_body::encode_message_body: get item #%d", ::osip_list_size(&p_sip_message->bodies) - 1);
        if (::osip_message_get_body(p_sip_message, ::osip_list_size(&p_sip_message->bodies) - 1, &body) != ::osip_list_size(&p_sip_message->bodies) - 1) {
        if (::osip_message_get_body(p_sip_message, ::osip_list_size(&p_sip_message->bodies) - 1, &body) != ::osip_list_size(&p_sip_message->bodies) - 1) {
          loggers::get_instance().warning("sip_codec_message_body::encode_message_body: Failed to set XML body content-type");
          loggers::get_instance().warning("sip_codec_message_body::encode_message_body: Failed to set content-type");
          return -1;
          return -1;
        }
        }
        ::osip_body_set_contenttype(body, "application/pidf+xml");
        const char* ct = static_cast<const char*>(p.content__type());
        loggers::get_instance().log("sip_codec_message_body::encode_message_body: content-type: %s", ct);
        if (ct != nullptr) {
          ::osip_body_set_contenttype(body, ct);
        } else { // Use a default value
          ::osip_body_set_contenttype(body, "application/resource-lists+xml");
        }
      } else if (ps.ischosen(LibSip__MessageBodyTypes::MIME__Encapsulated__Parts::ALT_msdBody)) {
      } else if (ps.ischosen(LibSip__MessageBodyTypes::MIME__Encapsulated__Parts::ALT_msdBody)) {
        loggers::get_instance().warning("sip_codec_message_body::encode_message_body: Unsupported decoding of ALT_msdBody");
        loggers::get_instance().warning("sip_codec_message_body::encode_message_body: Unsupported decoding of ALT_msdBody");
      } else {
      } else {
+3 −3
Original line number Original line Diff line number Diff line
@@ -15,18 +15,18 @@ LibNg112_Pixits.PX_IMS_SUT_UE1_PUBLIC_USER := "alice-06"
LibNg112_Pixits.PX_IMS_SUT_UE1_HOME_DOMAIN       := "plugtests.net"
LibNg112_Pixits.PX_IMS_SUT_UE1_HOME_DOMAIN       := "plugtests.net"
LibNg112_Pixits.PX_IMS_TS_UE1_IPADDR             := "conftest.plugtests.net" # Local UE address used for From header
LibNg112_Pixits.PX_IMS_TS_UE1_IPADDR             := "conftest.plugtests.net" # Local UE address used for From header
LibNg112_Pixits.PX_IMS_SUT_UE1_BEARER_IPADDR     := "conftest.plugtests.net" # Local UE address used for SDP connection attrubute
LibNg112_Pixits.PX_IMS_SUT_UE1_BEARER_IPADDR     := "conftest.plugtests.net" # Local UE address used for SDP connection attrubute
LibNg112_Pics.PICS_PSAP_CALL_TAKER               := true      # Set to true when CallTalker interface is available
LibNg112_Pics.PICS_PSAP_CALL_TAKER               := false      # Set to true when CallTalker interface is available
#LibNg112_Pixits.PX_IMS_TS_UE1_PORT               := 5052  # SIP over TCP port
#LibNg112_Pixits.PX_IMS_TS_UE1_PORT               := 5052  # SIP over TCP port
LibNg112_Pixits.PX_IMS_SUT_EMERGENCY_SERVICE     := "sos"
LibNg112_Pixits.PX_IMS_SUT_EMERGENCY_SERVICE     := "sos"
LibNg112_Pixits.PX_IMS_SUT_EMERGENCY_HOME_DOMAIN := "psap1.frequentis.plugtests.net"
LibNg112_Pixits.PX_IMS_SUT_EMERGENCY_HOME_DOMAIN := "psap1.frequentis.plugtests.net"
LibNg112_Pixits.PX_IMS_SUT_PCSCF1_IPADDR         := "psap1.frequentis.plugtests.net"
LibNg112_Pixits.PX_IMS_SUT_PCSCF1_IPADDR         := "psap1.frequentis.plugtests.net"
LibNg112_Pixits.PX_IMS_SUT_UE_IPADDR             := "psap1.frequentis.plugtests.net"
LibNg112_Pixits.PX_IMS_SUT_UE_IPADDR             := "psap1.frequentis.plugtests.net"


AtsPSAP_Pics.PICS_PSAP_S_SIP_REGISTRATION := false
AtsPSAP_Pics.PICS_PSAP_S_SIP_REGISTRATION := true
AtsPSAP_Pics.PICS_PSAP_S_SIP_TCP1         := false       # Set to true when using SIP over TCP ==> change SIP ports configuration
AtsPSAP_Pics.PICS_PSAP_S_SIP_TCP1         := false       # Set to true when using SIP over TCP ==> change SIP ports configuration
                                                 # Update LibSip_PIXITS.PX_SIP_TRANSPORT according to true/false value
                                                 # Update LibSip_PIXITS.PX_SIP_TRANSPORT according to true/false value
AtsPSAP_Pics.PICS_PSAP_S_SIP_UDP1         := true
AtsPSAP_Pics.PICS_PSAP_S_SIP_UDP1         := true
AtsPSAP_Pics.PICS_PSAP_USE_TLS            := false
AtsPSAP_Pics.PICS_PSAP_USE_TLS            := true


LibSip_PIXITS.PX_SIP_TRANSPORT            := "UDP"     # Transport is TCP or TCP
LibSip_PIXITS.PX_SIP_TRANSPORT            := "UDP"     # Transport is TCP or TCP


+1 −1
Original line number Original line Diff line number Diff line
echo "Simulate PSAP Caller side (UAS)"
echo "Simulate PSAP Caller side (UAS)"
sipp -t t1 -trace_msg -m 1 -sf PsapCaller.xml 127.0.0.1:5060
sipp -t u1 -trace_msg -m 1 -sf PsapCaller.xml 127.0.0.1:5061
 No newline at end of file
+53 −5
Original line number Original line Diff line number Diff line
@@ -23,6 +23,52 @@
  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
  <!-- By adding rrs="true" (Record Route Sets), the route sets         -->
  <!-- are saved and used for following messages sent. Useful to test   -->
  <!-- are saved and used for following messages sent. Useful to test   -->
  <!-- against stateful SIP proxies/B2BUAs.                             -->
  <!-- against stateful SIP proxies/B2BUAs.                             -->

  <send retrans="500">
    <![CDATA[

      REGISTER sip:[remote_ip] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
      To: caller <sip:[service]@127.0.0.1:5080>
      Call-ID: [call_id]
      CSeq: 1 REGISTER
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Expires: 1800
      User-Agent: SIPp/Linux
      Route: <sip:[local_ip]:[local_port]>;lr
      Content-Length: 0

    ]]>
  </send>

  <recv response="401" auth="true">
  </recv>

  <send retrans="500">
    <![CDATA[

      REGISTER sip:[remote_ip] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
      To: caller <sip:[service]@127.0.0.1:5080>
      Call-ID: [call_id]
      CSeq: 2 REGISTER
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 70
      Expires: 1800
      User-Agent: SIPp/Linux
      Content-Length: 0

    ]]>
  </send>

  <recv response="200" rtd="true">
  </recv>

  <pause milliseconds="1"/>

  <recv request="INVITE" crlf="true" rrs="true">
  <recv request="INVITE" crlf="true" rrs="true">
  </recv>
  </recv>


@@ -106,11 +152,13 @@
  <!-- Keep the call open for a while in case the 200 is lost to be     -->
  <!-- Keep the call open for a while in case the 200 is lost to be     -->
  <!-- able to retransmit it if we receive the BYE again.               -->
  <!-- able to retransmit it if we receive the BYE again.               -->
  <pause milliseconds="4000">
  <pause milliseconds="4000">
    <action>
    <!-- action>
      <exec command="sipp -t u1 -trace_msg -m 1 -sf PsapCallTalker.xml 127.0.0.1:5080"></exec>
      <exec command="sipp -t u1 -trace_msg -m 1 -sf PsapCallTalker.xml 127.0.0.1:5080"></exec>
    </action>
    </action-->
  </pause>
  </pause>


  <pause milliseconds="4000"/>

  <recv request="BYE">
  <recv request="BYE">
  </recv>
  </recv>


Loading