Skip to content
Snippets Groups Projects
  1. Apr 03, 2017
    • Alexander Traud's avatar
      chan_sip: Session Timers required but refused wrongly. · 4fc22c76
      Alexander Traud authored
      SIP user-agents indicate which protocol extensions are allowed in headers
      like Supported and Required. Such protocol extensions are Session Timers
      (RFC 4028) for example. Session Timers are supported since Mantis-10665.
      Since ASTERISK-21721, not only the first but multiple Supported/Required
      headers in a message are parsed. In that change, an existing variable was
      re-used within a newly added do-loop. Currently, at the end of that loop,
      that variable is an empty string always. Previously, that variable was used
      within log output. However, the log output was not changed.
      
      ASTERISK-26915 #close
      
      Change-Id: I09315f31b4d78fb214bb2a9fb6c0f5e143eae990
      4fc22c76
  2. Mar 31, 2017
  3. Mar 20, 2017
    • Sean Bright's avatar
      thread safety: Don't use getprotobyname() · fc71c18a
      Sean Bright authored
      POSIX does not require getprotobyname() to be thread safe and some
      implementations use static memory which causes issues when multiple
      threads are used.
      
      Further, our usage of it today is just to ultimately get IPPROTO_TCP
      for calls to setsockopt(). So instead we just use IPPROTO_TCP directly.
      
      Change-Id: I2e14e58674808f7ce99b2f5e900d0f90d0d8da48
      fc71c18a
  4. Mar 17, 2017
  5. Mar 14, 2017
    • Richard Begg's avatar
      chan_iax2: Reload of iax peer results in loss of host address/port · 0dc007e9
      Richard Begg authored
      When using a non-dynamic peer address, build_peer() invalidates the
      peer address structure by setting the address family to unspecified.
      However, if dnsmgr is enabled, the subsequent call to ast_dnsmgr_lookup()
      will not amend the peer address if the cache is still valid, resulting
      in peer connectivity failures.
      To fix this, we call ast_dnsmgr_refresh() instead.
      
      ASTERISK-26865
      
      Change-Id: Id8a89a2f771ebbaf32255a35fe596a6dcb97a082
      0dc007e9
  6. Mar 13, 2017
    • Joshua Colp's avatar
      chan_pjsip: Don't assume a session will have a channel. · 12460b05
      Joshua Colp authored
      When querying for PJSIP specific information using the dialplan
      function CHANNEL() it is possible that the underlying session
      will no longer have a channel associated with it. This is
      most likely to occur when the RTCP HEP module attempts to get
      the channel name. If this happens then a crash will occur.
      
      This change just adds a check that the channel exists on the
      session before querying it.
      
      ASTERISK-26857
      
      Change-Id: I113479cffff6ae64cf8ed089e9e1565223426f01
      12460b05
  7. Mar 09, 2017
  8. Mar 07, 2017
    • Jean Aunis's avatar
      chan_sip: Call not cancelled after receiving a 422 response · d51ca4b4
      Jean Aunis authored
      When receiving a 422 response, the invitestate variable must be reset to
      INV_CALLING.
      
      ASTERISK-26841
      
      Change-Id: Ia0502d6b02192664cefa4e75bafdd2645ce56099
      d51ca4b4
    • Joshua Colp's avatar
      core: Add stream topology changing primitives with tests. · 3ed05bad
      Joshua Colp authored
      This change adds a few things to facilitate stream topology changing:
      
      1. Control frame types have been added for use by the channel driver
      to notify the application that the channel wants to change the stream
      topology or that a stream topology change has been accepted. They are
      also used by the indicate interface to the channel that the application
      uses to indicate it wants to do the same.
      
      2. Legacy behavior has been adopted in ast_read() such that if a
      channel requests a stream topology change it is denied automatically
      and the current stream topology is preserved if the application is
      not capable of handling streams.
      
      Tests have also been written which confirm the multistream and
      non-multistream behavior.
      
      ASTERISK-26839
      
      Change-Id: Ia68ef22bca8e8457265ca4f0f9de600cbcc10bc9
      3ed05bad
  9. Mar 03, 2017
    • Richard Mudgett's avatar
      core: Cleanup ast_get_hint() usage. · c9296b23
      Richard Mudgett authored
      * manager.c:manager_state_cb() Fix potential use of uninitialized hint[]
      if a hint does not exist for the requested extension.  Ran into this when
      developing a testsuite test.  The AMI event ExtensionStatus came out with
      the hint header value containing garbage.  The AMI event PresenceStatus
      also had the same issue.
      
      * manager.c:action_extensionstate() no need to completely initialize the
      hint[].  Only initialize the first element.
      
      * pbx.c:ast_add_hint() Remove unnecessary assignment.
      
      * chan_sip.c: Eliminate an unneeded hint[] local variable.  We only care
      about the return value of ast_get_hint() there.
      
      Change-Id: Ia9a8786f01f93f1f917200f0a50bead0319af97b
      c9296b23
  10. Feb 16, 2017
    • Igor Goncharovsky's avatar
      chan_unistim: fix char type to have consistent behavior on ARM · 135bea93
      Igor Goncharovsky authored
      There is difference exists in behaviour of char type on x86 and ARM.
      On x86 by default char variable type means signed char, but in ARM
      unsigned char used. This make binary calculations and negative values
      works wrong on ARM.
      
      This patch change type of char variables used for store negative
      values and binary calculations to signed char.
      
      ASTERISK-26714
      
      Change-Id: Id78716dee9568a58419d4ef63c038affc3dfc7ab
      135bea93
  11. Feb 13, 2017
    • Sean Bright's avatar
      cli: Fix various CLI documentation and completion issues · 3f943737
      Sean Bright authored
      * app_minivm: Use built-in completion facilities to complete optional
      arguments.
      
      * app_voicemail: Use built-in completion facilities to complete
      optional arguments.
      
      * app_confbridge: Add missing colons after 'Usage' text.
      
      * chan_alsa: Use built-in completion facilities to complete optional
      arguments.
      
      * chan_sip: Use built-in completion facilities to complete optional
      arguments. Add completions for 'load' for 'sip show user', 'sip show
      peer', and 'sip qualify peer.'
      
      * chan_skinny: Correct and extend completions for 'skinny reset' and
      'skinny show line.'
      
      * func_odbc: Correct completions for 'odbc read' and 'odbc write'
      
      * main/astmm: Use built-in completion facilities to complete arguments
      for 'memory' commands.
      
      * main/bridge: Correct completions for 'bridge kick.'
      
      * main/ccss: Use built-in completion facilities to complete arguments
      for 'cc cancel' command.
      
      * main/cli: Add 'all' completion for 'channel request hangup.' Correct
      completions for 'core set debug channel.' Correct completions for 'core
      show calls.'
      
      * main/pbx_app: Remove redundant completions for 'core show
      applications.'
      
      * main/pbx_hangup_handler: Remove unused completions for 'core show
      hanguphandlers all.'
      
      * res_sorcery_memory_cache: Add completion for 'reload' argument of
      'sorcery memory cache stale' and properly implement.
      
      Change-Id: Iee58c7392f6fec34ad9d596109117af87697bbca
      3f943737
    • Norbert Varga's avatar
      chan_pjsip: Multidomain endpoint finding on call · 75f8167e
      Norbert Varga authored
      When PJSIP tries to call an endpoint with a domain (e.g. 1000@test.com),
      the user part is stripped down as it would be a trunk with a specified user,
      and only the host part is called as a PJSIP endpoint and can't be found.
      This is not correct in the case of a multidomain SIP account, so the stripping
      after the @ sign is done only if the whole endpoint (in multidomain case
      1000@test.com) can't be found.
      
      ASTERISK-26248
      
      Change-Id: I3a2dd6f57f3bd042df46b961eccd81d31ab202e6
      75f8167e
  12. Feb 10, 2017
    • Richard Mudgett's avatar
      core: Cleanup some channel snapshot staging anomalies. · 16fdb11b
      Richard Mudgett authored
      We shouldn't unlock the channel after starting a snapshot staging because
      another thread may interfere and do its own snapshot staging.
      
      * app_dial.c:dial_exec_full() made hold the channel lock while setting up
      the outgoing channel staging.  Made hold the channel lock after the called
      party answers while updating the caller channel staging.
      
      * chan_sip.c:sip_new() completed the channel staging on off-nominal exit.
      Also we need to use ast_hangup() instead of ast_channel_unref() at that
      location.
      
      * channel.c:__ast_channel_alloc_ap() added a comment about not needing to
      complete the channel snapshot staging on off-nominal exit paths.
      
      * rtp_engine.c:ast_rtp_instance_set_stats_vars() made hold the channel
      locks while staging the channels for the stats channel variables.
      
      Change-Id: Iefb6336893163f6447bad65568722ad5d5d8212a
      16fdb11b
  13. Jan 27, 2017
    • George Joseph's avatar
      debug_utilities: Add ast_logescalator · ef4deb8e
      George Joseph authored
      The escalator works by creating a set of startup commands in cli.conf
      that set up logger channels and issue the debug commands for the
      subsystems specified.  If asterisk is running when it is executed,
      the same commands will be issued to the running instance.  The original
      cli.conf is saved before any changes are made and can be restored by
      executing '$prog --reset'.
      
      The log output will be stored in...
      $astlogdir/message.$uniqueid
      $astlogdir/debug.$uniqueid
      $astlogdir/dtmf.$uniqueid
      $astlogdir/fax.$uniqueid
      $astlogdir/security.$uniqueid
      $astlogdir/pjsip_history.$uniqueid
      $astlogdir/sip_history.$uniqueid
      
      Some minor tweaks were made to chan_sip, and res_pjsip_history
      so their history output could be send to a log channel as packets
      are captured.
      
      A minor tweak was also made to manager so events are output to verbose
      when "manager set debug on" is issued.
      
      Change-Id: I799f8e5013b86dc5282961b27383d134bf09e543
      ef4deb8e
  14. Jan 24, 2017
  15. Jan 04, 2017
    • Alexander Traud's avatar
      chan_sip: Remember SDP negotiation on SIP_CODEC_INBOUND. · e220c11b
      Alexander Traud authored
      After a SIP_CODEC_INBOUND in the dialplan, do not continue with cached formats
      but remember the joint format. Cached formats contain default parameters,
      often create an empty fmtp line. However, a joint format might have passed
      format_get_joint(.) in a res_format_attr_* module (like Opus Codec) and
      contain the resulting format parameters from a SDP negotiation.
      
      ASTERISK-26691 #close
      
      Change-Id: I35712d98a793d4c3efdd156cec57deab9014b1dc
      e220c11b
  16. Jan 03, 2017
    • Joshua Colp's avatar
      chan_pjsip: Use session for retrieving CHANNEL() information. · ae576529
      Joshua Colp authored
      The CHANNEL() dialplan function implementation for PJSIP allows
      querying of PJSIP specific information. This used the channel
      passed in to get the PJSIP session and associated information.
      It is possible for this channel to be masqueraded and end
      up as a different channel type by the time the information
      request is actually acted upon.
      
      This change retrieves the PJSIP session safely and accesses
      data from it (including channel). This provides a guarantee
      that the session and channel will not be altered when the
      request is being acted upon.
      
      ASTERISK-26673
      
      Change-Id: I335e12b89e1820cafdd92b3e7526b8ba649eb7e6
      ae576529
  17. Dec 22, 2016
    • Richard Mudgett's avatar
      chan_rtp.c: Fix uninitialized memory crash. · 67b47191
      Richard Mudgett authored
      unicast_rtp_request() could pass an uninitialized 'us' parameter to
      ast_ouraddrfor().  If ast_ouraddrfor() returns an error then the 'us'
      parameter may not get initialized.  Thus when the code tries to save the
      'us' parameter to the local address we could try to copy a ridiculous
      sized memory buffer and segfault.
      
      * Made pass an initialized 'us' parameter to ast_ouraddrfor() and abort
      the UnicastRTP channel request if it fails.
      
      ASTERISK-26672
      
      Change-Id: I1ef7a7c09f4da4f15dcb6de660d2bcac5f2a95c0
      67b47191
  18. Dec 17, 2016
    • Corey Farrell's avatar
      chan_sip: Reorder unload_module to deal with stuck TCP threads. · 8fbb384e
      Corey Farrell authored
      In some situations TCP threads may become frozen.  This creates the
      possibility that Asterisk could segfault if they become unfrozen after
      chan_sip has been dlclose'd.  This reorders the unload_module process to
      allow abort if threads do not exit within 5 seconds.
      
      High level order as follows:
      1) Unregister from the core to stop new requests.
      2) Signal threads to stop
      3) Clear config based tables (but do not free the table itself).
      4) Verify that threads have shutdown, cancel unload if not.
      5) Clean all remaining resources.
      
      ASTERISK-26586
      
      Change-Id: Ie23692041d838fbd35ece61868f4c640960ff882
      8fbb384e
  19. Dec 14, 2016
  20. Dec 08, 2016
    • Badalyan Vyacheslav's avatar
      Fix typo in chan_sip · 4c6ba1db
      Badalyan Vyacheslav authored
      The conditional expressions of the 'if' operators
      situated alongside each other are identical.
      
      Change-Id: I652b6dcddb3be007e669a6aa8107edb31a1ddafb
      4c6ba1db
    • Badalyan Vyacheslav's avatar
      chan_sip: Delete unneeded check · 51118e7d
      Badalyan Vyacheslav authored
      P is always true. We check it before
      
      Change-Id: Iee61cda002a9f61aee26b9f66c5f9b59e3389efb
      51118e7d
    • Badalyan Vyacheslav's avatar
      Small code cleanup in chan_sip · fe5be818
      Badalyan Vyacheslav authored
      The conditional expressions of the 'if' operators situated
      alongside each other are identical.
      
      Change-Id: I2cf7c317b106ec14440c7f1b5dcfbf03639f748a
      fe5be818
    • Walter Doekes's avatar
      chan_sip: Do not allow non-SP/HTAB between header key and colon. · c796f00c
      Walter Doekes authored
      RFC says SIP headers look like:
      
          HCOLON  =  *( SP / HTAB ) ":" SWS
          SWS     =  [LWS]                    ; sep whitespace
          LWS     =  [*WSP CRLF] 1*WSP        ; linear whitespace
          WSP     =  SP / HTAB                ; from rfc2234
      
      chan_sip implemented this:
      
          HCOLON  =  *( LOWCTL / SP ) ":" SWS
          LOWCTL  = %x00-1F                   ; CTL without DEL
      
      This discrepancy meant that SIP proxies in front of Asterisk with
      chan_sip could pass on unknown headers with \x00-\x1F in them, which
      would be treated by Asterisk as a different (known) header.  For
      example, the "To\x01:" header would gladly be forwarded by some proxies
      as irrelevant, but chan_sip would treat it as the relevant "To:" header.
      
      Those relying on a SIP proxy to scrub certain headers could mistakenly
      get unexpected and unvalidated data fed to Asterisk.
      
      This change fixes so chan_sip only considers SP/HTAB as valid tokens
      before the colon, making it agree on the headers with other speakers of
      SIP.
      
      ASTERISK-26433 #close
      AST-2016-009
      
      Change-Id: I78086fbc524ac733b8f7f78cb423c91075fd489b
      c796f00c
  21. Nov 30, 2016
    • Alexei Gradinari's avatar
      chan_pjsip: fix switching sending codec when asymmetric_rtp_codec=no · e5e887be
      Alexei Gradinari authored
      The sending codec is switched to the receiving codec and then
      is switched back to the best native codec on EVERY receiving RTP packets.
      This is because after call of ast_channel_set_rawwriteformat there is call
      of ast_set_write_format which calls set_format which sets rawwriteformat
      to the best native format.
      
      This patch adds a new function ast_set_write_format_path which set
      specific write path on channel and uses this function to switch
      the sending codec.
      
      ASTERISK-26603 #close
      
      Change-Id: I5b7d098f8b254ce8f45546e6c36e5d324737f71d
      e5e887be
  22. Nov 28, 2016
    • Matt Jordan's avatar
      res_pjsip/chan_sip: Advertise 'ws' in the SIP URI transport parameter · 0e157607
      Matt Jordan authored
      Per RFC 7118 5.2, the SIP URI 'transport' parameter should advertise
      'ws' when WebSockets are to be used as the transport. This applies to
      both secure and insecure WebSockets.
      
      There were two bugs in Asterisk with respect to this:
      
      (1) The most egregious occurs in res_pjsip. There, we advertise 'ws' for
          insecure websockets and 'wss' for secure websockets. While this
          would seem to make sense - since 'WS' and 'WSS' are used for the Via
          Transport parameter - this is not the case for the SIP URI. This
          patch corrects that by registering the secure websockets with
          pjproject using the shorthand 'WS', and by returning 'ws' when asked
          for the transport parameter. Note that in pjproject, it is perfectly
          valid to have multiple transports use the same shorthand.
      
      (2) In chan_sip, we return an upper-case version of the transport 'WS'
          instead of 'ws'. Since we should be strict in what we send and
          liberal in what we accept (within reason), this patch lower-cases
          the transport before appending it to the parameter.
      
      ASTERISK-24330 #close
      Reported by: cervajs, Inaki Baz Castillo
      
      Change-Id: Iff77b645f8cc3b7cd35168a6676c26b147f22f42
      0e157607
  23. Nov 26, 2016
    • Michael Kuron's avatar
      chan_sip: Fix segfault during module unload · 0b588778
      Michael Kuron authored
      If a TCP/TLS connection was pending (not accepted and not timed out) during
      unload of chan_sip, Asterisk would segfault when trying to send a signal to
      a thread whose thread ID hadn't been recorded yet. This commit fixes that by
      recording the thread ID before calling the blocking connect() syscall.
      This was a regression introduced by 776a1438.
      
      The above wasn't enough to fix the segfault, which was now delayed to the
      point where connect() timed out. Therefore, it was necessary to also remove
      the SA_RESTART flag from the SIGURG sigaction so that pthread_kill() could be
      used to interruput the connect() syscall.
      This was a regression introduced by 5d313f51.
      
      ASTERISK-26586 #close
      
      Change-Id: I76fd9d47d56e4264e2629bce8ec15fecba673e7b
      0b588778
  24. Nov 15, 2016
    • Timo Teräs's avatar
      Implement internal abstraction for iostreams · 070a51bf
      Timo Teräs authored
      fopencookie/funclose is a non-standard API and should not be used
      in portable software. Additionally, the way FILE's fd is used in
      non-blocking mode is undefined behaviour and cannot be relied on.
      
      This introduces internal abstraction for io streams, that allows
      implementing the desired virtualization of read/write operations
      with necessary timeout handling.
      
      ASTERISK-24515 #close
      ASTERISK-24517 #close
      
      Change-Id: Id916aef418b665ced6a7489aef74908b6e376e85
      070a51bf
  25. Nov 11, 2016
  26. Nov 10, 2016
  27. Nov 04, 2016
    • Kevin Harwell's avatar
      Revert "chan_sip: Fix lastrtprx always updated" · bf01ff53
      Kevin Harwell authored
      This reverts commit 93332cb1.
      
      Unfortunately, the aforementioned commit caused a regression (incoming calls
      would eventually disconnect). Thus it is being removed.
      
      ASTERISK-26523 #close
      ASTERISK-25270
      
      Change-Id: Ibf5586adc303073a8eac667a4cbfdb6be184a64d
      bf01ff53
  28. Nov 02, 2016
  29. Nov 01, 2016
    • Grachev Sergey's avatar
      chan_sip: Incorrect display option Outbound reg. retry 403 · 2526dff9
      Grachev Sergey authored
      If in sip.conf (general section) set option register_retry_403=no,
      the command "sip show settings" return value:
      Outbound reg. retry 403:0
      If in sip.conf (general section) set option register_retry_403=yes,
      the command "sip show settings" return value:
      Outbound reg. retry 403:-1
      
      * In static char "sip show settings" for "Outbound.reg. retry 403"
      option use AST_CLI_YESNO
      
      ASTERISK-26476 #close
      
      Change-Id: I3c14272f05f1067bd2aeaa8b3ef9cf8fcb12dcf9
      2526dff9
  30. Oct 27, 2016
    • Tzafrir Cohen's avatar
      chan_dahdi: remove by_name support · 0646b48e
      Tzafrir Cohen authored
      Support for referring to DAHDI channels by logical names was added in
      (FIXME: when? Asterisk 11? 1.8?) and was intended to be part of support
      of refering to channels by name.
      
      While technically usable, it has never been properly supported in
      dahdi-tools, as using it would require many changes at the Asterisk
      level. Instead logical mapping was added at the kernel level.
      
      Thus it seems that refering to DAHDI channels by name is not really used
      by anyone, and therefore should probably be removed.
      
      Change-Id: I7d50bbfd9d957586f5cd06570244ef87bd54b485
      0646b48e
    • Corey Farrell's avatar
      Remove ASTERISK_REGISTER_FILE. · a6e5bae3
      Corey Farrell authored
      ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
      all traces of it.
      
      Previously exported symbols removed:
      * __ast_register_file
      * __ast_unregister_file
      * ast_complete_source_filename
      
      This also removes the mtx_prof static variable that was declared when
      MTX_PROFILE was enabled.  This variable was only used in lock.c so it
      is now initialized in that file only.
      
      ASTERISK-26480 #close
      
      Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
      a6e5bae3
  31. Oct 26, 2016
    • Joshua Colp's avatar
      pjsip: Fix a few media bugs with reinvites and asymmetric payloads. · aed6c219
      Joshua Colp authored
      When channel format changes occurred as a result of an RTP
      re-negotiation the bridge was not informed this had happened.
      As a result the bridge technology was not re-evaluated and the
      channel may have been in a bridge technology that was incompatible
      with its formats. The bridge is now unbridged and the technology
      re-evaluated when this occurs.
      
      The chan_pjsip module also allowed asymmetric codecs for sending
      and receiving. This did not work with all devices and caused one
      way audio problems. The default has been changed to NOT do this
      but to match the sending codec to the receiving codec. For users
      who want asymmetric codecs an option has been added, asymmetric_rtp_codec,
      which will return chan_pjsip to the previous behavior.
      
      The codecs returned by the chan_pjsip module when queried by
      the bridge_native_rtp module were also not reflective of the
      actual negotiated codecs. The nativeformats are now returned as
      they reflect the actual negotiated codecs.
      
      ASTERISK-26423 #close
      
      Change-Id: I6ec88c6e3912f52c334f1a26983ccb8f267020dc
      aed6c219
  32. Oct 25, 2016
    • Alexei Gradinari's avatar
      chan_pjsip: segfault on already disconnected session · 2b9ad3a5
      Alexei Gradinari authored
      On heavy loaded system the TCP/TLS incoming calls could be
      disconnected by pjproject while these calls are being
      processed by asterisk.
      
      This patch uses functions pjsip_inv_add_ref/pjsip_inv_dec_ref
      to inform pjproject that an INVITE session is in use.
      
      ASTERISK-26482 #close
      
      Change-Id: Ia2e3e2f75358cdb530252a9ce158af3d5d9fdf33
      2b9ad3a5
  33. Oct 17, 2016
  34. Oct 15, 2016
    • Michael Kuron's avatar
      chan_sip: Only send video on outgoing channel if incoming channel supports it · e9315791
      Michael Kuron authored
      Previously, the settings videosupport=always and videosupport=yes behaved
      identically and unconditionally caused a video offer to be sent in the SDP on
      an outgoing call. This was a regression introduced with commit
      5a1d90e1 in Asterisk 1.6.1.
      
      This commit restores correct behavior: videosupport=always causes a video offer
      to be sent unconditionally, while videosupport=yes will only offer video on an
      outbound channel if the incoming channel it is bridged to also supports video.
      That way, the device receiving the outgoing call can display the correct user
      interface elements for audio or video and will not unnecessarily show a blank
      video window on an audio-only call.
      
      ASTERISK-17470 #close
      
      Change-Id: I782f4409d436114dbc97061c3570c0cd24f7c3ae
      e9315791
Loading