Commit Graph

109 Commits

Author SHA1 Message Date
Tilghman Lesher 08af5bb312 Create a new config file status, CONFIG_STATUS_FILEINVALID for differentiating
when a file is invalid from when a file is missing.  This is most important when
we have two configuration files.  Consider the following example:

Old system:
sip.conf     users.conf     Old result               New result
========     ==========     ==========               ==========
Missing      Missing        SIP doesn't load         SIP doesn't load
Missing      OK             SIP doesn't load         SIP doesn't load
Missing      Invalid        SIP doesn't load         SIP doesn't load
OK           Missing        SIP loads                SIP loads
OK           OK             SIP loads                SIP loads
OK           Invalid        SIP loads incompletely   SIP doesn't load
Invalid      Missing        SIP doesn't load         SIP doesn't load
Invalid      OK             SIP doesn't load         SIP doesn't load
Invalid      Invalid        SIP doesn't load         SIP doesn't load

So in the case when users.conf doesn't load because there's a typo that
disrupts the syntax, we may only partially load users, instead of failing with
an error, which may cause some calls not to get processed.  Worse yet, the old
system would do this with no indication that anything was even wrong.

(closes issue #10690)
 Reported by: dtyoo
 Patches: 
       20080716__bug10690.diff.txt uploaded by Corydon76 (license 14)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@142992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-12 23:30:03 +00:00
Sean Bright 3ffb39833b More RSW merges. Everything from apps/ except for the big offenders
app_voicemail and app_queue.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-10 14:45:25 +00:00
Michiel van Baak 8e8359465b Older versions of GNU gcc do not allow 'NULL' as sentinel.
They want (char *)NULL as sentinel.
An example is OpenBSD (confirmed on 4.3) that ships with gcc 3.3.4

This commit introduces a contstant SENTINEL which is declared as:
#define SENTINEL ((char *)NULL)

All places I could test compile on my openbsd system are converted.
Update CODING-GUIDELINES to tell about this constant.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@124127 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-19 20:48:33 +00:00
Mark Michelson 8b1cb3ce53 Make app_directory dependent on app_voicemail. This is because the function
which says the person's name is handled inside app_voicemail now.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114841 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-29 18:48:26 +00:00
Mark Michelson 6e45d3c223 Since there is now a globally available function for saying someone's name, a LOT of
functions in app_directory can be removed since the ODBC-specific lookups are accomplished
within app_voicemail. This change greatly reduces the amount of lines in app_directory that
were solely for the purpose of looking up a name when ODBC_STORAGE is specified for voicemail.

This commit also makes the name-saying interruptable via DTMF.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114834 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-29 17:56:13 +00:00
Mark Michelson 1016811538 Fix a crash happening in app_directory. This crash would occur if a users.conf existed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-29 17:31:26 +00:00
Jason Parker fe65716e15 If somebody enters a digit during ast_stream_and_wait, the return value is the digit, which we need to use later.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@114149 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-04-15 20:27:04 +00:00
Tilghman Lesher 3826278d38 Upgrade the sounds version; add several directory enhancements:
1) Number of digits to enter can now be configured
	2) The digits can now match on both first AND last name, instead of only one or the other
(Closes issue #7151)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@110237 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-20 05:06:12 +00:00
Michiel van Baak 4dccb58fb7 whitespace fixes only.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103249 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-09 11:27:10 +00:00
Mark Michelson e34fc8282c Big improvement for app_directory. This patch breaks the do_directory function up
so that it is more easily parsed by the human brain. It also fixes some errors. I'll quote
dimas from the original bug description:

"app_directory contained some duplicate code even before addition of 'm' option. Addition of that option doubled amount of that code. Worst of all, there are minor differences between these code block and bugs caused by these differences.

1. There is a memory leak. In the 'menu' mode, result of the convert(pos) function is not freed while it should be.
2. In the 'menu' mode check for OPT_LISTBYFIRSTNAME flag ('f' option) is not negated as result, application works in the mode opposite to what user expect (checking last name when user wants the first nd vice versa).
3. select_item function plays message for user using res = func1() || func2() || func3()... construct. This construct loses the actual value returned by ast_waitstream() for example so at the end, res does not contain digit user dialed while listening to the message.
4. (also in 1.4) application announces entries from voicemail.conf/realtime separately from entries from users.conf. I see no reason why doing so instead of building combined list.
5. Alot of duplicated code as already mentioned."

This was tested by dimas and I (I tested under valgrind). A word of caution: any bug fixes that happen
in app_directory in 1.4 will almost certainly not merge cleanly into trunk as a result of this, but it is
well worth it. 

Huge thanks to dimas for this wonderful submission.

(closes issue #11744)
Reported by: dimas
Patches:
      dir3.patch uploaded by dimas (license 88)
	  Tested by: putnopvut, dimas


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@98888 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-14 22:11:50 +00:00
Russell Bryant f82c42a22e Resolve compiler warnings.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91193 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-05 17:44:59 +00:00
Tilghman Lesher d226c1d637 Added multiple name listing. (Closes issue #10413)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91172 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-05 16:25:52 +00:00
Luigi Rizzo ea2c54859d more removal of redundant headers
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-22 02:07:33 +00:00
Luigi Rizzo a23c055c3d move asterisk/paths.h outside asterisk.h and into those files
who really need it.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89466 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-20 23:16:15 +00:00
Luigi Rizzo ffd86fc964 more errno.h removal
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89432 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-19 21:12:08 +00:00
Luigi Rizzo 0595b5e2aa include "logger.h" and errno.h from asterisk.h - usage shows that they
were included almost everywhere.
Remove some of the instances.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89424 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-19 18:52:04 +00:00
Luigi Rizzo fdb7f7ba3d Start untangling header inclusion in a way that does not affect
build times - tested, there is no measureable difference before and
after this commit.

In this change:

use asterisk/compat.h to include a small set of system headers:
inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h,
stdlib.h, alloca.h, stdio.h

Where available, the inclusion is conditional on HAVE_FOO_H as determined
by autoconf.

Normally, source files should not include any of the above system headers,
and instead use either "asterisk.h" or "asterisk/compat.h" which does it
better. 

For the time being I have left alone second-level directories
(main/db1-ast, etc.).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16 20:04:58 +00:00
Luigi Rizzo 7f8ecd2cd3 make the 'name' and 'value' fields in ast_variable const char *
This prevents modifying the strings in the stored variables, 
and catched a few instances where this was actually done.

Given the differences between trunk and 1.4 (and the fact that this
is effectively an API change) it is better to fix 1.4 independently.
These are

chan_sip.c::sip_register()
chan_skinny.c:: near line 2847
config.c:: near line 1774
logger.c::make_components()
res_adsi.c:: near line 1049

I may have missed some instances for modules that do not build here.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-14 13:18:40 +00:00
Steve Murphy b5cd67adc3 This code was in team/murf/bug8684-trunk; it should fix bug 8684 in trunk. I didn't add it to 1.4 yet, because it's not entirely clear to me if this is a bug fix or an enhancement. A lot of files were affected by small changes like ast_variable_new getting an added arg, for the file name the var was defined in; ast_category_new gets added args of filename and lineno; ast_category and ast_variable structures now record file and lineno for each entry; a list of all #include and #execs in a config file (or any of its inclusions are now kept in the ast_config struct; at save time, each entry is put back into its proper file of origin, in order. #include and #exec directives are folded in properly. Headers indicating that the file was generated, are generated also for each included file. Some changes to main/manager.c to take care of file renaming, via the UpdateConfig command. Multiple inclusions of the same file are handled by exploding these into multiple include files, uniquely named. There's probably more, but I can't remember it right now.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-29 20:55:40 +00:00
Tilghman Lesher 56b9568164 Don't reload a configuration file if nothing has changed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-16 21:09:46 +00:00
Tilghman Lesher f78ff66a4d Merged revisions 78415 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r78415 | tilghman | 2007-08-07 14:09:38 -0500 (Tue, 07 Aug 2007) | 2 lines

Reconnection doesn't happen automatically when a DB goes down (fixes issue #9389)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78417 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-07 19:14:45 +00:00
Tilghman Lesher 20bbd09de3 Mostly cleanup of documentation to substitute the pipe with the comma, but a few other formatting cleanups, too.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77808 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-31 01:10:47 +00:00
Mark Michelson 51bf714319 Merged revisions 76139 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r76139 | mmichelson | 2007-07-20 13:42:27 -0500 (Fri, 20 Jul 2007) | 6 lines

When using users.conf for the entries in the directory, if multiple users had the same last name, only the first user listed would be available
in the directory.

(closes issue #10200, reported by mrskippy, patched by me)


........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76140 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-20 18:44:30 +00:00
Joshua Colp b8cd949cce Applications no longer need to call ast_module_user_add and ast_module_user_remove. This is now taken care of in the pbx_exec function outside of the application.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75200 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-16 14:39:29 +00:00
Russell Bryant b179e2155f Convert uses of strdup() to ast_strdup()
(issue #9983, eliel)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69436 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-14 23:01:01 +00:00
Tilghman Lesher b353c43c28 Merged revisions 68781 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r68781 | tilghman | 2007-06-11 15:45:53 -0500 (Mon, 11 Jun 2007) | 2 lines

Issue 9947 - fn2 was unused / incorrectly used

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@68782 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-11 20:51:43 +00:00
Tilghman Lesher 9d05ff8ed5 Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-06 21:20:11 +00:00
Tilghman Lesher e31c4fca7d Merged revisions 63566 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r63566 | tilghman | 2007-05-09 09:50:33 -0500 (Wed, 09 May 2007) | 10 lines

Merged revisions 63565 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r63565 | tilghman | 2007-05-09 09:48:06 -0500 (Wed, 09 May 2007) | 2 lines

Replicate fix from 51158 (app_voicemail) to app_directory (Issue 9224)

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@63567 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-09 14:52:13 +00:00
Jason Parker a84ca79445 Merged revisions 60936 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r60936 | qwell | 2007-04-09 12:22:59 -0500 (Mon, 09 Apr 2007) | 13 lines

Merged revisions 60935 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r60935 | qwell | 2007-04-09 12:22:15 -0500 (Mon, 09 Apr 2007) | 5 lines

Allow matching on names shorter than 3 chars.
This also fixes the case where somebody wants to match on less then 3 chars.

Issue 9071

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@60937 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-04-09 17:23:55 +00:00
Russell Bryant f901158670 Merged revisions 59278 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r59278 | russell | 2007-03-27 18:20:22 -0500 (Tue, 27 Mar 2007) | 11 lines

Merged revisions 59277 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r59277 | russell | 2007-03-27 18:19:41 -0500 (Tue, 27 Mar 2007) | 3 lines

Fix the check of the return value from mmap().  Thanks to Corydon for catching
this one.

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@59279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-03-27 23:22:03 +00:00
Russell Bryant 0d4406748d Merged revisions 59275 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r59275 | russell | 2007-03-27 18:16:27 -0500 (Tue, 27 Mar 2007) | 3 lines

Fix app_directory to actually compile with ODBC_STORAGE, and update the code to
the latest res_odbc API.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@59276 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-03-27 23:16:54 +00:00
Steve Murphy 7b338004bf a quick fix to app_sms.c to get rid of cursed compiler warnings so I can compile under --enable-dev-mode
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48767 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-21 19:44:20 +00:00
Steve Murphy 6dcb17baaf This update fulfils the request of bug 7109, which claimed the language arg to ast_stream_and_wait() was redundant. Almost all calls just used chan->language, and seeing how chan is the first argument, this certainly seems redundant. A change of language could just as easily be done by simply changing the channel language before calling.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-17 23:18:51 +00:00
Tilghman Lesher 70af28270d Constify the result of a config retrieval function, to avoid mutilation (issue 7983).
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-20 20:40:39 +00:00
Tilghman Lesher e39c9d7619 Merged revisions 43072 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r43072 | tilghman | 2006-09-17 08:54:34 -0500 (Sun, 17 Sep 2006) | 3 lines

Directory used the wrong context for delivery of 0- and *- keypresses
(according to Directory's own documentation) - Issue 7965

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43075 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-17 14:00:39 +00:00
Kevin P. Fleming c2c4f86c72 merge markster's usersconf branch with some slight changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-16 23:53:58 +00:00
Kevin P. Fleming 0a27d8bfe5 merge new_loader_completion branch, including (at least):
- restructured build tree and makefiles to eliminate recursion problems
  - support for embedded modules
  - support for static builds
  - simpler cross-compilation support
  - simpler module/loader interface (no exported symbols)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40722 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-21 02:11:39 +00:00
Jason Parker 7c05e6478d Fix a bug with app_voicemail when trying to use app_directory to leave messages
to another user (options 3, 5, 2).

If the context/extension didn't exist in the dialplan (and why should it have to?),
it would fail, saying that it's an "invalid extension".

(issue BE-71)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40426 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-08-19 00:53:54 +00:00
Tilghman Lesher 1c76072e4b Merged revisions 36377 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r36377 | tilghman | 2006-06-30 09:05:53 -0500 (Fri, 30 Jun 2006) | 5 lines

Bug 7349 - Directory did not work correctly when USE_ODBC_STORAGE was defined.

Note: Russell agreed that this should have worked, which is why this is
classified as a bugfix.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@36380 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-30 14:10:53 +00:00
Kevin P. Fleming 472c1ca282 simplify autoconfig include mechanism (make tholo happy he can use lint again :-)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@32846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-06-07 18:54:56 +00:00
Kevin P. Fleming 18606233da fix various typos and other bits (from Ian Kinner)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@30800 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-30 16:01:50 +00:00
Russell Bryant 04ecb29d03 remove almost all of the checks of the result from ast_strdupa() or alloca().
As it turns out, all of these checks were useless, because alloca will never
return NULL.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26451 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-05-10 13:22:15 +00:00
Luigi Rizzo 899cdda8cb minor cleanup
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23067 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-28 06:40:40 +00:00
Luigi Rizzo b560433a36 convert to use ast_stream_and_wait
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@22082 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-21 20:57:29 +00:00
Luigi Rizzo ca9e77fe46 code simplifications
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20168 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 22:32:13 +00:00
Luigi Rizzo e43bc6634d This rather large commit changes the way modules are loaded.
As partly documented in loader.c and include/asterisk/module.h,
modules are now expected to return all of their methods and flags
into a structure 'mod_data', and are normally loaded with RTLD_NOW
| RTLD_LOCAL, so symbols are resolved immediately and conflicts
should be less likely.  Only in a small number of cases (res_*,
typically) modules are loaded RTLD_GLOBAL, so they can export
symbols.
 
The core of the change is only the two files loader.c and
include/asterisk/module.h, all the rest is simply adaptation of the
existing modules to the new API, a rather mechanical (but believe
me, time and finger-consuming!) process whose detail you can figure
out by svn diff'ing any single module.

Expect some minor compilation issue after this change, please
report it on mantis http://bugs.digium.com/view.php?id=6968
so we collect all the feedback in one place.

I am just sorry that this change missed SVN version number 20000!



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20003 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 14:08:19 +00:00
BJ Weschke d2480538d2 Provide the ability to read extension number after name #6938 (delink)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@19221 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-11 15:38:17 +00:00
Kevin P. Fleming f10f427d49 since the module API is changing, it's a good time to const-ify the description() and key() return values
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@18552 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-08 22:01:19 +00:00
Matt O'Gorman a5ece3388a Janitor work converting !ast_strlen_zero(a)?a:b
to S_OR functions. from bug note 6805 with minor
modifications.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@15283 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-03-27 19:31:54 +00:00
Russell Bryant a0d438fb6c remove the uses of the deprecated STANDARD_LOCAL_USER
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10241 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-02-15 20:11:56 +00:00