summaryrefslogtreecommitdiff
path: root/channels
AgeCommit message (Collapse)Author
2017-07-14chan_iax2: On reload make sure to check for existing MWI subscriptionSergej Kasumovic
On every reload of chan_iax2 module, MWI subscription was added, which results in additional taskprocessors being accumulated over time. This commit fixes it by making sure we check for existing subscription first. This was verified with 'core show taskprocessors' CLI command. ASTERISK-27122 #close Change-Id: Ie2ef528fd5ca01b933eeb88188cc10967899cfb9
2017-07-05Merge "chan_sip: Only when different, add TCP|TLS in autodomain (SIP Domain ↵Jenkins2
Support)." into 13
2017-07-05Merge "chan_pjsip: Fix ability to send UPDATE on COLP" into 13George Joseph
2017-07-03chan_sip: Only when different, add TCP|TLS in autodomain (SIP Domain Support).Alexander Traud
When sip.conf contained tcpenable=yes and autodomain=yes, the TCP domain was added in any case, because of a local Boolean-negation error of the return value of ast_sockaddr_cmp. After fixing this error for TCP and TLS, the TLS domain was still always added with tlsenable=yes, because the domains were not compared just on the address but also on the port – and TLS is always on a different port than UDP/TCP. ASTERISK-27106 Change-Id: I14fe9e319e238320b094016980445ef3a5b3337c
2017-07-03chan_sip: Fix a typo for tlsbindaddr in autodomain (SIP Domain Support).Alexander Traud
Because of a copy-and-paste error when the struct ast_sockaddr changed, tlsbindaddr was not added, when sip.conf contained autodomain=yes; see "show sip domains" on the command-line interface (CLI) of Asterisk. ASTERISK-27106 Change-Id: I3d0957150017c223136968ef1266f275d0d6695e
2017-06-29chan_pjsip: Fix ability to send UPDATE on COLPGeorge Joseph
When connected_line_method is "invite", we're supposed to determine if the client can support UPDATE and if it can, send UPDATE instead of INVITE to avoid the SDP renegotiation. Not only was pjproject not setting the PJSIP_INV_SUPPORT_UPDATE flag, we were testing that invite_tsx wasn't NULL which isn't always the case. * Updated chan_pjsip/update_connected_line_information to drop the requirement that invite_tsx isn't NULL. * Submitted patch to pjproject sip_inv.c that sets the PJSIP_INV_SUPPORT_UPDATE flag correctly. * Updated pjsip.conf.sample to clarify what happens when "invite" is specified. ASTERISK-27095 Change-Id: Ic2381b3567b8052c616d96fbe79564c530e81560
2017-06-23res_pjsip: Add DTMF INFO Failback modeTorrey Searle
The existing auto dtmf mode reverts to inband if 4733 fails to be negotiated. This patch adds a new mode auto_info which will switch to INFO instead of inband if 4733 is not available. ASTERISK-27066 #close Change-Id: Id185b11e84afd9191a2f269e8443019047765e91
2017-06-15chan_pjsip: Fix PJSIP_MEDIA_OFFER dialplan function read.Richard Mudgett
The construction of the returned string assumed incorrectly that the supplied buffer would always be initialized as an empty string. If it is not an empty string we could overrun the supplied buffer by the length of the non-empty buffer string plus one. It is also theoreticaly possible for the supplied buffer to be overrun by a string terminator during a read operation even if the supplied buffer is an empty string. * Fix the assumption that the supplied buffer would already be an empty string. The buffer is not guaranteed to contain an empty string by all possible callers. * Fix string terminator buffer overrun potential. Change-Id: If6a0806806527678c8554b1dcb34fd7808aa95c9
2017-06-13Merge "pjsip: Extend 'asymmetric_rtp_codec' option to include us changing." ↵Joshua Colp
into 13
2017-06-07chan_pjsip: Update device state when in early media.Joshua Colp
The chan_pjsip module uses a calculation approach for determining device state. This means that in situations where we would expect device state to change we need to tell the core to query. A scenario that was missed is when early media was signaled. This change adds the notification for the core to query device state when we are told that early media is being provided. ASTERISK-27039 Change-Id: Iafebfd152894966344ff2e950a3cee9f59a3eb6f
2017-06-07pjsip: Extend 'asymmetric_rtp_codec' option to include us changing.Joshua Colp
PJSIP support in Asterisk differs from chan_sip in that it allows media to be sent as-is without transcoding provided the codecs were negotiated in the SDP. This is allowed according to the RFC. Support for this differs quite a lot though and some endpoints do not handle it well. This change extends the 'asymmetric_rtp_codec' option to also cover this case. When set to no (the default) the code behaves as chan_sip does - the best codec is selected and we will only ever send that, unless we change what we are sending if the remote side changes. When set to yes we will send media as-is without transcoding if the codec has been negotiated in the SDP. ASTERISK-26996 Change-Id: Ib1647f6902a0843e8c435946f831c2159e8d1d51
2017-06-06res_pjsip: Add support for returning only reachable contacts and use it.Joshua Colp
This introduces the ability for PJSIP code to specify filtering flags when retrieving PJSIP contacts. The first flag for use causes the query code to only retrieve contacts that are not unreachable. This change has been leveraged by both the Dial() process and the PJSIP_DIAL_CONTACTS dialplan function so they will now only attempt calls to contacts which are not unreachable. ASTERISK-26281 Change-Id: I8233b4faa21ba3db114f5a42e946e4b191446f6c
2017-05-22chan_sip: Better ICE handling for RTCP-MUXSean Bright
If we are offered or are offering RTCP-MUX, don't consider RTCP ICE candidates. This confuses certain browsers (current Firefox for example) and causes intial audio setup delays. ASTERISK-26982 #close Change-Id: Ifeaf47e83972fe8dbe58b7fb3d6d1823400cfb91
2017-05-19AST-2017-004: chan_skinny: Add EOF check in skinny_sessionGeorge Joseph
The while(1) loop in skinny_session wasn't checking for EOF so a packet that was longer than a header but still truncated would spin the while loop infinitely. Not only does this permanently tie up a thread and drive a core to 100% utilization, the call of ast_log() in such a tight loop eats all available process memory. Added poll with timeout to top of read loop ASTERISK-26940 #close Reported-by: Sandro Gauci Change-Id: I2ce65f3c5cb24b4943a9f75b64d545a1e2cd2898
2017-05-08chan_sip: Change sip_get_codec() to return correct codec listVitezslav Novy
Return cahnnel nativeformats to fix bridge technology selection process. Same approach as in pjsip module. ASTERISK-26143 Reported-by: Henning Holtschneider Change-Id: I64e863753954d6ad67a9e722df2ebc328705ad48
2017-05-02channels/chan_sip.c: use binding IP address for outgoing TCP SIP connectionsThierry Magnien
For outgoing TCP connections, Asterisk uses the first IP address of the interface instead of the IP address we asked him to bind to. ASTERISK-26922 #close Reported-by: Ksenia Change-Id: I43c71ca89211dbf1838e5bcdb9be8d06d98e54eb
2017-04-27Merge "res_pjsip_session: Add cleanup to ast_sip_session_terminate" into 13Jenkins2
2017-04-27res_pjsip_session: Add cleanup to ast_sip_session_terminateGeorge Joseph
If you use ast_request to create a PJSIP channel but then hang it up without causing a transaction to be sent, the session will never be destroyed. This is due ot the fact that it's pjproject that triggers the session cleanup when the transaction ends. app_chanisavail was doing this to get more granular channel state and it's also possible for this to happen via ARI. * ast_sip_session_terminate was modified to explicitly call the cleanup tasks and unreference session if the invite state is NULL AND invite_tsx is NULL (meaning we never sent a transaction). * chan_pjsip/hangup was modified to bump session before it calls ast_sip_session_terminate to insure that session stays valid while it does its own cleanup. * Added test events to session_destructor for a future testsuite test. ASTERISK-26908 #close Reported-by: Richard Mudgett Change-Id: I52daf6f757184e5544c261f64f6fe9602c4680a9
2017-04-26chan_sip: Trigger reinvite if the SDP answer is included in the SIP ACKJean Aunis
Some equipments may send a re-INVITE containing an SDP in the final ACK request. If this happens in the context of direct media, the remote end should be updated with a re-INVITE. This patch queues an "update RTP peer" frame to trigger the re-INVITE, instead of the "source change" frame wich was used previously. ASTERISK-26951 Change-Id: I3644d2025f20e086ea9f8f62b486172c52b5b2e6
2017-04-12modules: change module LOAD_FAILUREs to LOAD_DECLINESGeorge Joseph
In all non-pbx modules, AST_MODULE_LOAD_FAILURE has been changed to AST_MODULE_LOAD_DECLINE. This prevents asterisk from exiting if a module can't be loaded. If the user wishes to retain the FAILURE behavior for a specific module, they can use the "require" or "preload-require" keyword in modules.conf. A new API was added to logger: ast_is_logger_initialized(). This allows asterisk.c/check_init() to print to the error log once the logger subsystem is ready instead of just to stdout. If something does fail before the logger is initialized, we now print to stderr instead of stdout. Change-Id: I5f4b50623d9b5a6cb7c5624a8c5c1274c13b2b25
2017-04-03chan_sip: Session Timers required but refused wrongly.Alexander Traud
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
2017-03-27core: Remove embedded module supportSean Bright
This has not worked for some time and is no longer actively maintained. Change-Id: I5110b0db69c152761b58fa025cb0a53b0e544d99
2017-03-20thread safety: Don't use getprotobyname()Sean Bright
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
2017-03-17chan_sip: Add rtcp-mux supportSean Bright
ASTERISK-26846 #close Change-Id: I541a1602ff55ab73684e9f8002edb9e0e745d639
2017-03-16Merge "chan_iax2: Reload of iax peer results in loss of host address/port" ↵Joshua Colp
into 13
2017-03-15Merge "chan_pjsip: Don't assume a session will have a channel." into 13Joshua Colp
2017-03-15chan_iax2: Reload of iax peer results in loss of host address/portRichard Begg
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
2017-03-13chan_pjsip: Don't assume a session will have a channel.Joshua Colp
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
2017-03-10chan_sip: Call not cancelled after receiving a 422 responseJean Aunis
When receiving a 422 response, the invitestate variable must be reset to INV_CALLING. ASTERISK-26841 Change-Id: Ia0502d6b02192664cefa4e75bafdd2645ce56099
2017-03-10Merge "pjsip/cli_commands: pjsip show channelstats shows wrong codec" into 13Joshua Colp
2017-03-09pjsip/cli_commands: pjsip show channelstats shows wrong codecDaniel Journo
* cli_commands.c Fixed CLI output ASTERISK-26822 #close Change-Id: I3889ef6a8f6738fc312fab42db5efacd6e452b01
2017-03-02core: Cleanup ast_get_hint() usage.Richard Mudgett
* 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
2017-02-27chan_sip: Allow DTLS to be disabled when reloading.Vitezslav Novy
This change fixes a problem where removing the DTLS configuration options and reloading would not disable DTLS. This occurred because the DTLS configuration was not reset to an unconfigured state on reload. ASTERISK-26313 Change-Id: I10952709cc4a7727fb50534b042bce9d64894b39
2017-02-16chan_unistim: fix char type to have consistent behavior on ARMIgor Goncharovsky
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
2017-02-14Merge "cli: Fix various CLI documentation and completion issues" into 13zuul
2017-02-13Merge "core: Cleanup some channel snapshot staging anomalies." into 13zuul
2017-02-13cli: Fix various CLI documentation and completion issuesSean Bright
* 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/asterisk: Correct and extend completions for 'core show file version.' * 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
2017-02-13Merge "chan_pjsip: Multidomain endpoint finding on call" into 13zuul
2017-02-13chan_pjsip: Multidomain endpoint finding on callNorbert Varga
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
2017-02-10core: Cleanup some channel snapshot staging anomalies.Richard Mudgett
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
2017-01-27Merge "debug_utilities: Add ast_logescalator" into 13zuul
2017-01-27debug_utilities: Add ast_logescalatorGeorge Joseph
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
2017-01-24chan_oss.c: Fix format ref leak in oss_read().Richard Mudgett
Change-Id: I0a5d56c7dcf327d60f86a4c25a23571733709fd0
2017-01-09Merge "chan_sip: Remember SDP negotiation on SIP_CODEC_INBOUND." into 13Joshua Colp
2017-01-09Merge changes from topic 'ASTERISK-26672' into 13Joshua Colp
* changes: res_rtp_asterisk.c: Fix uninitialized memory crash. chan_rtp.c: Fix uninitialized memory crash.
2017-01-04chan_sip: Remember SDP negotiation on SIP_CODEC_INBOUND.Alexander Traud
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
2017-01-03chan_pjsip: Use session for retrieving CHANNEL() information.Joshua Colp
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
2016-12-22chan_rtp.c: Fix uninitialized memory crash.Richard Mudgett
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
2016-12-19Merge "chan_dahdi.c: Fix bounds check regression." into 13Joshua Colp
2016-12-17chan_sip: Reorder unload_module to deal with stuck TCP threads.Corey Farrell
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