Commit Graph

4887 Commits

Author SHA1 Message Date
Sean Bright 2ffe52a116 utils: Add convenience function for setting fd flags
There are many places in the code base where we ignore the return value
of fcntl() when getting/setting file descriptior flags. This patch
introduces a convenience function that allows setting or clearing file
descriptor flags and will also log an error on failure for later
analysis.

Change-Id: I8b81901e1b1bd537ca632567cdb408931c6eded7
2017-12-08 13:28:04 -06:00
Sungtae Kim 0611fe581c Add new object for VoicemailUserEntry
Currently, when the app_voicemail sending VoicemailUserEntry AMI event, there's
no OldMessageCount info for default.
To check the OldMessageCount info, it required IMAP_STORAGE define, but this is
not correct.
Added OldMessageCount item as a default.

ASTERISK-27456

Change-Id: I5c71521c2d1daf8b7b161e31c34d28cca6aea4c7
2017-12-04 10:51:49 +01:00
Corey Farrell 58fa3885cc Loader: Remove unneeded load_pri declarations.
Instead of specifying AST_MODFLAG_LOAD_ORDER with load_pri
AST_MODPRI_DEFAULT just use AST_MODFLAG_DEFAULT.

Change-Id: I0123258eafce324249433a69df15a85cc16e509f
2017-11-20 13:17:55 -06:00
Corey Farrell 2fab3aacd6 app_minivm: Fix possible uninitialized return value.
Declare 'res' initialized to -1 to deal with earlier error paths that
could cause 'res' to be returned uninitialized.

Change-Id: I8ac2a5755bf4174d89ef893e924c940f702b104e
2017-11-18 20:29:16 -05:00
George Joseph f512707362 app_record: Don't set RECORD_STATUS chan var until file is closed
We've been calling pbx_builtin_setvar_helper to set the
RECORD_STATUS variable before actually closing the recorded file.
If a client is watching VarSet events and tries to do something with
the file when a RECORD_STATUS event is seen, they might attempt to
do so while the file it's still open.

We now delay calling pbx_builtin_setvar_helper until after we close
the file.

ASTERISK-27423

Change-Id: I7fe9de99953e46b4bafa2b38cf151fe8f6488254
2017-11-15 15:03:21 -05:00
Richard Mudgett ee08f10d06 Fix ast_(v)asprintf() malloc failure usage conditions.
When (v)asprintf() fails, the state of the allocated buffer is undefined.
The library had better not leave an allocated buffer as a result or no one
will know to free it.  The most likely way it can return failure is for an
allocation failure.  If the printf conversion fails then you actually have
a threading problem which is much worse because another thread modified
the parameter values.

* Made __ast_asprintf()/__ast_vasprintf() set the returned buffer to NULL
on failure.  That is much more useful than either an uninitialized pointer
or a pointer that has already been freed.  Many uses won't have to check
for failure to ensure that the buffer won't be double freed or prevent an
attempt to free an uninitialized pointer.

* stasis.c: Fixed memory leak in multi_object_blob_to_ami() allocated by
ast_asprintf().

* ari/resource_bridges.c:ari_bridges_play_helper(): Remove assignment to
the wrong thing which is now not needed even if assigning to the right
thing.

Change-Id: Ib5252fb8850ecf0f78ed0ee2ca0796bda7e91c23
2017-11-06 12:47:30 -05:00
Corey Farrell 606ae3484a Add missing menuselect dependencies.
This adds menuselect dependencies for modules that use symbols of other
modules.

ASTERISK-27390

Change-Id: Ia2d2849f5b87a72af7324a82edc3f283eafb5385
2017-11-02 02:57:52 -04:00
Joshua Colp 92b3ed4d32 Merge "Modules: Fix issues with CLI completion." 2017-10-30 17:18:59 -05:00
Corey Farrell e82b921c35 Modules: Fix issues with CLI completion.
* Stop using ast_module_helper to check if a module is loaded, use
  ast_module_check instead (app_confbridge and app_meetme).
* Stop ast_module_helper from listing reload classes when needsreload
  was not requested.

ASTERISK-27378

Change-Id: Iaed8c1e4fcbeb242921dbac7929a0fe75ff4b239
2017-10-30 01:39:20 -04:00
Igor Goncharovskiy 9bad4c74cc app_agent_spool: Fix typo in dtmf features usage desctiption
Fix typo, that specify usage wrong option 'dtmf-features' for CHANNEL() function
instead of correct 'dtmf_features'

ASTERISK-27377 #close

Change-Id: I15ecc829c1035b359584673e12cdb5c9291ac930
2017-10-28 19:24:17 -05:00
Richard Mudgett 26607e4e3b app_voicemail.c: Fix compiler warning with IMAP build.
ASTERISK-27181

Change-Id: Ic4468b49860bd7f67e922baf4c9e96828c184d17
2017-10-26 12:24:51 -05:00
Richard Mudgett 488f98310f app_agent_pool.c: Fix online documentation typo.
Change-Id: Ib0bc95fd0ec288c78c313823254d7a84ebfc4429
2017-10-23 07:54:34 -05:00
Corey Farrell 955a891a84 app_macro deprecation.
* Mark the module deprecated.
* Disable the module by default.
* Produce a warning the first time a macro is used.
* Note deprecation related options in app_dial and app_queue.

ASTERISK-27350

Change-Id: I560ea043bacdbc5534a17d97854273d52c2f1bdc
2017-10-18 09:54:58 -05:00
Joshua Colp 0bedd436dc Merge "app_originate: Set ORIGINATE_STATUS correctly on failure" 2017-10-11 16:03:21 -05:00
Nathan Bruning be7da57546 app_queue.c: clear moh field in init_queue
ASTERISK-27301 #close

Change-Id: Ic31361f34e2de3b6470e68fc37205a7711082eba
2017-10-11 05:34:45 -05:00
Sean Bright 3ad7d2f36c app_originate: Set ORIGINATE_STATUS correctly on failure
We were ignoring the return value from ast_pbx_outgoing_exten() and
ast_pbx_outgoing_app() which could fail before setting the reason code.
This resulted in failures being reported as success.

ASTERISK-25266 #close
Reported by: Allen Ford

Change-Id: Idf16237b7e41b527d2c69c865829128686beeb3b
2017-10-10 12:32:25 -05:00
Richard Mudgett b2dbfe23ef app_queue.c: Fix announcements when announce-to-first-user not enabled.
The previous patch for ASTERISK-27216 made it so you wouldn't get any
position or periodic announcements unless you had announce-to-first-user
enabled.  The announce-to-first-user feature was added by ASTERISK_21782
as a result of the patch which introduced the redundant announcements that
ASTERISK-27216 removes.

* By noting that the makeannouncement variable is used to suppresses the
first user announcement, we set its initial value to the
announce-to-first-user enable setting.

ASTERISK-27216

Change-Id: Ieaeb7dbea8ae7073086b775fbafe0625b000b10a
2017-09-28 18:48:21 -05:00
Joshua Colp 2a09b3b76a Merge "app_queue: Only do announcement logic between ringing cycles" 2017-09-26 06:36:47 -05:00
Joshua Colp 0133d29c83 Merge "build: A few gcc 7 error fixes" 2017-09-25 13:04:22 -05:00
George Joseph 4275ca16a1 build: A few gcc 7 error fixes
Change-Id: I7b5300fbf1af7d88d47129db13ad6dbdc9b553ec
2017-09-25 07:32:14 -05:00
StefanEng86 c3c73b3511 app_queue: Only do announcement logic between ringing cycles
This patch reverts the change by patch 2263 from old reviewboard.
Note that reverting that 2263-patch still preserves the behaviour that
the commit log of the 2263-patch claimed to add. The reason for this is:

The function wait_for_answer is only called from try_calling which
in turn is only called from the main for loop in queue_exec, and
earlier in that loop we already check the things that's removed by
this patch. There's no need to check those things twice each loop
iteration, and I think the proper place to check it is before each
ringing cycle. By checking it in wait_for_answer, you allow the issue
explained in the jira - that the head caller hears announcements while
the agents' sip phones are actively ringing.

Reported-by: Stefan Engström
Tested-by: Stefan Engström
ASTERISK-27216 #close

Change-Id: Ic4290dc75256f9743900c6762ee1bb915f672db0
2017-09-25 07:02:37 -05:00
Sean Bright 0fad11f21c app_stream_echo: Don't echo declined streams
Discovered while experimenting with Cyber Mega Phone 2K Ultimate Dynamic
Edition after accepting the audio request but declining the video one.

Change-Id: Iaa86d41fccfbc1b559a30ccf740d78a3b5f8a98c
2017-09-23 12:33:54 -05:00
Joshua Colp 6fd3db51e8 app_confbridge: Only create a channel that records audio.
This change makes it so that the conference recorder channel
that is created only contains audio formats and an audio stream.
This is because the underlying application used by ConfBridge to
record, MixMonitor, only allows recording audio.

Having additional streams (and in particular a video stream) can
result in clients needlessly renegotiating to add a video stream
that will never receive video.

Change-Id: I89d38aedc9205eca7741d5435e73e73bb9de97a0
2017-09-19 07:56:00 -05:00
Sean Bright 2b3f903e6f app_waitforsilence: Cleanup & don't treat missing frames as 'noise'
* WaitForSilence completes successfully if it receives no media in the
  specified timeout, but when acting as WaitForNoise that logic needs
  to be reversed.

* Use standard argument parsing macros and add some error checking for
  invalid values.

* The documentation indicated that the first argument to both
  WaitForSilence and WaitForNoise was required when it was not. Update
  the documentation to reflect that.

* Wrap up some behavior in structs to avoid boolean checks all over the
  place.

ASTERISK-24066 #close
Reported by: M vd S

Change-Id: I01d40adc5b63342bb5018a1bea2081a0aa191ef9
2017-09-06 16:16:19 -05:00
Sean Bright 1bdbefbe76 app_directory: Handle a NULL mailbox without crashing
ASTERISK-27241 #close
Reported by: David Moore

Change-Id: Ibbbca85517b04c315406ebfe3b6f7e0763daedc6
2017-09-01 10:28:12 -05:00
Corey Farrell 1bf3dfffd7 AST-2017-006: Fix app_minivm application MinivmNotify command injection
An admin can configure app_minivm with an externnotify program to be run
when a voicemail is received.  The app_minivm application MinivmNotify
uses ast_safe_system() for this purpose which is vulnerable to command
injection since the Caller-ID name and number values given to externnotify
can come from an external untrusted source.

* Add ast_safe_execvp() function.  This gives modules the ability to run
external commands with greater safety compared to ast_safe_system().
Specifically when some parameters are filled by untrusted sources the new
function does not allow malicious input to break argument encoding.  This
may be of particular concern where CALLERID(name) or CALLERID(num) may be
used as a parameter to a script run by ast_safe_system() which could
potentially allow arbitrary command execution.

* Changed app_minivm.c:run_externnotify() to use the new ast_safe_execvp()
instead of ast_safe_system() to avoid command injection.

* Document code injection potential from untrusted data sources for other
shell commands that are under user control.

ASTERISK-27103

Change-Id: I7552472247a84cde24e1358aaf64af160107aef1
2017-08-30 18:43:38 +00:00
Sean Bright 06cc5ae9ff confbridge: Handle user hangup during name recording
This prevents orphaned CBAnn channels from getting stuck in the bridge.

ASTERISK-26994 #close
Reported by: James Terhune

Change-Id: I5e43e832a9507ec3f2c59752cd900b41dab80457
2017-08-29 09:28:11 -05:00
Jenkins2 f47733cea0 Merge "app_record: Resolve some absolute vs. relative filename bugs" 2017-08-29 05:57:07 -05:00
Sean Bright da13cdb9e7 voicemail: Fix various abuses of mkstemp
mkstemp() returns a unique filename, but appending an extension to that
filename does not guarantee uniqueness. Instead, use mkdtemp() and we
can put whatever extension we want on the files that we create inside
the directory.

In the case of app_minivm, we also now properly clean up any temporary
files that we create.

ASTERISK-20858 #close
Reported by: Walter Doekes

Change-Id: I30ad04f0e115f0b11693ff678ba5184d8b938e43
2017-08-25 16:08:55 -05:00
Sean Bright 43670e471f app_record: Resolve some absolute vs. relative filename bugs
If the Record() application is called with a relative filename that
includes directories, we were not properly creating the intermediate
directories and Record() would fail.

Secondarily, updated the documentation for RECORDED_FILE to mention
that it does not include a filename extension.

Finally, rewrote the '%d' functionality to be a bit more straight
forward and less noisy.

ASTERISK-16777 #close
Reported by: klaus3000

Change-Id: Ibc2640cba3a8c7f17d97b02f76b7608b1e7ffde2
2017-08-25 12:27:12 -05:00
Jenkins2 179524c255 Merge "app_queue: Evaluate realtime queues when running dialplan functions" 2017-08-25 09:32:28 -05:00
Sean Bright 02f95d290f app_queue: Evaluate realtime queues when running dialplan functions
ASTERISK-19103 #close
Reported by: Jim Van Meggelen

Change-Id: I4bd32a9d1fcebb8ac56bff0e084d4f53e31b692b
2017-08-24 09:44:27 -05:00
Sean Bright b1097be134 app_voicemail: Honor escape digits in "greeting only" mode
ASTERISK-21241 #close
Reported by: Eelco Brolman
Patches:
	Patch uploaded by Eelco Brolman (License 6442)

Change-Id: Icbe39b5c82a49b46cf1d168dc17766f3d84f54fe
2017-08-24 09:04:13 -05:00
Joshua Colp c7edd0b493 Merge "app_confbridge: Document sfu video_mode value." 2017-08-23 13:05:35 -05:00
Jenkins2 e8cf4ab833 Merge "confbridge.h: Fix doxygen comments." 2017-08-23 12:05:29 -05:00
Richard Mudgett 5bbf7b2aad app_confbridge: Document sfu video_mode value.
Change-Id: I26e17df2c93f3933b23f78070603adbcc84ba204
2017-08-22 11:23:45 -05:00
Richard Mudgett f96536b1ea confbridge.h: Fix doxygen comments.
Change-Id: I16133166a85fdb557c66ffcbfe8128d0b4725b0e
2017-08-22 11:21:13 -05:00
Sungtae Kim 22af5e3784 app_queue: Fix initial hold time queue statistic
Fixed to use correct initial value and fixed to use the
correct queue info to check the first value.

ASTERISK-27204

Change-Id: Ia9e36c828e566e1cc25c66f73307566e4acb8e73
2017-08-22 07:36:25 -05:00
Jenkins2 1fde9dc7a5 Merge "app_privacy: remove unused header asterisk/image.h" 2017-08-07 07:04:13 -05:00
Corey Farrell 4b03eb5c38 Fix compile error for old versions of GCC.
Use -Wno-format-truncation only if supported by compiler.

ASTERISK-27171 #close

Change-Id: Iac0aed7a5bcaa16c21b7d62c4e4678d244c4ccb6
2017-08-02 18:10:57 -04:00
Corey Farrell 148cf2e0f7 app_privacy: remove unused header asterisk/image.h
Change-Id: I56ed530633a642633b18383821069e806c92ae82
2017-08-02 17:08:48 -04:00
Corey Farrell 58d032112b Fix compiler warnings on Fedora 26 / GCC 7.
GCC 7 has added capability to produce warnings, this fixes most of those
warnings.  The specific warnings are disabled in a few places:

* app_voicemail.c: truncation of paths more than 4096 chars in many places.
* chan_mgcp.c: callid truncated to 80 chars.
* cdr.c: two userfields are combined to cdr copy, fix would break ABI.
* tcptls.c: ignore use of deprecated method SSLv3_client_method().

ASTERISK-27156 #close

Change-Id: I65f280e7d3cfad279d16f41823a4d6fddcbc4c88
2017-08-01 15:42:38 -06:00
Sean Bright 3f98488279 app_queue: Add announce-position-only-up option
Setting this option will cause the Queue application to only announce
the caller's position if it has improved since the last time that we
announced it.

Change-Id: I173a124121422209485b043e2bf784f54242fce6
2017-08-01 15:42:37 -06:00
Joshua Colp b610295b62 Merge "bridge_softmix / res_rtp_asterisk: Fix packet loss and renegotiation issues." 2017-07-26 08:31:13 -05:00
Richard Mudgett 922930753c app_voicemail.c: Allow mailbox entry on authentication retry prompt.
The following testsuite voicemail tests were failing to re-enter the
mailbox after the first login attempt.

tests/apps/voicemail/authenticate_invalid_mailbox
tests/apps/voicemail/authenticate_invalid_password

The tests were noting the start of the vm-incorrect-mailbox prompt and
immediately sending the mailbox for the next login attempt.  Since the
invalid message playback had to complete before the digits were
recognized, the test passed for the wrong reason and added approximately
20 seconds to the test times.

* Allow the vm-incorrect-mailbox prompt to get interrupted by the mailbox
digits like the initial vm-login prompt so the tests are able to enter the
intended mailbox.

Change-Id: I1dc53fe917bfe03a4587b2c4cd24c94696a69df8
2017-07-21 16:17:13 -05:00
George Joseph 66b8c454d1 Merge "app_playback.c: Use the timezonename parameter" 2017-07-19 12:11:09 -05:00
Joshua Colp 680c491a62 bridge_softmix / res_rtp_asterisk: Fix packet loss and renegotiation issues.
This change does a few things to improve packet loss and renegotiation:

1. On outgoing RTP streams we will now properly reflect out of order
packets and packet loss in the sequence number. This allows the
remote jitterbuffer to better reorder things.

2. Video updates can now be discarded for a period of time
after one has been sent to prevent flooding of clients.

3. For declined and removed streams we will now release any
media session resources associated with them. This was not
previously done and caused an issue where old state was being
used for a new stream.

4. RTP bundling was not actually removing bundled RTP instances
from the parent. This has been resolved by removing based on
the RTP instance itself and not the SSRC.

5. The code did not properly handle explicitly unbundling an
RTP instance from its parent. This now works as expected.

ASTERISK-27143

Change-Id: Ibd91362f0e4990b6129638e712bc8adf0899fd45
2017-07-19 13:23:26 +00:00
George Joseph 47084ad09e Merge "app_queue: Add change priority of call" 2017-07-18 09:37:36 -05:00
Sergej Kasumovic 26f149ab0a app_confbridge: Make sure name recordings are always removed from the filesystem
This commit fixes two possible scenarios:

* When recording name and if during recording you hangup, file is never
removed. This is due to the fact file location is nulled.
* When recording name and if you hangup during thank-you prompt, file
is never removed.

ASTERISK-27123 #close

Change-Id: I39b7271408b4b54ce880c5111a886aa8f28c2625
2017-07-14 07:50:13 -05:00
Holger Hans Peter Freyther b54eb167b4 app_playback.c: Use the timezonename parameter
In say_date_generic the timezonename parameter is passed but never
used. Fix it by passing it to the ast_localtime function.

ASTERISK-27124

Change-Id: I63106b8db10426d417d7275f22554a616e92fae4
2017-07-12 23:22:56 +02:00