dect
/
asterisk
Archived
13
0
Fork 0
Commit Graph

355 Commits

Author SHA1 Message Date
tilghman dbec3d56c1 Don't reload a configuration file if nothing has changed.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@79747 f38db490-d61c-443f-a65b-d21fe96a405b
2007-08-16 21:09:46 +00:00
file 9d14a34591 Use the linkedlists.h macros for the manager action list.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@78521 f38db490-d61c-443f-a65b-d21fe96a405b
2007-08-07 22:13:40 +00:00
russell 3cf99f7033 Remove an XXX comment noting that it would be nice for a declaration to be
inside of a function.  (Yes, it would!)  Replace it with a note that explains
why it can't be done using the way that the AST_THREADSTORAGE macro is
currently defined.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@77790 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-30 19:31:27 +00:00
russell 4f3c4dc7f2 Do a massive conversion for using the ast_verb() macro
(closes issue #10277, patches by mvanbaak)

Basically, this changes ...

if (option_verbose > 2)
   ast_verbose(VERBOSE_PREFIX_3, "Something\n");

to ...

ast_verb(3, "Something\n");


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@77299 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-26 15:49:18 +00:00
file 919446e599 Move manager users list over to an rwlist.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@76712 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-24 02:59:49 +00:00
file b2f6516547 Don't bother calling AST_RWLIST_EMPTY on a list before AST_RWLIST_TRAVERSE, it's just a double check.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@76710 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-23 23:05:18 +00:00
tilghman 74c2948c22 Merge in ast_strftime branch, which changes timestamps to be accurate to the microsecond, instead of only to the second
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@75706 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-18 19:47:20 +00:00
file f913b3ee0a Make sure the idText variable is empty, and put it in the right place for the manager ack packet. (issue #10152 reported by srt)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@73932 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-09 01:25:00 +00:00
russell 7861ca021d After some discussion on the asterisk-dev list, we determined that this approach
for extracting application, function, manager, and agi documentation is the wrong
one to take.  The most severe problem is that the output depends on which modules
are loaded as well as compile time options, which both determine which parts are
available.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@72986 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-02 23:02:16 +00:00
russell e7f6898702 Add a CLI command to dump the built-in manager action documentation
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@72928 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-02 18:45:50 +00:00
russell 103ed228f3 Merged revisions 72926 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r72926 | russell | 2007-07-02 13:18:46 -0500 (Mon, 02 Jul 2007) | 3 lines

Remove a bogus comment and add proper locking to the handler function for the
CLI command to show information on manager actions.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@72927 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-02 18:19:21 +00:00
russell 20e9f5d47c Merge changes from team/russell/http_filetxfer
Handle transferring large files from the built-in http server.  Previously, the
code attempted to malloc a block as large as the file itself.  Now it uses the
sendfile() system call so that the file isn't copied into userspace at all if
it is available.  Otherwise, it just uses a read/write of small chunks at a time.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@72701 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-29 20:35:09 +00:00
tilghman ffb076a0c1 Merged revisions 72556 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r72556 | tilghman | 2007-06-28 23:47:11 -0500 (Thu, 28 Jun 2007) | 2 lines

Issue 10055 - Change memory allocation to use the heap for a command, since the output has the potential to overflow the stack (as it did here)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@72557 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-29 04:56:08 +00:00
russell 438cb82e0f Conversions to ast_debug()
(issue #9984, patches from eliel and dimas)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@71338 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-24 18:51:41 +00:00
tilghman afee30efdb Merged revisions 71289 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r71289 | tilghman | 2007-06-24 12:39:34 -0500 (Sun, 24 Jun 2007) | 10 lines

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

........
r71288 | tilghman | 2007-06-24 12:32:21 -0500 (Sun, 24 Jun 2007) | 2 lines

Issue 10043 - There is a legitimate need to be able to set variables to the empty string.

........

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


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@71290 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-24 17:42:39 +00:00
qwell 176dfa7845 Add manager events for RTCP statistics.
Also adds a new "reporting" permission for manager, since it can be incredibly spammy.
  This permission was discussed on the -dev mailing list some months back.

Issue 8613, patch by johann8384, with some minor changes by me.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@70961 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-21 23:07:20 +00:00
kpfleming 4c5507d166 Merged revisions 69392 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r69392 | kpfleming | 2007-06-14 16:50:40 -0500 (Thu, 14 Jun 2007) | 2 lines

use ast_localtime() in every place localtime_r() was being used

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@69405 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-14 22:09:20 +00:00
bbryant cf12cac752 Couple of manager ssl options weren't loading because of a typo.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@69261 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-14 15:43:50 +00:00
qwell 17d0ce8001 Change displayconnects option in manager.conf to be per-user.
Issue 9932, patch by eliel


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@68831 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-11 22:07:50 +00:00
file 06d778dd1d Add username completion for manager show user CLI command. (issue #9929 reported by eliel)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@68663 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-11 11:59:53 +00:00
russell ae627acb2f Fix a bunch of doxygen errors and document more things
(issue #9842, snuffy)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@68339 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-07 23:07:25 +00:00
tilghman eb5d461ed4 Issue 9869 - replace malloc and memset with ast_calloc, and other coding guidelines changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67864 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-06 21:20:11 +00:00
russell 923c1c3300 Minor formatting change to test closing mantis issues through commit tags
(closes issue #9828)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67843 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-06 20:35:05 +00:00
russell bde496c910 Minor formatting change to test closing mantis issues through commit tags
(closes issue #9828)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67842 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-06 20:21:31 +00:00
qwell d2915a278d Make sure we default allowmultiplelogin to on/yes, per the default stated in the config.
Issue 9885, patch by eliel.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67398 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-05 17:47:37 +00:00
russell a42bc96f14 Add a new API call for creating detached threads. Then, go replace all of the
places in the code where the same block of code for creating detached threads
was replicated.  (patch from bbryant)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@65968 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-24 18:30:19 +00:00
file d01a449298 Merged revisions 65902 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r65902 | file | 2007-05-24 11:27:23 -0400 (Thu, 24 May 2007) | 2 lines

Add the ability to blacklist certain commands from being executed using the Command AMI action. (issue #9240 reported by junky)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@65905 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-24 15:30:06 +00:00
russell c180e625c1 Add an option that lets you only allow one connection at a time for each
manager user.  (issue #8664, reported and original patch by ssokol, patch
updated by bkruse, and further updated by me)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@64786 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-17 17:12:23 +00:00
qwell 28913582e8 Merged revisions 63982 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r63982 | qwell | 2007-05-11 15:16:17 -0500 (Fri, 11 May 2007) | 7 lines

Hide manager password from "manager show user foo".

I realize that there are other ways to get this,
 but we really don't need to just show it in plain text so easily.

Issue 9273, patch by junky

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@63983 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-11 20:16:56 +00:00
russell 9322f6b218 Merged revisions 63886 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r63886 | russell | 2007-05-11 11:05:43 -0500 (Fri, 11 May 2007) | 6 lines

When MD5 authentication is not possible because there is no challenge present,
either because the Challenge action was never issued, or some other reason,
give a proper error message and return an error instead of claiming that the
user wasn't found.
(reported by jsmith on IRC)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@63902 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-11 16:21:45 +00:00
russell 18bb03b618 Merged revisions 63804 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r63804 | russell | 2007-05-10 17:23:42 -0500 (Thu, 10 May 2007) | 4 lines

Strip terminal escape sequences from CLI command output that is going to be
sent out over the manager interface.
(issue #9659, reported by pari, fixed by me)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@63805 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-10 22:25:54 +00:00
russell bac4677f3c Convert spaces to tabs for indentation.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@63089 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-04 19:48:52 +00:00
oej add6450862 Add "CoreStatus" - from the moremanager branch.
This can be extended with more information, ideas and patches are welcome, as usual :-)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@63031 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-04 13:47:11 +00:00
oej 189e5866cf - Add manager command CoreSettings
- Add missing option to options.h
- Add missing variables to asterisk.h
- Move manager version to manager.h include file


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@63030 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-04 13:44:50 +00:00
russell 86e2deef74 Merged revisions 61787 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r61787 | russell | 2007-04-24 16:34:53 -0500 (Tue, 24 Apr 2007) | 12 lines

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

........
r61786 | russell | 2007-04-24 16:33:59 -0500 (Tue, 24 Apr 2007) | 4 lines

Don't crash if a manager connection provides a username that exists in
manager.conf but does not have a password, and also requests MD5 
authentication. (ASA-2007-012)

........

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


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61788 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-24 21:37:00 +00:00
russell be90f5388d When building a JSON encoded string in the GetConfigJSON manager action, escape
the '\' and '"' characters.  (issue #9475, reported by pari, patch by me)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61767 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-23 18:49:19 +00:00
russell 28472c7383 Merged revisions 61690 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61690 | russell | 2007-04-20 13:19:18 -0500 (Fri, 20 Apr 2007) | 4 lines

Fix the UpdateConfig manager action to properly treat "variables" and "objects"
differently (a=b versus a=>b).
(issue #9568, reported by pari, patch by me)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61691 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-20 18:23:24 +00:00
tilghman 9cc6c9ed4f Merged revisions 61683 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61683 | tilghman | 2007-04-18 23:36:20 -0500 (Wed, 18 Apr 2007) | 2 lines

Bug 9557 - simple reason why reading a function always returned NULL

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61684 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-19 04:37:29 +00:00
tilghman c58ebc051c Issue 6082 - New DTMF event for manager
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61324 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-10 23:55:26 +00:00
oej 7abb4e9065 Add hint to ExtensionStatus AMI event in manager
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61021 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-09 19:05:40 +00:00
russell fe453b5ef2 Merged revisions 60603 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r60603 | russell | 2007-04-06 15:58:43 -0500 (Fri, 06 Apr 2007) | 13 lines

To be able to achieve the things that we would like to achieve with the
Asterisk GUI project, we need a fully functional HTTP interface with access
to the Asterisk manager interface.  One of the things that was intended to be
a part of this system, but was never actually implemented, was the ability for
the GUI to be able to upload files to Asterisk.  So, this commit adds this in
the most minimally invasive way that we could come up with.

A lot of work on minimime was done by Steve Murphy.  He fixed a lot of bugs in
the parser, and updated it to be thread-safe.  The ability to check
permissions of active manager sessions was added by Dwayne Hubbard.  Then,
hacking this all together and do doing the modifications necessary to the HTTP
interface was done by me.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@60604 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-06 21:16:38 +00:00
russell 05fda0428c Merged revisions 60137 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r60137 | russell | 2007-04-04 12:40:10 -0500 (Wed, 04 Apr 2007) | 14 lines

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

........
r60134 | russell | 2007-04-04 12:38:47 -0500 (Wed, 04 Apr 2007) | 6 lines

It is valid to redirect channels via the manager interface that are not in the
UP state.  Instead of checking for that to prevent to ensure a dead channel
doesn't get redirected, just use the ast_check_hangup() API call.
(issue #9457, reported by Callmewind, patch by me)
(related to issue #8977)

........

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


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@60141 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-04 17:41:37 +00:00
russell 59144ac097 Merged revisions 58165 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r58165 | russell | 2007-03-06 18:25:19 -0600 (Tue, 06 Mar 2007) | 12 lines

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

........
r58164 | russell | 2007-03-06 18:20:13 -0600 (Tue, 06 Mar 2007) | 4 lines

If the channels acquired using the manager Redirect action are not up, then
don't attempt to do anything with them.  It could lead to weird behavior,
including crashes.  (issue #8977)

........

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


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@58166 f38db490-d61c-443f-a65b-d21fe96a405b
2007-03-07 00:26:01 +00:00
oej 2c162efa7e Doxygen updates and corrections
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@56648 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-24 19:49:11 +00:00
russell 8251ec7eac Introduce a new manager action, GetConfigJSON, which is intended to improve
performance of the GUI.  This encodes the configuration into the JSON format
in a manager header, "JSON: ".  The encoded information can be directly used
as a javascript object, so no parsing is needed.  For large configuration
files, this can greatly improve loading times in the GUI. Furthermore, the 
encoding takes up a lot less space when being transmitted than the other 
alternatives.  (Inspired by discussion with Pari)

Here is an example of what you get:
http://localhost:8088/asterisk/rawman?action=getconfigjson&filename=users.conf

Response: Success
JSON: {"general":["hasvoicemail=yes"],"6000":["fullname=russell","secret=1234"]}


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@56323 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-23 00:45:04 +00:00
file 01c1553ffd Properly handle an error result from a manager action. This could have left the action list permanently locked for reading.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@54711 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-16 00:10:17 +00:00
oej 18b268814d New CLI command "Core show settings" to list some core settings
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@54464 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-14 20:22:20 +00:00
file 1e80cfd061 It is with pleasure that I announce the return of rawman support through the HTTP server. (issue #9013 reported by Jynger)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@53635 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-08 20:39:41 +00:00
tilghman aaaa855c7d Merged revisions 53246 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r53246 | tilghman | 2007-02-06 01:00:52 -0600 (Tue, 06 Feb 2007) | 10 lines

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

........
r53245 | tilghman | 2007-02-06 00:58:28 -0600 (Tue, 06 Feb 2007) | 2 lines

Issue 8987 - Status could return two responses (mnicholson)

........

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


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@53247 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-06 07:07:22 +00:00
russell ee25f98f93 Merged revisions 53046 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r53046 | russell | 2007-01-31 15:32:08 -0600 (Wed, 31 Jan 2007) | 11 lines

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

........
r53045 | russell | 2007-01-31 15:25:11 -0600 (Wed, 31 Jan 2007) | 3 lines

Fix a bunch of places where pthread_attr_init() was called, but
pthread_attr_destroy() was not.

........

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


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@53047 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-31 21:35:15 +00:00
russell e5b89f157d Merged revisions 52688 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r52688 | russell | 2007-01-29 16:55:41 -0600 (Mon, 29 Jan 2007) | 3 lines

Remove a recursive lock of the manager session.  This was pointed out by 
zandbelt in issue #8711.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@52692 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-29 22:57:16 +00:00
russell 2206f4e9bc The changes for trunk are less extensive, but include
- changing the actionlock to a rwlock
 - not locking the session before doing the action callback
The crash issue in 8711 should not be an issue here.


Merged revisions 52611 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r52611 | russell | 2007-01-29 14:39:20 -0600 (Mon, 29 Jan 2007) | 10 lines

The session lock can not be held while calling action callbacks.  If so, then
when the WaitEvent callback gets called, then no event can happen because the
session can't be locked by another thread.  Also, the session needs to be
locked in the HTTP callback when it reads out the output string.  This fixes
the deadlock reported in both 8711 and 8934.
Regarding issue 8711, there still may be an issue.  If there is a second action
requested before the processing of the first action is finished, there could
still be some corruption of the output string buffer used to build the result.
(issue #8711, #8934)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@52613 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-29 20:51:24 +00:00
file 7658155245 Close file after we do the translation, and map memory for both reading/writing. (issue #8886 reported by cwegener)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51831 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-24 00:22:50 +00:00
russell 15e3b6e0c0 Merged revisions 51781 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r51781 | russell | 2007-01-23 16:04:01 -0600 (Tue, 23 Jan 2007) | 6 lines

Fix some bugs in process_message().  The manager session lock needs to be held
when sending some sort of response, or calling one of the manager action
callbacks.  This resolves an issue where people using the GUI would get random
crashes when they start clicking around a lot.
(issue #8711, reported and debugged by zandbelt)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51787 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-23 22:09:23 +00:00
russell 70089450f1 Merged revisions 51750 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r51750 | russell | 2007-01-23 15:33:15 -0600 (Tue, 23 Jan 2007) | 4 lines

When traversing the list of manager actions, the iterator needs to be
initialized to the list head *after* locking the list.  Also, lock the actions
list in one place it is being accessed where it was not being done.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51751 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-23 21:38:31 +00:00
russell 2da13ceac8 Break out of the config processing loop for manager.conf once the correct user
has been found so that 'cat' is non-NULL.  This way, users.conf is only checked
when necessary.  (issue #8852, akohlsmith, committed patch a bit different)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51296 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-19 16:30:00 +00:00
russell 6d94715209 Fix trunk version of manager support for users.conf. Now it actually pays
attention to the "hasmanager" option.

(Thanks to Anthony L. for pointing out that this was broken!)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51247 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-18 18:54:51 +00:00
russell f0963f006f Merged revisions 51233 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r51233 | russell | 2007-01-18 11:18:43 -0600 (Thu, 18 Jan 2007) | 3 lines

Make the "hasmanager" option in users.conf actually have an effect.
(issue #8740, LnxPrgr3)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@51234 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-18 17:33:33 +00:00
file 96d205289a Merged revisions 50895 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r50895 | file | 2007-01-15 11:36:07 -0500 (Mon, 15 Jan 2007) | 2 lines

Move event processing into do_message so that it gets executed again when events are tripped.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@50896 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-15 16:40:48 +00:00
file 451d1a2d55 Exit from session loop upon error (ie: they disconnected) and don't do any buffer manipulation in do_message. get_input will handle it.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@50629 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-12 18:13:50 +00:00
file 9b1dfc49c6 Merged revisions 50602 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r50602 | file | 2007-01-12 11:42:33 -0500 (Fri, 12 Jan 2007) | 2 lines

We need to check for res being 0 in do_message itself, otherwise our headers will get lost.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@50603 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-12 16:47:20 +00:00
kpfleming 28749c0589 probably shouldn't leave the mmap'ed file hanging around in memory
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49735 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-06 00:02:06 +00:00
kpfleming 717d699a13 a little more const-ification
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49727 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-05 23:58:53 +00:00
kpfleming a037fd277b Merged revisions 49680 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r49680 | kpfleming | 2007-01-05 16:52:37 -0600 (Fri, 05 Jan 2007) | 2 lines

don't 'consume' the params list before we try to use it again

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49681 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-05 22:53:38 +00:00
kpfleming 56867dba7a use mmap() to read in the results of the manager action for an HTTP request, instead of reading it into a buffer
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49679 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-05 22:52:16 +00:00
kpfleming d8e7fcf209 Merged revisions 49676 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r49676 | kpfleming | 2007-01-05 16:16:33 -0600 (Fri, 05 Jan 2007) | 2 lines

reduce stack consumption for AMI and AMI/HTTP requests by nearly 20K in most cases

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49678 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-05 22:43:18 +00:00
file a3df7ad6e7 It's pretty difficult to pthread_kill a thread that doesn't exist. (issue #8681 reported by bkruse)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49525 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-04 21:40:54 +00:00
oej f90683f775 Fix manager too.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49094 f38db490-d61c-443f-a65b-d21fe96a405b
2007-01-01 19:52:22 +00:00
kpfleming 87686ce875 Merged revisions 49006 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r49006 | kpfleming | 2006-12-27 16:06:56 -0600 (Wed, 27 Dec 2006) | 2 lines

since these variables all have static duration, none of them need initializers (they default to zero anyway)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@49008 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-27 22:14:33 +00:00
russell 67180e39b0 Remove a debug message. If this is still needed for debugging something,
it should be made a LOG_DEBUG message.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48929 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-23 20:08:16 +00:00
rizzo ff385b4aa1 Replace ast_build_string with ast_str_*().
On passing remove presumably duplicate code to generate
the message for the manager_hooks:

in the previous version, the message was almost the same as the one sent
to regular sessions, with the exception of the empty line at the end, and
a few (presumably unintentional) differences e.g.  timestamps,
debugging, and lowercase headers for "event" and "privilege".

now we reuse the same message as before.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48553 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-18 11:28:37 +00:00
rizzo 9ad774382a replace ast_build_string() with ast_str_*() functions.
This makes the code easier to follow and saves some
copies to intermediate buffers.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48515 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-16 09:33:31 +00:00
rizzo b68b240ef8 simplify the ast_dynamic_str_*.... routines by
renaming them to ast_str ... and putting the
struct ast_threadstorage pointer into the struct ast_str.

This makes the code a lot more readable.

At this point we can use these routines also to
replace ast_build_string().



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48510 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-15 23:10:42 +00:00
rizzo 8388c27928 unbreak the output for http session.
Not long ago i replaced lseek() with fseek() but
forgot that filr FILE's you need ftell to
give you the current position.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48501 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-15 18:37:29 +00:00
rizzo bf611f9cef properly initialize a malloc'ed buffer
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48410 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-12 10:36:15 +00:00
rizzo c60f8b61af normalize the scanning of "general" options in the config file.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48409 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-12 10:35:10 +00:00
rizzo fcafc05f7e make sure the argument to ast_malloc() is > 0.
Long explaination:

The behaviour of the underlying malloc(0) differs depending on the
operating system.  Some return NULL (SysV behaviour); some still
allocate a small chunk of memory and return a valid pointer (e.g.
traditional BSD); some (e.g. FreeBSD 6.x) return a non-null pointer
that causes a memory fault if used, even just for reading.

Given the above variety, better never call malloc(0).



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48389 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-11 18:11:58 +00:00
rizzo fa3680b882 - Generalize the function ssl_setup() so that the certificate info
are passed as an argument.

- Update the code in main/http.c to use the new interface
  (the diff is large but mostly mechanical, due to the name change of
  several variables);

- And since now it is trivial, implement "AMI over TLS", and document
  the possible options in manager.conf

- And since the test client (openssl s_client -connect host:port )
  does not generate \r\n as a line terminator, make get_input()
  also accept just a \n as a line terminator (Mac users: do you
  also need the \r-only version ?)
 
The option parsing in manager.conf is not very efficient, and needs
to be cleaned up and made similar to what we have in http.conf



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48351 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-07 16:42:29 +00:00
murf 6e7bc03957 Merged revisions 47986,47995,47997,48001,48003-48004,48008-48014,48016,48018-48019 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r47986 | oej | 2006-11-24 07:00:19 -0700 (Fri, 24 Nov 2006) | 6 lines

Doxygen update
- Document cause codes
- Document a bit more on channel variables - global, predefined and local
- Fix some doxygen in channel.h. Adding one comment for two definitions does not
  work. They won't be copied to each.

................
r47995 | murf | 2006-11-24 10:40:49 -0700 (Fri, 24 Nov 2006) | 1 line

This fix inspired by a patch supplied in bug 8189, which points out problems with the PLC code
................
r47997 | murf | 2006-11-24 11:17:25 -0700 (Fri, 24 Nov 2006) | 1 line

removed the svnmerge-integrated property from trunk; it's confusing svnmerge in newly created branches
................
r48001 | rizzo | 2006-11-25 02:02:42 -0700 (Sat, 25 Nov 2006) | 5 lines

set pointers to NULL after freeing memory to avoid multiple free()

probably 1.4/1.2 issue as well if someone can look into that.


................
r48003 | oej | 2006-11-25 02:45:57 -0700 (Sat, 25 Nov 2006) | 9 lines

- Adding comment on suspicious memory allocation. Seems like it's never freed, but I don't
  have a clear understanding of the frame allocation/deallocation, so I just mark this
  for investigation. (Reported by Ed Guy). We're trying to see if a free() hurts...

- Doxygen comments on p2p rtp bridge stuff.  I am a bit worried about shortcutting
  rtcp this way, but will need feedback from rtcp gurus. This should work for 
  video calls too, and possibly UDPTL.


................
r48004 | oej | 2006-11-25 02:48:30 -0700 (Sat, 25 Nov 2006) | 2 lines

Changing ERROR to lesser level. Imported from 1.2/1.4

................
r48008 | rizzo | 2006-11-25 10:37:04 -0700 (Sat, 25 Nov 2006) | 7 lines

generalize a bit the functions used to create an tcp socket
and then run a service on it.
The code in manager.c does essentially the same things,
so we will be able to reuse the code in here (probably
moving it to netsock.c or another appropriate library file).


................
r48009 | mattf | 2006-11-25 13:30:04 -0700 (Sat, 25 Nov 2006) | 1 line

Updates to show linkset command
................
r48010 | mattf | 2006-11-25 13:54:38 -0700 (Sat, 25 Nov 2006) | 2 lines

Add ss7 show linkset command

................
r48011 | mattf | 2006-11-25 14:32:33 -0700 (Sat, 25 Nov 2006) | 1 line

Make sure we don't send a group reset on a group larger than 32 CICs
................
r48012 | mattf | 2006-11-25 14:35:23 -0700 (Sat, 25 Nov 2006) | 1 line

bug fix
................
r48013 | mattf | 2006-11-25 14:46:58 -0700 (Sat, 25 Nov 2006) | 1 line

Make compiler happier
................
r48014 | mattf | 2006-11-25 14:50:42 -0700 (Sat, 25 Nov 2006) | 1 line

Little fix so we use the right message
................
r48016 | murf | 2006-11-25 17:15:42 -0700 (Sat, 25 Nov 2006) | 9 lines

Merged revisions 48015 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48015 | murf | 2006-11-25 17:01:34 -0700 (Sat, 25 Nov 2006) | 1 line

A little bit of func_cdr documentation upgrade-- no bug# involved, although 8221 may have inspired it.
........

................
r48018 | murf | 2006-11-25 17:31:13 -0700 (Sat, 25 Nov 2006) | 9 lines

Merged revisions 48017 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48017 | murf | 2006-11-25 17:26:16 -0700 (Sat, 25 Nov 2006) | 1 line

might as well also document the raw values of the flag vars
........

................
r48019 | russell | 2006-11-25 23:55:33 -0700 (Sat, 25 Nov 2006) | 6 lines

- Add some comments on thread storage with a brief explanation of what it is
  as well as what the motivation is for using it.
- Add a comment by the declaration of ast_inet_ntoa() noting that this function
  is not reentrant, and the result of a previous call to the function is no
  longer valid after calling it again.

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


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48350 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-07 16:03:56 +00:00
rizzo dcc00a652f remove duplicated code to start the server threads, use
the infrastructure exposed in http.c earlier today.

As a bonus, now we can restart the session on a different
port just reloading the module.

On passing, fix a bug in the handling of 'enabled' in the configuration
file - previously, a missing "enabled=" line in manager.conf meant
"whatever the state was before" instead of a specific value.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48338 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-06 20:46:01 +00:00
rizzo 4b06443b14 Part of the transformations necessary to add TLS support,
as described in
http://lists.digium.com/pipermail/asterisk-dev/2006-December/025213.html

In detail, this commit does the following:

b) change the function get_input() to use fread() instead of read()
   to collect the data. One can still do the ast_wait_for_input() on
   the original descriptor returned by accept().

c) change the function send_string() to work on the FILE *.
   As a side effect, this change now really guarantees that
   we don't spend more than "writetimeout" milliseconds on
   each line sent.

d) modify the function action_command() so that it creates a
   temporary file descriptor to be passed to ast_cli_command(),
   and then read back the data from the temp file and write it
   to the output with send_string(). The code is similar to
   what is done in generic_http_callback() to support AMI-over-HTTP.




git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48332 f38db490-d61c-443f-a65b-d21fe96a405b
2006-12-06 18:45:19 +00:00
rizzo b507cb90af don't use outputstr in the struct mansession, it's just
an extra allocation on a path where we have way too many already.

Unfortunately the AMI-over-HTTP requires multiple copies,
because we need to generate a header, then the raw output to
an intermediate buffer, then convert it to html/xml, and
finally copy everything into a malloc'ed buffer because
that's what the generic_http_callback interface expects.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48090 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 17:08:19 +00:00
rizzo 41ac55742c initialize the dynamic string in a sane way.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48086 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 15:53:12 +00:00
rizzo a522c1ce0f do not return 500 Internal error if the AMI command provides
no output.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48083 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 13:08:56 +00:00
rizzo 062fee49d6 mosty comment and documentation cleanup on waitevent.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48082 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 12:05:25 +00:00
rizzo bdf4f81f22 Move the code to purge stale sessions to a function,
to simplify the body of the main loop of the accepting thread.
Rename purge_unused() to purge_events() so one knows what the
function does.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48081 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 11:20:39 +00:00
rizzo 917af9ad51 Various simplifications of the code:
+ use a wrapper around ast_carefulwrite(), used in two places,
  to make life easier when we decide to use a different interface
  to the socket.

+ put an ast_verbose() message on astman_append on a case that
  should never happen now that we use a temporary file for
  AMI-over-HTTP sessions

+ document and slightly simplify process_events() by removing
  unnecessary parentheses.

+ in get_input(), use ast_wait_for_input() instead of poll().

  We may want to move to a completely non-blocking


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48080 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 10:23:25 +00:00
rizzo 30830453fb More informative message on invalid commands.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48079 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 09:43:44 +00:00
rizzo 8cc315343f another normalization of AMI vs HTTP identification.
Should really define a macro IS_AMI(s) so it is clear what
we want to do.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48078 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 09:39:16 +00:00
rizzo e8f45989fe always use managerid to determine whether this is an AMI or HTTP session,
and document it.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48077 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-28 09:27:37 +00:00
markster 47f912f6e6 Restore some sense of security to manager
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47912 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-22 05:49:06 +00:00
rizzo 35b5ab3bc1 comments-only change:
document a bit more when manager events are delivered
to the clients.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47834 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-18 22:14:20 +00:00
file fd703bef54 Add support for manager hooks, so you could fire off manager events over IRC if you were crazy enough. (issue #5161 reported by anthm with mods by moi)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47229 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-06 17:05:04 +00:00
rizzo 3094fdaa97 add a new cli/manager.conf option "debug" to enable/disable
debugging code in the manager.
At the moment the debugging code is very lightweight, if the option
is enabled manager messages also carry a sequence number and
the info where they have been generated e.g.

SequenceNumber: 10
File: chan_sip.c
Line: 11927
Func: handle_response_register

It is not worthwhile having this as a compile time option
right now, because the extra work involved at runtime is
just checking one variable.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47132 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-03 18:53:26 +00:00
tilghman 278341b071 Merged revisions 47051 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r47051 | tilghman | 2006-11-02 17:00:20 -0600 (Thu, 02 Nov 2006) | 2 lines

Reverse change of "show" to "list" and make several other commands more consistent with "category verb arguments"

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@47052 f38db490-d61c-443f-a65b-d21fe96a405b
2006-11-02 23:16:09 +00:00
russell d67754f068 Fix the new send text manager command. There is no way this could have worked.
- Check the channel name string length to be zero, not non-zero
- Check the message string length to be zero, not non-zero
- unlock the channel *after* calling sendtext


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46661 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-31 15:22:28 +00:00
oej dac4a9956e Add manager sendtext action. (Issue 6131, ZX81 - thanks!)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46630 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-31 10:42:22 +00:00
oej f171dba1a0 Issue #3930 - Add manager command for listing dialplan (coded april 2005, in bugtracker since)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46508 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-30 21:18:39 +00:00
russell b1b9710998 fix various spelling mistakes in comments (issue #8237, jmls)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46339 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-26 17:52:15 +00:00
rizzo 88fc4c588b fix a problem that i recently introduced when
the manager receives long commands.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46319 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-26 12:47:23 +00:00
markster 6e270f0ae8 Fix comment preservation code (thanks murf!)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46288 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-26 01:38:47 +00:00
rizzo 2e548a50d5 i really think it is safe to commit this version, that
simplifies the manager queue handling as described in
the comment, and will make a lot easier to make further
work on this code.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46120 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-24 17:14:12 +00:00
rizzo 5e167d54c8 minor comment changes, code rearrangement and field renaming
to minimize diffs with future modifications.

The current implementation is problematic for the following reasons:
+ all insertions are O(N) because the event list does not have a tail
  pointer;
+ there is only a single lock protecting both session and users queues.
+ the implementation of the queue itself is not documented.
  I think i have figured it out, more or less, but am unclear on
  whether there is proper locking in place

The rewrite (which i have working locally) uses a tailq so insertions
are O(1), separate locks for the event and session queues, and has
a documented implementation so hopefully we can figure out if/where
bug exist.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45753 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-20 11:24:43 +00:00
oej bc7883b922 Doxygen corrections
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45742 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-20 08:00:13 +00:00
rizzo 9fc4cf6980 more fixes to comments and very minor code rearrangement.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45696 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-19 17:26:20 +00:00
rizzo 96167b391b implement proper XML/HTML formatting of multiple messages
(e.g. the result of waitevent).

Also fix some comments.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45690 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-19 17:07:08 +00:00
rizzo cc60583cb6 more documentation of data structure and functions.
Of interest:
+ ast_get_manager_by_name_locked() is now without the ast_
  prefix as it is a local function;

+ unuse_eventqent() renamed to unref_event(), and returns
  the pointer to the next entry.

+ marked with XXX a couple of usages of unref_event()
  because i suspect we are addressing the wrong entry.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45648 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-19 07:43:43 +00:00
russell 21cbb8bb68 Extend the thread storage API such that a custom initialization function can
be called for each thread specific object after they are allocated.  Note that
there was already the ability to define a custom cleanup function.  Also, if
the custom cleanup function is used, it *MUST* call free on the thread
specific object at the end.  There is no way to have this magically done that
I can think of because the cleanup function registered with the pthread
implementation will only call the function back with a pointer to the
thread specific object, not the parent ast_threadstorage object.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45623 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-19 01:00:57 +00:00
rizzo 6a1a45a520 silent warning from a debugging message (which will go away
soon, anyways)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45611 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 22:40:02 +00:00
rizzo fb300e0612 remove trailing whitespace
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45599 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 21:41:09 +00:00
rizzo d68ba2d09f ouch! remember to unlink temporary files once done with them.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45598 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 21:36:20 +00:00
rizzo 93784d6aba + move output_format variables in the http section of the file;
+ more comments on struct mansession and global variables;
+ small improvements to the session matching code so it supports
  multiple sessions from the same IP



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45597 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 21:30:21 +00:00
rizzo 90c480f49d another bunch of comments on the data structures.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45583 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 17:53:47 +00:00
rizzo 713b6b817a despite the large changes, this commit only moves functions
around so that functions belonging to the same group are
close to each other.

At the beginning of each group i have added a bit of documentation
to explain what the group does and what is the typical flow - basically,
all i have learned by code inspection over the past few days should
be documented for you to read.

I have not put many doxygen annotations just because i am not
sure what are the proper ones. Hopefully some doxygen experts will jump in.

Next on the plate: try to figure out how "struct eventqent"
are supposed to work.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45582 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 17:45:50 +00:00
rizzo 78cdd30eba more comment and formatting fixes, small simplifications
to functions get_input() and session_do()



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45572 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 16:52:13 +00:00
mogorman da8aef1fc3 rizzo compile then commit, maybe even run it too ^_^
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45571 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 16:45:22 +00:00
rizzo 13dc47f57d comment and cleanup the main thread.
On passing, fix a bug: close the socket if the allocation
of a structure for the new session fails.
(the bugfix is a candidate for 1.4)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45561 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 15:49:40 +00:00
rizzo fdb5962fae create a new (internal, for the time being) function astman_start_ack()
to start manager responses that need further lines.
This removes a lot of duplicate code from the various handlers
that at the moment build an ActionID string themselves.

Once settled, the function should move to manager.h so
it can be used by other files (chan_agent, chan_iax2, chan_sip,
chan_zap, res_jabber and app_queue).

I am not totally clear if there is a preferred position for
the ActionID: line in a message. Some instances put it at
the end, but one would argue that it is preferable to have
it at the beginning.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45551 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 14:21:15 +00:00
rizzo 59bee9954d more indentation cleanup from previous commits,
and remove the "busy" field from struct mansession
as it was not used correctly anyways.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45541 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 13:42:14 +00:00
rizzo 67fc1bcd75 create proper handlers for "Challenge" and "Login" actions,
rather than use inline code for them.
Things are more readable this way, and also error processing
is more consistent.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45540 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 13:23:22 +00:00
rizzo 2a74685732 fix indentation from a commit of a couple of days ago
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45530 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 12:55:12 +00:00
rizzo 18827b8ac3 another batch of simplifications to authenticate()
(they are committed a bit at a time so it is easier to
revert them in case we find a bug at a later time).



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45529 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 12:38:24 +00:00
rizzo 3933708d51 remove unused fields and unimplemented options.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45518 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 11:59:08 +00:00
rizzo 440510b692 first pass as simplifying authenticate(), avoiding whitespace changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45516 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 11:54:06 +00:00
rizzo fbe8d94965 more code simplifications
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45515 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 11:43:31 +00:00
rizzo ab2bb64d8a simplify ast_strings_to_mask
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45505 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 10:14:58 +00:00
rizzo 22d613b827 add a comment to remember that a block of code is
completely redundant.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45495 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 08:48:50 +00:00
rizzo 155fe80952 + move the enum declaration for output formats near the head
of the file, so it can be used from more places;
+ make the declaration of contenttype[] more robust;
+ remove the wrappers around __xml_translate(), since they were
  used only in one place, and rename to xml_translate().
  This allows for a bit of simplifications.
+ document the output produced by the above function.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45485 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 06:28:34 +00:00
rizzo 519206a7ef merge xml_translate() and html_translate() into one function since
they do similar things.

Add a small form on top of the html output so request like
http://foo:8088/asterisk/manager will suggest you what to do.

Note: i suspect there is still a bug somewhere in the session matching
code, as sometimes you have to login twice in order for the following
commands to be recognised.

Apart from this, the cli now is basically usable from a web form!



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45475 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-18 05:31:54 +00:00
file b31277825f Warning be gone!
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45398 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 21:09:49 +00:00
rizzo 7813852f07 simplify authority_to_str() using ast_build_string()
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45351 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 18:08:51 +00:00
rizzo 04aba2dbed Improve the XML formatting of responses coming from web interface.
Normal responses are sequences of lines of the form "Name: value",
with \r\n as line terminators and an empty line as a response
terminator.

Generi CLI commands, however, do not have such a clean formatting,
and the existing code failed to generate valid XML for them.
Obviously we can only use heuristics here, and we do the following:
- accept either \r or \n as a line terminator, trimming trailing whitespace;
- if a line does not have a ":" in it, assume that from this point on
  we have unformatted data, and use "Opaque-data:" as a name;
- if a line does have a ":" in it, the Name field is not always
  a legal identifier, so replace non-alphanum characters with underscores;

All the above is to be refined as we improve the formatting of
responses from the CLI.

And, all the above ought to go as a comment in the code rather than
just in a commit message...
  


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45334 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 17:51:34 +00:00
rizzo 2e31cdbf7e open a temporary file to receive the output from cli commands
invoked through the http interface.

It is not terribly efficient but better than no output at all.
Todo: use a configurable /tmp directory instead of a hardwired one.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45330 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 17:41:59 +00:00
rizzo 7673e5c24a document xml_copy_escape() and add an extra function, namely
replace non-alphanum chars with underscore.
This is useful when building field names in xml formatting.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45325 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-17 17:19:31 +00:00
rizzo ec8004ac16 + comment some unclear fields of struct mansession;
+ let some commands (Challenge, Login) be processed even if
  already authenticated, as it doesn't harm and prevents some
  incorrect error messages

+ remove custom code for Logoff - the existing handler was ok.

Some indentation fixes may be necessary



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45219 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-16 14:00:53 +00:00
rizzo 661ccc5d4b + comment some unclear requirements for master_eventq
+ remove the need for an snprintf in astman_get_header()
+ fix comment for manager list eventq
+ localize one variable and minor code simplifications.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45185 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-16 11:29:22 +00:00
rizzo 2f69cfdbe4 protect access to first_action with actionlock.
Mark with XXX one place (during command execution) where
navigation should be protected with actionlock, but is not
because it would block requests for a long time.

To solve this properly we need to put reference counts in
the struct manager_action.
A suboptimal fix is to copy the record on a search and then
unlock the list while we work on the copy.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45177 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-16 09:33:00 +00:00
russell aabdfc585b Merged revisions 44945 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44945 | russell | 2006-10-12 12:56:32 -0400 (Thu, 12 Oct 2006) | 2 lines

fix a silly typo in a comment that I saw while reading the commit list

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44946 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-12 16:57:36 +00:00
nadi 9f77d518ea Merged revisions 44921 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44921 | nadi | 2006-10-12 14:55:25 +0200 (Do, 12 Okt 2006) | 2 lines

append_event must be called while holding the session lock

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44922 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-12 13:04:03 +00:00
rizzo fea07f8eea basically fix indentation of a large function after previous
simplifications. On passing, use a single exit point.

(once done with the cleanup i will merge the changes into 1.4,
if applicable)



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44626 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-06 21:04:43 +00:00
rizzo 6e5dda36f5 s cannot be null here, so remove the useless test and error-handling block.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44617 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-06 20:34:11 +00:00
rizzo 1a51660834 simplify logic in preparation to reduce indentation
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44616 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-06 20:16:13 +00:00
rizzo d70733010d make sure sockets are blocking when they should be blocking.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44568 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-06 15:59:57 +00:00
kpfleming 1a08d9e31b Merged revisions 44378 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r44378 | kpfleming | 2006-10-04 14:47:22 -0500 (Wed, 04 Oct 2006) | 4 lines

update thread creation code a bit
reduce standard thread stack size slightly to allow the pthreads library to allocate the stack+data and not overflow a power-of-2 allocation in the kernel and waste memory/address space
add a new stack size for 'background' threads (those that don't handle PBX calls) when LOW_MEMORY is defined

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44379 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-04 19:51:38 +00:00
mogorman 4a1aaf52ae bug #8076 check option_debug before printing to debug channel.
patch provided in bugnote, with minor changes.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@44253 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-03 15:53:07 +00:00
tilghman 33d8fe4c3e Remove deprecated CLI apps from the core
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43449 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-21 21:17:39 +00:00
tilghman c8a470374f Remove 1.4 changes from UPGRADE.txt, remove deprecated callerid field, remove deprecated SetGlobalVar app
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43444 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-21 20:01:54 +00:00
tilghman e8ef9fd3ba Constify the result of a config retrieval function, to avoid mutilation (issue 7983).
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43364 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-20 20:40:39 +00:00
qwell 3a260bee7e Commit the changes from issue #5240.
Original patch by junky, modified by anthonyl, modified again by jcolp (with minor modifications by me)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43300 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-19 22:01:23 +00:00
qwell 46e384f88c After discussing this with other people, we decided we'd like to try to do this a little differently.
Stay tuned.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43290 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-19 19:58:09 +00:00
anthonyl ff5e99c7e0 5240 update
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43289 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-19 19:28:57 +00:00
kpfleming 5aacb6a82d merge qwell's CLI verbification work
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43212 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-18 19:54:18 +00:00
kpfleming 5c0e56df21 merge markster's usersconf branch with some slight changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43052 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-16 23:53:58 +00:00
russell f0779c48bc - simplify and improve astmm by using thread storage instead of a dynamic
allocation and free on every call of the function for preparing the string
  that will be appended.  Then, use the ast_dynamic_str() code instead of the
  open coded version that is appended to when waiting for it to be delivered.
- use for loops for list traversals
- convert the manager sessions list to use list macros
- use atomic operations for num_sessions and usecounts
- convert some defines to the equivalent enum


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40783 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21 19:42:29 +00:00
kpfleming 8b0c007ad9 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: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21 02:11:39 +00:00