Skip to content
Snippets Groups Projects
  1. Dec 20, 2022
    • Naveen Albert's avatar
      res_pjsip_session: Use Caller ID for extension matching. · c7598ee9
      Naveen Albert authored
      Currently, there is no Caller ID available to us when
      checking for an extension match when handling INVITEs.
      As a result, extension patterns that depend on the Caller ID
      are not matched and calls may be incorrectly rejected.
      
      The Caller ID is not available because the supplement that
      adds Caller ID to the session does not execute until after
      this check. Supplement callbacks cannot yet be executed
      at this point since the session is not yet in the appropriate
      state.
      
      To fix this without impacting existing behavior, the Caller ID
      number is now retrieved before attempting to pattern match.
      This ensures pattern matching works correctly and there is
      no behavior change to the way supplements are called.
      
      ASTERISK-28767 #close
      
      Change-Id: Iec7f5a3b90e51b65ccf74342f96bf80314b7cfc7
      c7598ee9
    • Ben Ford's avatar
      res_pjsip_sdp_rtp.c: Use correct timeout when put on hold. · 881faf54
      Ben Ford authored
      When a call is put on hold and it has moh_passthrough and rtp_timeout
      set on the endpoint, the wrong timeout will be used. rtp_timeout_hold is
      expected to be used, but rtp_timeout is used instead. This change adds a
      couple of checks for locally_held to determine if rtp_timeout_hold needs
      to be used instead of rtp_timeout.
      
      ASTERISK-30350
      
      Change-Id: I7b106fc244332014216d12bba851cefe884cc25f
      881faf54
    • Naveen Albert's avatar
      app_voicemail_odbc: Fix string overflow warning. · 20d4775d
      Naveen Albert authored
      Fixes a negative offset warning by initializing
      the buffer to empty.
      
      Additionally, although it doesn't currently complain
      about it, the size of a buffer is increased to
      accomodate the maximum size contents it could have.
      
      ASTERISK-30240 #close
      
      Change-Id: I8eecedf14d3f2a75864797f802277cac89a32877
      20d4775d
    • Naveen Albert's avatar
      func_callerid: Warn about invalid redirecting reason. · cbb1fd2c
      Naveen Albert authored
      Currently, if a user attempts to set a Caller ID related
      function to an invalid value, a warning is emitted,
      except for when setting the redirecting reason.
      We now emit a warning if we were unable to successfully
      parse the user-provided reason.
      
      ASTERISK-30332 #close
      
      Change-Id: Ic341f5d5f7303b6f1115549be64db58a85944f5a
      cbb1fd2c
    • Igor Goncharovsky's avatar
      res_pjsip: Fix path usage in case dialing with '@' · 115a1b4f
      Igor Goncharovsky authored
      Fix aor lookup on sip path addition. Issue happens in case of dialing
      with @ and overriding user part of RURI.
      
      ASTERISK-30100 #close
      Reported-by: Yury Kirsanov
      
      Change-Id: I3f2c42a583578c94397b113e32ca3ebf2d600e13
      115a1b4f
    • Peter Fern's avatar
      streams: Ensure that stream is closed in ast_stream_and_wait on error · 58404b5c
      Peter Fern authored
      When ast_stream_and_wait returns an error (for example, when attempting
      to stream to a channel after hangup) the stream is not closed, and
      callers typically do not check the return code. This results in leaking
      file descriptors, leading to resource exhaustion.
      
      This change ensures that the stream is closed in case of error.
      
      ASTERISK-30198 #close
      Reported-by: Julien Alie
      
      Change-Id: Ie46b67314590ad75154595a3d34d461060b2e803
      58404b5c
    • Naveen Albert's avatar
      app_sendtext: Remove references to removed applications. · 36bea9ad
      Naveen Albert authored
      Removes see-also references to applications that don't
      exist anymore (removed in Asterisk 19),
      so these dead links don't show up on the wiki.
      
      ASTERISK-30347 #close
      
      Change-Id: I9539bc30f57cd65aa4e2d5ce8185eafa09567909
      36bea9ad
  2. Dec 15, 2022
  3. Dec 13, 2022
    • Alexandre Fournier's avatar
      res_geoloc: fix NULL pointer dereference bug · 01b39622
      Alexandre Fournier authored
      The `ast_geoloc_datastore_add_eprofile` function does not return 0 on
      success, it returns the size of the underlying datastore. This means
      that the datastore will be freed and its pointer set to NULL when no
      error occured at all.
      
      ASTERISK-30346
      
      Change-Id: Iea9b209bd1244cc57b903b9496cb680c356e4bb9
      01b39622
    • Joshua C. Colp's avatar
      res_pjsip_aoc: Don't assume a body exists on responses. · b6855755
      Joshua C. Colp authored
      When adding AOC to an outgoing response the code
      assumed that a body would exist for comparing the
      Content-Type. This isn't always true.
      
      The code now checks to make sure the response has
      a body before checking the Content-Type.
      
      ASTERISK-21502
      
      Change-Id: Iaead371434fc3bc693dad487228106a7d7a5ac76
      b6855755
    • Naveen Albert's avatar
      app_if: Fix format truncation errors. · 2f9cdfbc
      Naveen Albert authored
      Fixes format truncation warnings in gcc 12.2.1.
      
      ASTERISK-30349 #close
      
      Change-Id: I42be4edf0284358b906e765d1966b6b9d66e1d3c
      2f9cdfbc
  4. Dec 09, 2022
    • Michael Kuron's avatar
      manager: AOC-S support for AOCMessage · 5c114dcb
      Michael Kuron authored
      ASTERISK-21502
      
      Change-Id: I051b778f8c862d3b4794d28f2f3d782316707b08
      5c114dcb
    • Michael Kuron's avatar
      res_pjsip_aoc: New module for sending advice-of-charge with chan_pjsip · fee9012f
      Michael Kuron authored
      
      chan_sip supported sending AOC-D and AOC-E information in SIP INFO
      messages in an "AOC" header in a format that was originally defined by
      Snom. In the meantime, ETSI TS 124 647 introduced an XML-based AOC
      format that is supported by devices from multiple vendors, including
      Snom phones with firmware >= 8.4.2 (released in 2010).
      
      This commit adds a new res_pjsip_aoc module that inserts AOC information
      into outgoing messages or sends SIP INFO messages as described below.
      It also fixes a small issue in res_pjsip_session which didn't always
      call session supplements on outgoing_response.
      
      * AOC-S in the 180/183/200 responses to an INVITE request
      * AOC-S in SIP INFO (if a 200 response has already been sent or if the
        INVITE was sent by Asterisk)
      * AOC-D in SIP INFO
      * AOC-D in the 200 response to a BYE request (if the client hangs up)
      * AOC-D in a BYE request (if Asterisk hangs up)
      * AOC-E in the 200 response to a BYE request (if the client hangs up)
      * AOC-E in a BYE request (if Asterisk hangs up)
      
      The specification defines one more, AOC-S in an INVITE request, which
      is not implemented here because it is not currently possible in
      Asterisk to have AOC data ready at this point in call setup. Once
      specifying AOC-S via the dialplan or passing it through from another
      SIP channel's INVITE is possible, that might be added.
      
      The SIP INFO requests are sent out immediately when the AOC indication
      is received. The others are inserted into an appropriate outgoing
      message whenever that is ready to be sent. In the latter case, the XML
      is stored in a channel variable at the time the AOC indication is
      received. Depending on where the AOC indications are coming from (e.g.
      PRI or AMI), it may not always be possible to guarantee that the AOC-E
      is available in time for the BYE.
      
      Successfully tested AOC-D and both variants of AOC-E with a Snom D735
      running firmware 10.1.127.10. It does not appear to properly support
      AOC-S however, so that could only be tested by inspecting SIP traces.
      
      ASTERISK-21502 #close
      Reported-by: default avatarMatt Jordan <mjordan@digium.com>
      
      Change-Id: Iebb7ad0d5f88526bc6629d3a1f9f11665434d333
      fee9012f
    • Joshua C. Colp's avatar
      ari: Destroy body variables in channel create. · 564349ff
      Joshua C. Colp authored
      When passing a JSON body to the 'create' channel route
      it would be converted into Asterisk variables, but never
      freed resulting in a memory leak.
      
      This change makes it so that the variables are freed in
      all cases.
      
      ASTERISK-30344
      
      Change-Id: I924dbd866a01c6073e2d6fb846ccaa27ef72d49d
      564349ff
    • Naveen Albert's avatar
      app_voicemail: Fix missing email in msg_create_from_file. · b9c031c1
      Naveen Albert authored
      msg_create_from_file currently does not dispatch emails,
      which means that applications using this function, such
      as MixMonitor, will not trigger notifications to users
      (only AMI events are sent our currently). This is inconsistent
      with other ways users can receive voicemail.
      
      This is fixed by adding an option that attempts to send
      an email and falling back to just the notifications as
      done now if that fails. The existing behavior remains
      the default.
      
      ASTERISK-30283 #close
      
      Change-Id: I597cbb9cf971a18d8776172b26ab187dc096a5c7
      b9c031c1
    • Marcel Wagner's avatar
      res_pjsip: Fix typo in from_domain documentation · 58534b30
      Marcel Wagner authored
      This fixes a small typo in the from_domain documentation on the endpoint documentation
      
      ASTERISK-30328 #close
      
      Change-Id: Ia6f0897c3f5cab899ef2cde6b3ac07265b8beb21
      58534b30
    • Naveen Albert's avatar
      res_hep: Add support for named capture agents. · 531eacd6
      Naveen Albert authored
      Adds support for the capture agent name field
      of the Homer protocol to Asterisk by allowing
      users to specify a name that will be sent to
      the HEP server.
      
      ASTERISK-30322 #close
      
      Change-Id: I6136583017f9dd08daeb8be02f60fb8df4639a2b
      531eacd6
  5. Dec 08, 2022
    • Naveen Albert's avatar
      app_if: Adds conditional branch applications · b365ea86
      Naveen Albert authored
      Adds the If, ElseIf, Else, ExitIf, and EndIf
      applications for conditional execution
      of a block of dialplan, similar to the While,
      EndWhile, and ExitWhile applications. The
      appropriate branch is executed at most once
      if available and may be broken out of while
      inside.
      
      ASTERISK-29497
      
      Change-Id: I3aa3bd35a5add82465c6ee9bd86b64601f0e1f49
      b365ea86
    • Naveen Albert's avatar
      res_pjsip_session.c: Map empty extensions in INVITEs to s. · 0d6003fa
      Naveen Albert authored
      Some SIP devices use an empty extension for PLAR functionality.
      
      Rather than rejecting these empty extensions, we now use the s
      extension for such calls to mirror the existing PLAR functionality
      in Asterisk (e.g. chan_dahdi).
      
      ASTERISK-30265 #close
      
      Change-Id: I0861a405cd49bbbf532b52f7b47f0e2810832590
      0d6003fa
    • Marcel Wagner's avatar
      res_pjsip: Update contact_user to point out default · b83af13f
      Marcel Wagner authored
      Updates the documentation for the 'contact_user' field to point out the
      default outbound contact if no contact_user is specified 's'
      
      ASTERISK-30316 #close
      
      Change-Id: I61f24fb9164e4d07e05908a2511805281874c876
      b83af13f
    • Naveen Albert's avatar
      res_adsi: Fix major regression caused by media format rearchitecture. · 80e6205b
      Naveen Albert authored
      The commit that rearchitected media formats,
      a2c912e9 (ASTERISK_23114)
      introduced a regression by improperly translating code in res_adsi.c.
      In particular, the pointer to the frame buffer was initialized
      at the top of adsi_careful_send, rather than dynamically updating it
      for each frame, as is required.
      
      This resulted in the first frame being repeatedly sent,
      rather than advancing through the frames.
      This corrupted the transmission of the CAS to the CPE,
      which meant that CPE would never respond with the DTMF acknowledgment,
      effectively completely breaking ADSI functionality.
      
      This issue is now fixed, and ADSI now works properly again.
      
      ASTERISK-29793 #close
      
      Change-Id: Icdeddf733eda2981c98712d1ac9cddc0db507dbe
      80e6205b
    • Naveen Albert's avatar
      res_pjsip_header_funcs: Add custom parameter support. · 406143ae
      Naveen Albert authored
      Adds support for custom URI and header parameters
      in the From header in PJSIP. Parameters can be
      both set and read using this function.
      
      ASTERISK-30150 #close
      
      Change-Id: Ifb1bc3c512ad5f6faeaebd7817f004a2ecbd6428
      406143ae
    • Naveen Albert's avatar
      func_presencestate: Fix invalid memory access. · 83eb113e
      Naveen Albert authored
      When parsing information from AstDB while loading,
      it is possible that certain pointers are never
      set, which leads to invalid memory access and
      then, fatally, invalid free attempts on this memory.
      We now initialize to NULL to prevent this.
      
      ASTERISK-30311 #close
      
      Change-Id: I6120681d04fd2c12a9473f35ce95a1f8e74e3929
      83eb113e
    • Naveen Albert's avatar
      sig_analog: Fix no timeout duration. · b90e5775
      Naveen Albert authored
      ASTERISK_28702 previously attempted to fix an
      issue with flash hook hold timing out after
      just under 17 minutes, when it should have never
      been timing out. It fixed this by changing 999999
      to INT_MAX, but it did so in chan_dahdi, which
      is the wrong place since ss_thread is now in
      sig_analog and the one in chan_dahdi is mostly
      dead code.
      
      This fixes this by porting the fix to sig_analog.
      
      ASTERISK-30336 #close
      
      Change-Id: I05eb69cc0b5319d357842a70bd26ef64d145cb15
      b90e5775
    • Naveen Albert's avatar
      xmldoc: Allow XML docs to be reloaded. · 52c7d3ed
      Naveen Albert authored
      The XML docs are currently only loaded on
      startup with no way to update them during runtime.
      This makes it impossible to load modules that
      use ACO/Sorcery (which require documentation)
      if they are added to the source tree and built while
      Asterisk is running (e.g. external modules).
      
      This adds a CLI command to reload the XML docs
      during runtime so that documentation can be updated
      without a full restart of Asterisk.
      
      ASTERISK-30289 #close
      
      Change-Id: I4f265b0e5517e757c5453a0f241201a5788d3a07
      52c7d3ed
    • Naveen Albert's avatar
      rtp_engine.h: Update examples using ast_format_set. · a4bcdce1
      Naveen Albert authored
      This file includes some doxygen comments referencing
      ast_format_set. This is an obsolete API that was
      removed years back, but documentation was not fully
      updated to reflect that. These examples are
      updated to the current way of doing things
      (using the format cache).
      
      ASTERISK-30327 #close
      
      Change-Id: I570f3b8007fa17ba470cc7117f44bfe7c555d2f7
      a4bcdce1
    • Naveen Albert's avatar
      app_mixmonitor: Add option to use real Caller ID for voicemail. · 691178c4
      Naveen Albert authored
      MixMonitor currently uses the Connected Line as the Caller ID
      for voicemails. This is due to the implementation being written
      this way for use with Digium phones. However, in general this
      is not correct for generic usage in the dialplan, and people
      may need the real Caller ID instead. This adds an option to do that.
      
      ASTERISK-30286 #close
      
      Change-Id: I3d0ce76dfe75e2a614e0f709ab27acbd2478267c
      691178c4
  6. Dec 03, 2022
    • Ben Ford's avatar
      pjproject: 2.13 security fixes · d4769947
      Ben Ford authored
      Backports two security fixes (c4d3498 and 450baca) from pjproject 2.13.
      
      ASTERISK-30338
      
      Change-Id: I86fdc003d5d22cb66e7cc6dc3313a8194f27eb69
      d4769947
    • George Joseph's avatar
      pjsip_transport_events: Fix possible use after free on transport · 7684c9e9
      George Joseph authored
      It was possible for a module that registered for transport monitor
      events to pass in a pjsip_transport that had already been freed.
      This caused pjsip_transport_events to crash when looking up the
      monitor for the transport.  The fix is a two pronged approach.
      
      1. We now increment the reference count on pjsip_transports when we
      create monitors for them, then decrement the count when the
      transport is going to be destroyed.
      
      2. There are now APIs to register and unregister monitor callbacks
      by "transport key" which is a string concatenation of the remote ip
      address and port.  This way the module needing to monitor the
      transport doesn't have to hold on to the transport object itself to
      unregister.  It just has to save the transport_key.
      
      * Added the pjsip_transport reference increment and decrement.
      
      * Changed the internal transport monitor container key from the
        transport->obj_name (which may not be unique anyway) to the
        transport_key.
      
      * Added a helper macro AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR() that
        fills a buffer with the transport_key using a passed-in
        pjsip_transport.
      
      * Added the following functions:
        ast_sip_transport_monitor_register_key
        ast_sip_transport_monitor_register_replace_key
        ast_sip_transport_monitor_unregister_key
        and marked their non-key counterparts as deprecated.
      
      * Updated res_pjsip_pubsub and res_pjsip_outbound_register to use
        the new "key" monitor functions.
      
      NOTE: res_pjsip_registrar also uses the transport monitor
      functionality but doesn't have a persistent object other than
      contact to store a transport key.  At this time, it continues to
      use the non-key monitor functions.
      
      ASTERISK-30244
      
      Change-Id: I1a20baf2a8643c272dcf819871d6c395f148f00b
      7684c9e9
    • Mike Bradeen's avatar
      manager: prevent file access outside of config dir · 81f10e84
      Mike Bradeen authored
      Add live_dangerously flag to manager and use this flag to
      determine if a configuation file outside of AST_CONFIG_DIR
      should be read.
      
      ASTERISK-30176
      
      Change-Id: I46b26af4047433b49ae5c8a85cb8cda806a07404
      81f10e84
  7. Dec 01, 2022
  8. Nov 29, 2022
    • Naveen Albert's avatar
      pbx_builtins: Allow Answer to return immediately. · c7df5ee7
      Naveen Albert authored
      The Answer application currently waits for up to 500ms
      for media, even if users specify a different timeout.
      
      This adds an option to not wait for media on the channel
      by doing a raw answer instead. The default 500ms threshold
      is also documented.
      
      ASTERISK-30308 #close
      
      Change-Id: Id59cd340c44b8b8b2384c479e17e5123e917cba4
      c7df5ee7
    • Naveen Albert's avatar
      chan_dahdi: Allow FXO channels to start immediately. · 5ede4e21
      Naveen Albert authored
      Currently, chan_dahdi will wait for at least one
      ring before an incoming call can enter the dialplan.
      This is generally necessary in order to receive
      the Caller ID spill and/or distinctive ringing
      detection.
      
      However, if neither of these is required, then there
      is nothing gained by waiting for one ring and this
      unnecessarily delays call setup. Users can now
      use immediate=yes to make FXO channels (FXS signaled)
      begin processing dialplan as soon as Asterisk receives
      the call.
      
      ASTERISK-30305 #close
      
      Change-Id: I20818b370b2e4892c7f40c8a8753fa06a81750b5
      5ede4e21
    • Maximilian Fridrich's avatar
      core & res_pjsip: Improve topology change handling. · 60b81eab
      Maximilian Fridrich authored
      This PR contains two relatively separate changes in channel.c and
      res_pjsip_session.c which ensure that topology changes are not ignored
      in cases where they should be handled.
      
      For channel.c:
      
      The function ast_channel_request_stream_topology_change only triggers a
      stream topology request change indication, if the channel's topology
      does not equal the requested topology. However, a channel could be in a
      state where it is currently "negotiating" a new topology but hasn't
      updated it yet, so the topology request change would be lost. Channels
      need to be able to handle such situations internally and stream
      topology requests should therefore always be passed on.
      
      In the case of chan_pjsip for example, it queues a session refresh
      (re-INVITE) if it is currently in the middle of a transaction or has
      pending requests (among other reasons).
      
      Now, ast_channel_request_stream_topology_change always indicates a
      stream topology request change even if the requested topology equals the
      channel's topology.
      
      For res_pjsip_session.c:
      
      The function resolve_refresh_media_states does not process stream state
      changes if the delayed active state differs from the current active
      state. I.e. if the currently active stream state has changed between the
      time the sip session refresh request was queued and the time it is being
      processed, the session refresh is ignored. However, res_pjsip_session
      contains logic that ensures that session refreshes are queued and
      re-queued correctly if a session refresh is currently not possible. So
      this check is not necessary and led to some session refreshes being
      lost.
      
      Now, a session refresh is done even if the delayed active state differs
      from the current active state and it is checked whether the delayed
      pending state differs from the current active - because that means a
      refresh is necessary.
      
      Further, the unit test of resolve_refresh_media_states was adapted to
      reflect the new behavior. I.e. the changes to delayed pending are
      prioritized over the changes to current active because we want to
      preserve the original intention of the pending state.
      
      ASTERISK-30184
      
      Change-Id: Icd0703295271089057717006730b555b9a1d4e5a
      60b81eab
  9. Nov 28, 2022
    • Naveen Albert's avatar
      sla: Prevent deadlock and crash due to autoservicing. · 2efa290d
      Naveen Albert authored
      SLAStation currently autoservices the station channel before
      creating a thread to actually dial the trunk. This leads
      to duplicate servicing of the channel which causes assertions,
      deadlocks, crashes, and moreover not the correct behavior.
      
      Removing the autoservice prevents the crash, but if the station
      hangs up before the trunk answers, the call hangs since the hangup
      was never serviced on the channel.
      
      This is fixed by not autoservicing the channel, but instead
      servicing it in the thread dialing the trunk, since it is doing
      so synchronously to begin with. Instead of sleeping for 100ms
      in a loop, we simply use the channel for timing, and abort
      if it disappears.
      
      The same issue also occurs with SLATrunk when a call is answered,
      because ast_answer invokes ast_waitfor_nandfds. Thus, we use
      ast_raw_answer instead which does not cause any conflict and allows
      the call to be answered normally without thread blocking issues.
      
      ASTERISK-29998 #close
      
      Change-Id: Icc237d50354b5910000d2305901e86d2c87bb9d8
      2efa290d
  10. Nov 21, 2022
    • Jaco Kroon's avatar
      Build system: Avoid executable stack. · ce2153fc
      Jaco Kroon authored
      
      Found in res_geolocation, but I believe others may have similar issues,
      thus not linking to a specific issue.
      
      Essentially gcc doesn't mark the stack for being non-executable unless
      it's compiling the source, this informs ld via gcc to mark the object as
      not requiring an executable stack (which a binary blob obviously
      doesn't).
      
      ASTERISK-30321
      
      Change-Id: I71bcc2fd1fe0c82a28b3257405d6f2b566fd9bfc
      Signed-off-by: default avatarJaco Kroon <jaco@uls.co.za>
      ce2153fc
    • Naveen Albert's avatar
      func_json: Fix memory leak. · 002afc3f
      Naveen Albert authored
      A memory leak was present in func_json due to
      using ast_json_free, which just calls ast_free,
      as opposed to recursively freeing the JSON
      object as needed. This is now fixed to use the
      right free functions.
      
      ASTERISK-30293 #close
      
      Change-Id: I982324dde841dc9147c8d8ad35c8719daf418b49
      002afc3f
    • Naveen Albert's avatar
      test_json: Remove duplicated static function. · 1e77b8c4
      Naveen Albert authored
      Removes the function mkstemp_file and uses
      ast_file_mkftemp from file.h instead.
      
      ASTERISK-30295 #close
      
      Change-Id: I7412ec06f88c39ee353bcdb8c976c2fcac546609
      1e77b8c4
  11. Nov 16, 2022
    • Joshua C. Colp's avatar
      res_agi: Respect "transmit_silence" option for "RECORD FILE". · 61922d29
      Joshua C. Colp authored
      The "RECORD FILE" command in res_agi has its own
      implementation for actually doing the recording. This
      has resulted in it not actually obeying the option
      "transmit_silence" when recording.
      
      This change causes it to now send silence if the
      option is enabled.
      
      ASTERISK-30314
      
      Change-Id: Ib3a85601ff35d1b904f836691bad8a4b7e957174
      61922d29
  12. Nov 08, 2022
    • Naveen Albert's avatar
      app_mixmonitor: Add option to delete files on exit. · 6e59b01e
      Naveen Albert authored
      Adds an option that allows MixMonitor to delete
      its copy of any recording files before exiting.
      
      This can be handy in conjunction with options
      like m, which copy the file elsewhere, and the
      original files may no longer be needed.
      
      ASTERISK-30284 #close
      
      Change-Id: Ida093679c67e300efc154a97b6d8ec0f104e581e
      6e59b01e
Loading