Commit Graph

223 Commits

Author SHA1 Message Date
Olle Johansson 11d00cac15 Adding dialplan function IFMODULE, so you can create dialplans that handle
various PBX installations and checks if a module is loaded before using
it.
	example IFMODULE(chan_sip3.so)

issue #6671 in the bug tracker, finally gone. Thanks to mithraen for keeping
it updated.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46513 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-30 21:48:41 +00:00
Olle Johansson 692dc8fd80 Issue #3930 - Add manager command for listing dialplan (coded april 2005, in bugtracker since)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46508 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-30 21:18:39 +00:00
Olle Johansson 2cb07fbaa4 In debug mode, recognize that someone is sending zrtp, even though we
can't do anything with it yet. Ideally a first step would be a 
passthrough mode.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46439 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-30 16:59:02 +00:00
Olle Johansson 8a2e564df5 Issue 8246 Doxygen updates (kshumard)
THANK YOU!



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46434 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-30 16:33:02 +00:00
Olle Johansson 829f2c895d Small formatting changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46410 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-29 20:47:01 +00:00
Olle Johansson 52a5d63a2d Bind RTCP to the same IP as RTP.
I currently don't see this as a bug that needs to be fixed in 1.4/1.2 too,
but feel free to backport if you see it that way. RTCP now binds to
ALL IP addresses on the host, RTP to a specific address.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-29 20:21:33 +00:00
Russell Bryant 4337a82563 Merged revisions 46363 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46363 | russell | 2006-10-27 12:39:31 -0500 (Fri, 27 Oct 2006) | 5 lines

We should always be using _exit() after a fork() or vfork() instead of exit().
This is because exit() does some extra cleanup which in some implementations
of vfork(), for example, can actually modify the state of the parent process,
causing very weird bugs or crashes.  (issue #7971, Nick Gavrikov)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-27 17:42:57 +00:00
Russell Bryant 0ca6a42d7e fix various spelling mistakes in comments (issue #8237, jmls)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46339 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-26 17:52:15 +00:00
Russell Bryant 192a93aa37 Merged revisions 46329 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46329 | russell | 2006-10-26 11:31:05 -0500 (Thu, 26 Oct 2006) | 11 lines

- If the source has no audio or no video portion, do not call powerof() to
  get the format index.
- Don't run through the audio and video loops if there is no audio or video
  portion of the source
If 0 is passed to powerof, it will return -1.  This value of -1 was then being
used as an array index in these loops, which caused a crash on some systems.
Other than this issue, this code works as we expected it to.  If a format is
not in the source, and we have to translation path to it, it is not offered in
the list of acceptable destination formats.
(fixes issue #8231)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46330 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-26 16:35:34 +00:00
Luigi Rizzo 6b2b63a909 fix a problem that i recently introduced when
the manager receives long commands.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46319 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-26 12:47:23 +00:00
Mark Spencer b7517f1231 Fix comment preservation code (thanks murf!)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-26 01:38:47 +00:00
Kevin P. Fleming 5f5faa310a Merged revisions 46082-46083,46152-46153 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46082 | kpfleming | 2006-10-23 22:45:42 -0500 (Mon, 23 Oct 2006) | 2 lines

add an API call to allow channel drivers to determine which media formats are compatible (passthrough or transcode) with the format an existing channel is already using

........
r46083 | kpfleming | 2006-10-23 22:53:32 -0500 (Mon, 23 Oct 2006) | 2 lines

ensure that the translation matrix is properly lock-protected every place it is used

........
r46152 | kpfleming | 2006-10-24 18:45:19 -0500 (Tue, 24 Oct 2006) | 2 lines

if multiple translators are registered for the same source/dest combination, ensure that the lowest-cost one is always inserted earlier in the list

........
r46153 | kpfleming | 2006-10-24 19:10:54 -0500 (Tue, 24 Oct 2006) | 2 lines

code zone experiment: don't offer formats in the outbound INVITE that aren't either passthrough or translatable

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46203 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-25 14:55:11 +00:00
Kevin P. Fleming 749029de38 Merged revisions 46200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46200 | kpfleming | 2006-10-25 09:32:08 -0500 (Wed, 25 Oct 2006) | 2 lines

apparently developers are still not aware that they should be use ast_copy_string instead of strncpy... fix up many more users, and fix some bugs in the process

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46201 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-25 14:44:50 +00:00
Kevin P. Fleming 88efcea05e Merged revisions 46154 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46154 | kpfleming | 2006-10-24 19:26:17 -0500 (Tue, 24 Oct 2006) | 2 lines

add passthrough and file format support for G.722 16KHz audio (issue #5084, original patch by andrew, updated by mithraen)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46155 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-25 00:32:23 +00:00
Luigi Rizzo a7d5fcd8b8 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: https://origsvn.digium.com/svn/asterisk/trunk@46120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-24 17:14:12 +00:00
Tilghman Lesher a8d3ee89c6 Merged revisions 46078 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r46078 | tilghman | 2006-10-23 22:01:00 -0500 (Mon, 23 Oct 2006) | 3 lines

Pass through a frame if we don't know what it is, rather than trying to pass a
NULL, which will segfault a channel driver (Bug 8149)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46079 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-24 03:09:48 +00:00
Luigi Rizzo 9bbf557dfb use autodetected support for gethostbyname_r
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45989 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-23 16:54:54 +00:00
Luigi Rizzo c15f7953c8 Fix a few issues in the previous (disabled) HTTPS code,
and support linux as well (using fopencookie(), which should
be available in glibc).

Update configure.ac to check for funopen (BSD) and fopencookie(glibc),
and while we are at it also for gethostbyname_r
(the generated files need to be updated, or you need
to run bootstrap.sh yourself).

Document the new options in http.conf.sample
(names are only tentative, better ones are welcome).

At this point we can safely enable the option.
Anyone willing to try this on Sun and Apple platforms ?



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45892 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-22 19:09:25 +00:00
Luigi Rizzo e8a65b7155 Implement https support.
The changes are not large. Most of the diff comes from putting the
global variables describing an accept session into a structure, so
we can reuse the existing code for running multiple accept threads
on different ports.

Once this is done, and if your system has the funopen() library
function (and ssl, of course), it is just a matter of calling
the appropriate functions to set up the ssl connection on the
existing socket, and everything works on the secure channel now.

At the moment, the code is disabled because i have not implemented yet
the autoconf code to detect the presence of funopen(), and add -lssl
to main/Makefile if ssl libraries are present. And a bit of documentation
on the http.conf arguments, too.


If you want to manually enable https support, that is very simple
(step 0 1 2 will be eventually detected by ./configure, the
rest is something you will have to do anyways).

0. make sure your system has funopen(3). FreeBSD does, linux probably
   does too, not sure about other systems.

1. uncomment the following line in main/http.c
   // #define      DO_SSL  /* comment in/out if you want to support ssl */

2. add -lssl to AST_LIBS in main/Makefile

3. add the following options to http.conf

	sslenable=yes
	sslbindport=4433	; pick one you like
	sslcert=/tmp/foo.pem		; path to your certificate file.

4. generate a suitable certificate e.g. (example from mini_httpd's Makefile:

	openssl req -new -x509 -days 365 -nodes -out /tmp/foo.pem -keyout /tmp/foo.pem

and here you go:

	https://localhost:4433/asterisk/manager

now works.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45869 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-22 12:02:35 +00:00
Luigi Rizzo 5aa25a8d33 it is useless and possibly wrong to use ast_cli() to send the
reply back to http clients.
Use fprintf/fwrite instead, since we are already using a FILE *
to read the input.

If you wonder why, this is because it makes it trivial to
implement https support (as long as your system has funopen()).

And this is what i am going to put in with the next few commits...



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45858 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-22 08:28:16 +00:00
Joshua Colp e85da9be41 Let's have build.h created a bit earlier so that func_version can use it and not stop the build on a fresh machine that has never had Asterisk installed on it before...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-22 04:44:43 +00:00
Luigi Rizzo a0ae6ebd8e the default port number was erroneously stored in host order,
and reading from the config file used ntohs instead of htons.

this ought to be merged to 1.4 as well.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45836 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-21 20:24:04 +00:00
Joshua Colp 62d3a11eb9 Merged revisions 45817 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r45817 | file | 2006-10-21 14:48:58 -0400 (Sat, 21 Oct 2006) | 2 lines

Don't use promotion on Darwin because it doesn't seem to work quite right in all cases, this should solve the unresolved symbol issue people have been seeing.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-21 18:52:33 +00:00
Luigi Rizzo edd8e11889 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: https://origsvn.digium.com/svn/asterisk/trunk@45753 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-20 11:24:43 +00:00
Olle Johansson e19576388d Doxygen corrections
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45742 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-20 08:00:13 +00:00
Luigi Rizzo e7c2295b81 more fixes to comments and very minor code rearrangement.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45696 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-19 17:26:20 +00:00
Luigi Rizzo 32214ffc02 implement proper XML/HTML formatting of multiple messages
(e.g. the result of waitevent).

Also fix some comments.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45690 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-19 17:07:08 +00:00
Luigi Rizzo 9934b7f4d2 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: https://origsvn.digium.com/svn/asterisk/trunk@45648 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-19 07:43:43 +00:00
Russell Bryant bd53e7ee4c 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: https://origsvn.digium.com/svn/asterisk/trunk@45623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-19 01:00:57 +00:00
Luigi Rizzo 71c67605ca silent warning from a debugging message (which will go away
soon, anyways)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45611 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 22:40:02 +00:00
Luigi Rizzo eee51dbd1c remove trailing whitespace
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45599 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 21:41:09 +00:00
Luigi Rizzo 9e9edb05ec ouch! remember to unlink temporary files once done with them.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 21:36:20 +00:00
Luigi Rizzo 3c2eaaf1f0 + 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: https://origsvn.digium.com/svn/asterisk/trunk@45597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 21:30:21 +00:00
Joshua Colp 0ff90f87c5 Merged revisions 45595 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r45595 | file | 2006-10-18 17:03:34 -0400 (Wed, 18 Oct 2006) | 2 lines

Don't modify things if we are using vfork as this is very bad and may cause unexpected behavior (issue #7970 reported by Nick Gavrikov)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45596 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 21:05:52 +00:00
Luigi Rizzo c046fb40d8 another bunch of comments on the data structures.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 17:53:47 +00:00
Luigi Rizzo a518165207 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: https://origsvn.digium.com/svn/asterisk/trunk@45582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 17:45:50 +00:00
Luigi Rizzo a18accc09e more comment and formatting fixes, small simplifications
to functions get_input() and session_do()



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45572 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 16:52:13 +00:00
Matt O'Gorman 1783aef1e8 rizzo compile then commit, maybe even run it too ^_^
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45571 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 16:45:22 +00:00
Luigi Rizzo 71cf14207c 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: https://origsvn.digium.com/svn/asterisk/trunk@45561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 15:49:40 +00:00
Luigi Rizzo eb3767cafe 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: https://origsvn.digium.com/svn/asterisk/trunk@45551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 14:21:15 +00:00
Luigi Rizzo df06a40b05 more indentation cleanup from previous commits,
and remove the "busy" field from struct mansession
as it was not used correctly anyways.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 13:42:14 +00:00
Luigi Rizzo 46b5c26399 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: https://origsvn.digium.com/svn/asterisk/trunk@45540 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 13:23:22 +00:00
Luigi Rizzo becfe17739 fix indentation from a commit of a couple of days ago
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45530 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 12:55:12 +00:00
Luigi Rizzo 8e63fb21da 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: https://origsvn.digium.com/svn/asterisk/trunk@45529 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 12:38:24 +00:00
Luigi Rizzo d171c3d864 remove unused fields and unimplemented options.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45518 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 11:59:08 +00:00
Luigi Rizzo 998732456f first pass as simplifying authenticate(), avoiding whitespace changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45516 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 11:54:06 +00:00
Luigi Rizzo bc66d9b7d8 more code simplifications
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45515 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 11:43:31 +00:00
Luigi Rizzo c93be15b7e simplify ast_strings_to_mask
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45505 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 10:14:58 +00:00
Luigi Rizzo efd87b68ee add a comment to remember that a block of code is
completely redundant.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45495 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 08:48:50 +00:00
Luigi Rizzo 2102d73bf4 + 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: https://origsvn.digium.com/svn/asterisk/trunk@45485 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-10-18 06:28:34 +00:00