summaryrefslogtreecommitdiff
path: root/res
AgeCommit message (Collapse)Author
2015-05-14Merge "AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO ↵Joshua Colp
macro."
2015-05-13AST_MODULE_INFO: Format corrections to the usages of AST_MODULE_INFO macro.Rodrigo Ramírez Norambuena
Change-Id: Icf88f9f861c6b2a16e5f626ff25795218a6f2723
2015-05-13Merge "res_rtp_asterisk: Correction for the limit which detects that a ↵Joshua Colp
packet is DTLS."
2015-05-11Merge "Fix error's produced by astmm.h when standard allocators are used."Joshua Colp
2015-05-10res_rtp_asterisk: Correction for the limit which detects that a packet is DTLS.Yousf Ateya
First byte of DTLS packet shall be in range 20-63, not 20-64. Refer to RFC https://tools.ietf.org/html/rfc5764#section-5.1.2 for correct values. Change-Id: Iae6fa0d72b37c36a27fe40686e0ae6fba3afec31
2015-05-08Fix error's produced by astmm.h when standard allocators are used.Corey Farrell
astmm.h includes defines that are meant to cause error's when standard allocators (malloc, calloc, free, etc) are used. It actually only causes a warning, which is not always caught on certain sources. In modules this unknown symbol is not detected until runtime, where the module fails to load. This modifies the define's so that using one of the blocked functions will cause a compile error regardless of CFLAGS. Moved spandsp header includes to before asterisk.h so the static inline functions can continue using malloc and free. Although these functions are never called and optimized away, the updated replacement macro's would still cause a failure. Change-Id: I532640aca0913ba9da3b18c04a0f010ca1715af5
2015-05-08res_rtp_asterisk: Issue ERROR if res_srtp is not found.Sean Bright
While trying to get WebRTC working with chan_pjsip, I was running into the following error: Attempted to set an invalid DTLS-SRTP configuration on RTP instance... Josh helpfully pointed out that res_srtp.so might not be loaded, and sure enough, it wasn't. This patch adds a ERROR indiciating as much to hopefully help others having a similar problem. Change-Id: I13aa477b47b299876728a21b130998a0ea6cd19f
2015-05-07res_pjsip_exten_state: Fix race condition between sending NOTIFY and terminationJoshua Colp
The res_pjsip_exten_state module currently has a race condition between processing the extension state callback from the PBX core and processing the subscription shutdown callback from res_pjsip_pubsub. There is currently no synchronization between the two. This can present a problem as while the SIP subscription will remain valid the tree it points to may not. This is in particular a problem as a task to send a NOTIFY may get queued which will try to use the tree that may no longer be valid. This change does the following to fix this problem: 1. All access to the subscription tree is done within the task that sends the NOTIFY to ensure that no other thread is modifying or destroying the tree. This task executes on the serializer for the subscriptions. 2. A reference to the subscription serializer is kept to ensure it remains valid for the lifetime of the extension state subscription. 3. The NOTIFY task has been changed so it will no longer attempt to send a NOTIFY if the subscription has already been terminated. ASTERISK-25057 #close Reported by: Matt Jordan Change-Id: I0b3cd2fac5be8d9b3dc5e693aaa79846eeaf5643
2015-05-07Merge topics 'ASTERISK-25049', 'ASTERISK-25056'Matt Jordan
* changes: CLI: Enable automatic references to modules. Modules: Make ast_module_info->self available to auxiliary sources.
2015-05-06res_stasis_snoop: Spying on a single direction continually increases CPUKevin Harwell
Creating a snoop channel in ARI and spying only on a single direction (in or out) results in CPU utilization continually increasing until the CPU is fully consumed. This occurs because frames are being put in the opposing direction's slin factory queue, but not being removed. Fixed the problem by always reading and disposing of frames from the opposite queue of the direction selected. ASTERISK-24938 #closes Change-Id: I935bfd15f1db958f364d9d6b3b45582c0113dd60
2015-05-06Merge "res_ari_bridges: Add missing dependencies."Matt Jordan
2015-05-05Merge "Restrict functionality when ACLs are misconfigured."Joshua Colp
2015-05-05res_ari_bridges: Add missing dependencies.Corey Farrell
Missed this module in the previous commit. res_ari_bridges uses symbols from res_stasis_playback and res_stasis_recording. ASTERISK-25027 #close Reported by: Corey Farrell Change-Id: I90bf756abd25adfc4920d2869ebe7feb636b8c5f
2015-05-04CLI: Enable automatic references to modules.Corey Farrell
* Pass module to ast_cli_register and ast_cli_register_multiple. * Add a module reference before executing any CLI callback, remove the reference when complete. ASTERISK-25049 #close Reported by: Corey Farrell Change-Id: I7aafc7c9f2b912918f28fe51d51e9e8a755750e3
2015-05-04Modules: Make ast_module_info->self available to auxiliary sources.Corey Farrell
ast_module_info->self is often needed to register items with the core. Many modules have ad-hoc code to make this pointer available to auxiliary sources. This change updates the module build process to make the needed information available to all sources in a module. ASTERISK-25056 #close Reported by: Corey Farrell Change-Id: I18c8cd58fbcb1b708425f6757becaeca9fa91815
2015-05-04Merge "res_odbc: Use negative connection cache for all connections"Matt Jordan
2015-05-04res_odbc: Use negative connection cache for all connectionsMartin Tomec
Apply the negative connection cache setting to all connections, even those that are not pooled. This ensures that the connection will not be re-established before the negative connection cache time is met. ASTERISK-22708 #close Change-Id: I431cc2e8584ab0b6908b3523d0a0e18c9a527271
2015-05-02res_pjsip_dlg_options: Fix MODULEINFO section.Corey Farrell
Removed the extra space before "MODULEINFO" in res_pjsip_dlg_options. This extra space prevented any of the dependencies from being seen by menuselect, so building with default options would fail if PJSIP was not installed. This also makes the tool that extracts information for menuselect tolerant of multiple spaces in the future. ASTERISK-25033 #close Reported by: Peter Whisker Change-Id: Iccd54846f70c4a7a50cb5bf70b7bb5cb4bab3698
2015-04-30res_ari_device_states: Fix dependency on res_stasis_device_state.Joshua Colp
The res_ari_device_states module depends on res_stasis_device_state, not res_stasis_device_states. Change-Id: I26e02ad37f9e36bcc859867e2fad1b90452ec3de
2015-04-30Restrict functionality when ACLs are misconfigured.Mark Michelson
This patch has two main purposes: 1) Improve warning messages when ACLs are configured improperly. 2) Prevent misconfigured ACLs from allowing potentially unwanted traffic. To acomplish point (2) in most cases, whatever configuration object that the ACL belonged to was not allowed to load. The one exception is res_pjsip_acl. In that case, ACLs are their own configuration object. Furthermore, the module loading code has no indication that a ACL configuration had a failure. So the tactic taken here is to create an ACL that just blocks everything. ASTERISK-24969 Reported by Corey Farrell Change-Id: I2ebcb6959cefad03cea4d81401be946203fcacae
2015-04-30res_pjsip_outbound_registration: Fix double unref on error return.Joshua Colp
When the PJSIP pjsip_regc_send function is invoked and an error status returned the caller currently decrements the reference count of the client state that it just incremented, assuming the registration callback would not have been invoked. In practice this is not correct. If the failure happens after the transaction has been set up the callback will still be invoked. This will cause the reference count to be incorrectly decremented twice, once by the registration callback and second by the caller of pjsip_regc_send. This change makes it so that whether the callback is invoked or not is known by the caller of pjsip_regc_send. Depending on this it can know whether it is responsible for decrementing the reference count of the client state or not. ASTERISK-25037 #close Reported by: Joshua Colp Change-Id: I749dc12f3a22115c49c5d7d95ff42a5fa45319de
2015-04-29Merge "ARI: Fix missing dependencies."Matt Jordan
2015-04-29res_fax: allow 2400 transmission rate according to v.27ter standardKevin Harwell
A previous set of patches (see: ASTERISK-22790 & ASTERISK-23231) made it so a v.27 modem was not allowed to have a minimum transmission rate of 2400 bits per second. This reverts all or some of those patches since according to the v.27ter standard a rate of 2400 bits per second is also supported. One of the original patches also added 9600 bits per second support for v.27. This patch also removes that since v.27ter only supports 2400/4800 bits per second. Also, since Asterisk specifically supports v.27ter the enum was renamed to better reflect this. ASTERISK-24955 #close Reported by: Matt Jordan Change-Id: I4b9dfb6bf7eff08463ab47ee1a74224f27cae733
2015-04-29Merge "res_pjsip_outbound_registration: Don't fail on delayed processing."Joshua Colp
2015-04-29Merge "Git Conversion: Switch Non-C files to ASTERISK_REGISTER_FILE."Mark Michelson
2015-04-29res_pjsip_outbound_registration: Don't fail on delayed processing.Mark Michelson
Odd behaviors have been observed during outbound registrations. The most common problem witnessed has been one where a request with authentication credentials cannot be created after receiving a 401 response. Other behaviors include apparently processing an incorrect SIP response. Inspecting the code led to an apparent issue with regards to how we handle transactions in outbound registration code. When a response to a REGISTER arrives, we save a pointer to the transaction and then push a task onto the registration serializer. Between the time that we save the pointer and push the task, it's possible for the transaction to be destroyed due to a timeout. It's also possible for the address to be reused by the transaction layer for a new transaction. To allow for authentication of a REGISTER request to be authenticated after the transaction has timed out, we now hold a reference to the original REGISTER request instead of the transaction. The function for creating a request with authentication has been altered to take the original request instead of the transaction where the original request was sent. ASTERISK-25020 Reported by Mark Michelson Change-Id: I756c19ab05ada5d0503175db9676acf87c686d0a
2015-04-29res_sorcery_config: Fix build issue due to syntax error.Joshua Colp
Change-Id: Ic8322f04e37842848ad72cf2871bd0378f67c4ac
2015-04-29Merge "chan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate ↵Matt Jordan
AOR Sections Exist in pjsip.conf"
2015-04-29ARI: Fix missing dependencies.Corey Farrell
ARI modules that are generated by 'make ari-stubs' are all dependent on res_ari_model. Additionally some of the same modules depend on one or more res_stasis_* modules. ASTERISK-25027 #close Reported by: Corey Farrell Change-Id: I8e07fe7e81fedacb87232f2b6f8b5f47927b4153
2015-04-29res_pjsip: Remove incorrect MODULEINFO from presence_xml.c.Corey Farrell
Remove incorrect MODULEINFO block and unneeded header includes from presence_xml.c. ASTERISK-25027 Reported by: Corey Farrell Change-Id: I977c609ab9d1fe05373027c4138900f6985990eb
2015-04-29Git Conversion: Switch Non-C files to ASTERISK_REGISTER_FILE.Corey Farrell
This switches files used to generate other sources to use the new ASTERISK_REGISTER_FILE macro. ASTERISK-25026 #close Reported by: Corey Farrell Change-Id: Ieb2537b83421cad07c8955e5f90c405ccf079740
2015-04-28Merge "res_pjsip_outbound_registration: Add debugging messages."Joshua Colp
2015-04-28chan_pjsip: Creating Channel Causes Asterisk to Crash When Duplicate AORAshley Sanders
Sections Exist in pjsip.conf This patch modifies the current loading strategy of the pjsip configuration. If duplicate sections (e.g. sections containing the same [id/type]) are defined in [pjsip.conf], the loader will consider the configuration for the given type as invalid when the duplicate section is encountered. The entire configuration (including what was previously loaded) for the duplicate [id/type] sections will be rejected and destroyed, an error message is logged and the load processing for the given stops. ASTERISK-24996 Reported By: Ashley Sanders Change-Id: I35090ca4cd40f1f34881dfe701a329145c347aef
2015-04-28res_pjsip_outbound_registration: Add debugging messages.Mark Michelson
When problems occur regarding outbound registrations, it currently is difficult to debug. Most off-nominal paths had warning messages, but sometimes we want to know what's going on before hitting the off-nominal path. This patch adds lots of debugging output that should give a clearer picture of what is happening with regards to outbound registrations. ASTERISK-25020 Reported by Mark Michelson Change-Id: I577bde7860be0a6c872b5bcb4d5047340bf45d45
2015-04-28res_rtp_asterisk: Resolve 2 discrete memory leaks in DTLSSteve Davies
ao2 ref leak in res_rtp_asterisk.c when a DTLS policy is created. The resources are linked into a table, but the original alloc refs are never released. ast_strdup leak in rtp_engine.c. If ast_rtp_dtls_cfg_copy() is called twice on the same destination struct, a pointer to an alloc'd string is overwritten before the string is free'd. ASTERISK-25022 Reported by: one47 Change-Id: I62a8ceb8679709f6c3769136dc6aa9a68202ff9b
2015-04-28Merge "Astobj2: Allow reference debugging to be enabled/disabled by config."Matt Jordan
2015-04-27Astobj2: Allow reference debugging to be enabled/disabled by config.Corey Farrell
* The REF_DEBUG compiler flag no longer has any effect on code that uses Astobj2. It is used to determine if reference debugging is enabled by default. Reference debugging can be enabled or disabled in asterisk.conf. * Caller information is provided in logger errors for ao2 bad magic numbers. * Optimizes AO2 by merging internal functions with the public counterpart. This was possible now that we no longer require a dual ABI. ASTERISK-24974 #close Reported by: Corey Farrell Change-Id: Icf3552721fe999365ba8a8cf00a965aa6b897cc1
2015-04-27res_pjsip: Fix SEGV on pending-qualify contactsGeorge Joseph
Permanent contacts that hadn't been qualified yet were missing their contact_status entries causing SEGVs when running CLI commands. This patch makes sure that contact_statuses are created for both dynamic and permanent contacts when they are created. It also adds checks in the CLI code to make sure there's a contact_status, just in case. ASTERISK-25018 #close Reported-by: Ivan Poddubny Tested-by: Ivan Poddubny Tested-by: George Joseph Change-Id: I3cc13e5cedcafb24c400368b515b02d7fb81e029
2015-04-26Merge "Clang: Fix some more tautological-compare warnings."Matt Jordan
2015-04-24Merge "res_pjsip_outbound_authenticator: Increase CSeq on authed requests."Matt Jordan
2015-04-24res_pjsip_outbound_authenticator: Increase CSeq on authed requests.Mark Michelson
The way PJSIP generates an authenticated request is to use a previous request as a template. This means that the authenticated request will have the same Call-ID, From header (including tag), and CSeq as the original request. PJSIP generates a new branch on the Via header to indicate that this is a new transaction, though. There are some SIP implementations, though, that do not notice the change in the branch and therefore will match the authed request to the original request's transaction. Since the CSeq is the same, the server will repeat the response it sent to the original request. This patch aids interoperability by increasing the CSeq of the authed request by one. ASTERISK-24845 #close Reported by: Carl Fortin Tested by: Carl Fortin Change-Id: I39c4ca52e688a9f83bcc1878371334becdc5be01
2015-04-24Clang: Fix some more tautological-compare warnings.Diederik de Groot
clang can warn about a so called tautological-compare, when it finds comparisons which are logically always true, and are therefor deemed unnecessary. Exanple: unsigned int x = 4; if (x > 0) // x is always going to be bigger than 0 Enum Case: Each enumeration is its own type. Enums are an integer type but they do not have to be *signed*. C leaves it up to the compiler as an implementation option what to consider the integer type of a particu- lar enumeration is. Gcc treats an enum without negative values as an int while clang treats this enum as an unsigned int. rmudgett & mmichelson: cast the enum to (unsigned int) in assert. The cast does have an effect. For gcc, which seems to treat all enums as int, the cast to unsigned int will eliminate the possibility of negative values being allowed. For clang, which seems to treat enums without any negative members as unsigned int, the cast will have no effect. If for some reason in the future a negative value is ever added to the enum the assert will still catch the negative value. ASTERISK-24917 Change-Id: Ief23ef68916192b9b72dabe702b543ecfeca0b62
2015-04-24Merge "res_pjsip_t38: Don't crash on authenticated reinvite after originated ↵Matt Jordan
T.38 FAX."
2015-04-23Merge "Clang: change previous tautological-compare fixes."Mark Michelson
2015-04-23res_pjsip_t38: Don't crash on authenticated reinvite after originated T.38 FAX.Mark Michelson
When Asterisk originates a channel to an application, the channel is hung up once the application finishes executing. When the application in question is SendFax, the Asterisk PJSIP code will attempt to reinvite the T.38 session to audio after the FAX completes. The hangup of the channel happens in the midst of this reinvite transaction. In most circumstances, this works out okay because the BYE is delayed until the reinvite transaction can complete. However, if the reinvite that Asterisk sends receives a 401/407 response, then Asterisk's attempt to re-send the reinvite with authentication will fail. This is because the session supplement in res_pjsip_t38 makes the assumption that the channel on the session will always be non-NULL. Since the channel has been hung up, though, the channel is now NULL. Attempting to operate on the channel causes a crash. This patch fixes the issue by ensuring that the channel on the session is not NULL before attempting to mess with the T.38 framehook. This patch also contains some corrections for comments that were incorrect and really confused me when I first started looking at the code. ASTERISK-25004 #close Reported by Mark Michelson Change-Id: Ic5a1230668369dda4bb13524098aed9306ab45a0
2015-04-23res_pjsip: Validate that contact uris start with sip: or sips:George Joseph
Currently we use pjsip_parse_hdr to validate contact uris but it appears that it allows uris without a scheme if there's a port supplied. I.E myexample.com will fail but myexample.com:5060 will pass even though it has no scheme. This causes SEGVs later on whenever the uri is used. To prevent this, permanent_contact_validate has been updated to check that the scheme is either 'sip' or 'sips'. 2 uses of possibly-null endpoint have also been fixed in create_out_of_dialog_request. ASTERISK-24999 Change-Id: Ifc17d16a4923e1045d37fe51e43bbe29fa556ca2 Reported-by: Brad Latus
2015-04-23Clang: change previous tautological-compare fixes.Diederik de Groot
clang can warn about a so called tautological-compare, when it finds comparisons which are logically always true, and are therefor deemed unnecessary. Exanple: unsigned int x = 4; if (x > 0) // x is always going to be bigger than 0 Enum Case: Each enumeration is its own type. Enums are an integer type but they do not have to be *signed*. C leaves it up to the compiler as an implementation option what to consider the integer type of a particu- lar enumeration is. Gcc treats an enum without negative values as an int while clang treats this enum as an unsigned int. rmudgett & mmichelson: cast the enum to (unsigned int) in assert. The cast does have an effect. For gcc, which seems to treat all enums as int, the cast to unsigned int will eliminate the possibility of negative values being allowed. For clang, which seems to treat enums without any negative members as unsigned int, the cast will have no effect. If for some reason in the future a negative value is ever added to the enum the assert will still catch the negative value. ASTERISK-24917 Change-Id: I0557ae0154a0b7de68883848a609309cdf0aee6a
2015-04-23res_corosync: Add check for config file before calling corosync apisGeorge Joseph
On some systems, res_corosync isn't compatible with the installed version of corosync so corosync_cfg_initialize fails, load_module returns LOAD_FAILURE, and Asterisk terminates. The work around has been to remember to add res_corosync as a noload in modules.conf. A better solution though is to have res_corosync check for its config file before attempting to call corosync apis and return LOAD_DECLINE if there's no config file. This lets Asterisk loading continue. If you have a res_corosync.conf file and res_corosync fails, you get the same behavior as today and the fatal error tells you something is wrong with the install. ASTERISK-24998 Change-Id: Iaf94a9431a4922ec4ec994003f02135acfdd3889
2015-04-22res_pjsip_mwi: Send unsolicited MWI NOTIFY on startup and when endpoint ↵Joshua Colp
registers. Currently the res_pjsip_mwi module only sends an unsolicited MWI NOTIFY upon a mailbox state change (such as a new message being left, or one being deleted). In practice this is not sufficient to keep clients aware of the current MWI status. This change makes the module send unsolicited MWI NOTIFY on startup so that clients are guaranteed to have the most up to date MWI information. It also makes clients receive an unsolicited MWI NOTIFY upon registration so if they are unaware of the current MWI status they receive it. ASTERISK-24982 #close Reported by: Joshua Colp Change-Id: I043f20230227e91218f18a82c7d5bb2aa62b1d58
2015-04-22Merge "res_pjsip_pubsub: Set the endpoint on SUBSCRIBE dialogs."Joshua Colp