Skip to content
Snippets Groups Projects
  1. Aug 08, 2015
    • David M. Lee's avatar
      Replace htobe64 with htonll · d5f0c271
      David M. Lee authored
      We don't have a compatability function to fill in a missing htobe64; but
      we already have one for the identical htonll.
      
      Change-Id: Ic0a95db1c5b0041e14e6b127432fb533b97e4cac
      d5f0c271
  2. Aug 07, 2015
  3. Aug 06, 2015
    • Scott Emidy's avatar
      ARI: Deleting log channels · f19c4930
      Scott Emidy authored
      An http request can be sent to delete a log channel
      in Asterisk.
      
      The command "curl -v -u user:pass -X DELETE 'http://localhost:8088
      /ari/asterisk/logging/mylog'" can be run in the terminal
      to access the newly implemented functionally for ARI.
      
      * Able to delete log channels using ARI
      
      ASTERISK-25252
      
      Change-Id: Id6eeb54ebcc511595f0418d586ff55914bc3aae6
      f19c4930
    • Mark Michelson's avatar
      res_pjsip_pubsub: More accurately persist packet. · 382334cc
      Mark Michelson authored
      The pjsip_rx_data structure has a pkt_info.packet field on it that is
      the packet that was read from the transport. For datagram transports,
      the packet read from the transport will correspond to the SIP message
      that arrived. For streamed transports, however, it is possible to read
      multiple SIP messages in one packet.
      
      In a recent case, Asterisk crashed on a system where TCP was being used.
      This is because at some point, a read from the TCP socket resulted in a
      200 OK response as well as an incoming SUBSCRIBE request being stored in
      rdata->pkt_info.packet. When the SUBSCRIBE was processed, the
      combination 200 OK and SUBSCRIBE was saved in persistent storage. Later,
      a restart of Asterisk resulted in the crash because the persistent
      subscription recreation code ended up building the 200 OK response
      instead of a SUBSCRIBE request, and we attempted to access
      request-specific data.
      
      The fix here is to use the pjsip_msg_print() function in order to
      persist SUBSCRIBE requests. This way, rather than using the raw socket
      data, we use the parsed SIP message that PJSIP has given us. If we
      receive multiple SIP messages from a single read, we will be sure only
      to save off the relevant SIP message. There also is a safeguard put in
      place to make sure that if we do end up reconstructing a SIP response,
      it will not cause a crash.
      
      ASTERISK-25306 #close
      Reported by Mark Michelson
      
      Change-Id: I4bf16f7b76a2541d10b55de82bcd14c6e542afb2
      382334cc
    • Joshua Colp's avatar
    • Joshua Colp's avatar
      7ebca679
    • Joshua Colp's avatar
      res_pjsip: Ensure sanitized XML is NULL terminated. · 4b6c657a
      Joshua Colp authored
      The ast_sip_sanitize_xml function is used to sanitize
      a string for placement into XML. This is done by examining
      an input string and then appending values to an output
      buffer. The function used by its implementation, strncat,
      has specific behavior that was not taken into account.
      If the size of the input string exceeded the available
      output buffer size it was possible for the sanitization
      function to write past the output buffer itself causing
      a crash. The crash would either occur because it was
      writing into memory it shouldn't be or because the resulting
      string was not NULL terminated.
      
      This change keeps count of how much remaining space is
      available in the output buffer for text and only allows
      strncat to use that amount.
      
      Since this was exposed by the res_pjsip_pidf_digium_body_supplement
      module attempting to send a large message the maximum allowed
      message size has also been increased in it.
      
      A unit test has also been added which confirms that the
      ast_sip_sanitize_xml function is providing NULL terminated
      output even when the input length exceeds the output
      buffer size.
      
      ASTERISK-25304 #close
      
      Change-Id: I743dd9809d3e13d722df1b0509dfe34621398302
      4b6c657a
    • Joshua Colp's avatar
    • Joshua Colp's avatar
      8a48c9e6
  4. Aug 05, 2015
    • Joshua Colp's avatar
      res_rtp_asterisk: Don't leak temporary key when enabling PFS. · 7351d33a
      Joshua Colp authored
      A change recently went in which enabled perfect forward secrecy for
      DTLS in res_rtp_asterisk. This was accomplished two different ways
      depending on the availability of a feature in OpenSSL. The fallback
      method created a temporary instance of a key but did not free it.
      This change fixes that.
      
      ASTERISK-25265
      
      Change-Id: Iadc031b67a91410bbefb17ffb4218d615d051396
      7351d33a
  5. Aug 04, 2015
    • Mark Michelson's avatar
      res_http_websocket: Debug write lengths. · c63316ee
      Mark Michelson authored
      Commit 39cc28f6 attempted to fix a
      test failure observed on 32 bit test agents by ensuring that a cast from
      a 32 bit unsigned integer to a 64 bit unsigned integer was happening in
      a predictable place. As it turns out, this did not cause test runs to
      succeed.
      
      This commit adds several redundant debug messages that print the payload
      lengths of websocket frames. The idea here is that this commit will not
      cause tests to succeed for the faulty test agent, but we might deduce
      where the fault lies more easily this way by observing at what point the
      expected value (537) changes to some ungangly huge number.
      
      If you are wondering why something like this is being committed to the
      branch, keep in mind that in commit
      39cc28f6 I noted that the observed test
      failures only happen when automated tests are run. Attempts to run the
      tests by hand manually on the test agent result in the tests passing.
      
      Change-Id: I14a65c19d8af40dadcdbd52348de3b0016e1ae8d
      c63316ee
  6. Aug 03, 2015
    • Matt Jordan's avatar
    • Matt Jordan's avatar
      8672f0bb
    • Mark Michelson's avatar
      res_http_websocket: Avoid passing strlen() to ast_websocket_write(). · 35a98161
      Mark Michelson authored
      We have seen a rash of test failures on a 32-bit build agent. Commit
      48698a5e solved an obvious problem where
      we were not encoding a 64-bit value correctly over the wire. This
      commit, however, did not solve the test failures.
      
      In the failing tests, ARI is attempting to send a 537 byte text frame
      over a websocket. When sending a frame this small, 16 bits are all that
      is required in order to encode the payload length on the websocket
      frame. However, ast_websocket_write() thinks that the payload length is
      greater than 65535 and therefore writes out a 64 bit payload length.
      Inspecting this payload length, the lower 32 bits are exactly what we
      would expect it to be, 537 in hex. The upper 32 bits, are junk values
      that are not expected to be there.
      
      In the failure, we are passing the result of strlen() to a function that
      expects a uint64_t parameter to be passed in. strlen() returns a size_t,
      which on this 32-bit machine is 32 bits wide. Normally, passing a 32-bit
      unsigned value to somewhere where a 64-bit unsigned value is expected
      would cause no problems. In fact, in manual runs of failing tests, this
      works just fine. However, ast_websocket_write() uses the Asterisk
      optional API, which means that rather than a simple function call, there
      are a series of macros that are used for its declaration and
      implementation. These macros may be causing some sort of error to occur
      when converting from a 32 bit quantity to a 64 bit quantity.
      
      This commit changes the logic by making existing ast_websocket_write()
      calls use ast_websocket_write_string() instead. Within
      ast_websocket_write_string(), the 64-bit converted strlen is saved in a
      local variable, and that variable is passed to ast_websocket_write()
      instead.
      
      Note that this commit message is full of speculation rather than
      certainty. This is because the observed test failures, while always
      present in automated test runs, never occur when tests are manually
      attempted on the same test agent. The idea behind this commit is to fix
      a theoretical issue by performing changes that should, at the least,
      cause no harm. If it turns out that this change does not fix the failing
      tests, then this commit should be reverted.
      
      Change-Id: I4458dd87d785ca322b89c152b223a540a3d23e67
      35a98161
    • Joshua Colp's avatar
      Merge topic 'misc_rtp_tweaks' · 8eef7392
      Joshua Colp authored
      * changes:
        rtp_engine.h: No sense allowing payload types larger than RFC allows.
        rtp_engine.c: Minor tweaks.
        rtp_engine.h: Misc comment fixes.
      8eef7392
    • Joshua Colp's avatar
  7. Jul 31, 2015
    • Mark Michelson's avatar
    • Mark Michelson's avatar
      Merge "ARI: Rotate log channels." · 92ddda68
      Mark Michelson authored
      92ddda68
    • Joshua Colp's avatar
    • Benjamin Ford's avatar
      ARI: Rotate log channels. · 1f02d20d
      Benjamin Ford authored
      An http request can be sent to rotate a specified log channel.
      If the channel does not exist, an error response will be
      returned.
      
      The command "curl -v -u user:pass -X PUT 'http://localhost:8088
      /ari/asterisk/logging/logChannelName/rotate'" can be run in the
      terminal to access this new functionality.
      
      * Added the ability to rotate log files through ARI
      
      ASTERISK-25252
      
      Change-Id: Iaefa21cbbc1b29effb33004ee3d89c977e76ab01
      1f02d20d
    • Joshua Colp's avatar
      d61ea4bc
    • Ashley Sanders's avatar
      ARI: Channels added to Stasis application during WebSocket creation ... · fe804b09
      Ashley Sanders authored
      Prior to ASTERISK-24988, the WebSocket handshake was resolved before Stasis
      applications were registered. This was done such that the WebSocket would be
      ready when an application is registered. However, by creating the WebSocket
      first, the client had the ability to make requests for the Stasis application
      it thought had been created with the initial handshake request. The inevitable
      conclusion of this scenario was the cart being put before the horse.
      
      ASTERISK-24988 resolved half of the problem by ensuring that the applications
      were created and registered with Stasis prior to completing the handshake
      with the client. While this meant that Stasis was ready when the client
      received the green-light from Asterisk, it also meant that the WebSocket was
      not yet ready for Stasis to dispatch messages.
      
      This patch introduces a message queuing mechanism for delaying messages from
      Stasis applications while the WebSocket is being constructed. When the ARI
      event processor receives the message from the WebSocket that it is being
      created, the event processor instantiates an event session which contains a
      message queue. It then tries to create and register the requested applications
      with Stasis. Messages that are dispatched from Stasis between this point and
      the point at which the event processor is notified the WebSocket is ready, are
      stashed in the queue. Once the WebSocket has been built, the queue's messages
      are dispatched in the order in which they were originally received and the
      queue is concurrently cleared.
      
      ASTERISK-25181 #close
      Reported By: Matt Jordan
      
      Change-Id: Iafef7b85a2e0bf78c114db4c87ffc3d16d671a17
      fe804b09
    • Mark Michelson's avatar
      dns_core: Allow zero-length DNS responses. · 86034227
      Mark Michelson authored
      A testsuite test recently failed due to a crash that occurred in the DNS
      core. The problem was that the test could not resolve an address, did
      not set a result on the DNS query, and then indicated the query was
      completed. The DNS core does not handle the case of a query with no
      result gracefully, and so there is a crash.
      
      This changeset makes the DNS system resolver set a result with a
      zero-length answer in the case that a DNS resolution failure occurs
      early. The DNS core now also will accept such a response without
      treating it as invalid input. A unit test was updated to no longer treat
      setting a zero-length response as off-nominal.
      
      Change-Id: Ie56641e22debdaa61459e1c9a042e23b78affbf6
      86034227
  8. Jul 30, 2015
  9. Jul 29, 2015
    • Mark Michelson's avatar
      res_http_websocket: Properly encode 64 bit payload · 5fcd1bc5
      Mark Michelson authored
      A test agent was continuously failing all ARI tests when run against
      Asterisk 13. As it turns out, the reason for this is that on those test
      runs, for some reason we decided to use the super extended 64 bit
      payload length for websocket text frames instead of the extended 16 bit
      payload length. For 64-bit payloads, the expected byte order over the
      network is
      
      7, 6, 5, 4, 3, 2, 1, 0
      
      However, we were sending the payload as
      
      3, 2, 1, 0, 7, 6, 5, 4
      
      This meant that we were saying to expect an absolutely MASSIVE payload
      to arrive. Since we did not follow through on this expected payload
      size, the client would sit patiently waiting for the rest of the payload
      to arrive until the test would time out.
      
      With this change, we use the htobe64() function instead of htonl() so
      that a 64-bit byte-swap is performed instead of a 32 bit byte-swap.
      
      Change-Id: Ibcd8552392845fbcdd017a8c8c1043b7fe35964a
      5fcd1bc5
    • Mark Michelson's avatar
      Add a test event for inband ringing. · 8fb8988f
      Mark Michelson authored
      This event is necessary for the bridge_wait_e_options test to be able to
      confirm that ringing is being played on the local channel that runs the
      BridgeWait() application with the e(r) option.
      
      ASTERISK-25292 #close
      Reported by Kevin Harwell
      
      Change-Id: Ifd3d3d2bebc73344d4b5310d0d55c7675359d72e
      8fb8988f
Loading