This set of changes introduces a new generic event API for use within Asterisk.
I am still working on a way for events to be shared between servers, but this
part is ready and can already be used inside of Asterisk.
This set of changes introduces the first use of the API, as well. I have
restructured the way that MWI (message waiting indication) is handled. It is
now event based instead of polling based. For example, if there are a bunch
of SIP phones subscribed to mailboxes, then chan_sip will not have to
constantly poll the mailboxes for changes. app_voicemail will generate events
when changes occur.
See UPGRADE.txt and CHANGES for some more information on the effects of these
changes from the user perspective. For developer information, see the text in
include/asterisk/event.h.
As always, additional feedback is welcome on the asterisk-dev mailing list.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@62292 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This set of changes adds OSP support to chan_iax2. However, I have modified
the patch a bit from what was submitted. You now use the CHANNEL() function
to get and set the OSP token for IAX2.
(issue #8531, reported by and original patch by homesick, patch updated by me)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61702 65c4cc65-6c06-0410-ace0-fbb531ad65f3
"ChannelDriver" and "Channel", previously used to indicate channel driver. ChannelType is more
in line with "core show channeltypes"
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@60987 65c4cc65-6c06-0410-ace0-fbb531ad65f3
probably others, too. I don't really have time to work on it at the moment,
so I am just going to revert it for now.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@59693 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r59341 | russell | 2007-03-29 11:55:39 -0500 (Thu, 29 Mar 2007) | 8 lines
When the IAX2 read callback gets called, return NULL instead of a "null frame".
This will cause Asterisk to hangup the call instead of keep trying whatever it
was doing. Under normal conditions, this function would *never* be called.
However, the author of this patch says an error will occur that will cause it
to get called every 100 thousand calls or so. When this does happen, it puts
the channel in a loop that eventually brings down the system. So, hangup up
the call is certainly a better alternative. (issue #8286, john)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@59343 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r58705 | russell | 2007-03-10 12:11:11 -0600 (Sat, 10 Mar 2007) | 6 lines
Fix a few more places in chan_iax2 where the ast_frame used for receiving a
frame was not properly initialized.
- Interpolating a frame when the jitterbuffer is in use
- decrypting a frame when IAX2 encryption is on
- frames in an IAX2 trunk
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@58706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r58243 | russell | 2007-03-07 12:19:19 -0600 (Wed, 07 Mar 2007) | 17 lines
(This bug was reported to me by Kinsey Moore)
Merged revisions 58242 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r58242 | russell | 2007-03-07 12:17:07 -0600 (Wed, 07 Mar 2007) | 7 lines
Fix a problem where the Asterisk channel name could be that of the wrong IAX2
user for a call. This is because the first step of choosing this name is to
look for an IAX2 peer that happens to have the same IP/port number that this
call is coming from and assuming that is it. However, this is not always
correct. So, I have made it change this name after authentication happens
since at that point, we have an exact match.
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@58244 65c4cc65-6c06-0410-ace0-fbb531ad65f3
There is not a large amount of code here and the changes are not very invasive.
However, they should significantly improve performance of chan_iax2 under load.
IAX2 media frames only carry the *source* call number. So, when one arrives,
the correct session that it is a part of has to be matched on IP address, port
number, and call number, instead of just a call number. Had these frames
carried the *destination* call number, this would not be an issue, because that
would be a unique identifier that would make it easy to immediately identify
the correct session.
The way that chan_iax2 did this matching was extremely inefficient. It starts
at the first available call number and traverses each call number sequentially,
locking and unlocking a mutex for each one, to try to match against it. It
would do this regardless of whether the call number was in use or not. So,
for a call with a local call number of 25000, every single incoming media
frame would require a traversal that required 25000 mutex lock and unlock
operations. (Note that the max call number is about 32k).
I have introduced a hash table of active IAX2 calls to improve this lookup
process. The hash is done on the IP address, port number, and call number.
So, for the previous example, a few lock/unlock operations may be done versus
25000 for each frame.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@56447 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r56407 | russell | 2007-02-23 14:20:00 -0600 (Fri, 23 Feb 2007) | 12 lines
Merged revisions 56406 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r56406 | russell | 2007-02-23 14:17:56 -0600 (Fri, 23 Feb 2007) | 4 lines
Don't destroy mutexes before unregistering all of the entry points from the core.
Also, fix a potential memory leak from not destroying the locks for all of the
possible call numbers (about 32k of them).
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@56408 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r55397 | dbailey | 2007-02-19 08:52:59 -0600 (Mon, 19 Feb 2007) | 3 lines
Changed iax2 process thread to detached to correct memory leak due to left over thread context on thread exit.
Modified module unload process to avoid deadlocks on pthread cancels
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@55409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r51311 | russell | 2007-01-19 11:49:38 -0600 (Fri, 19 Jan 2007) | 23 lines
Merge the changes from the /team/group/vldtmf_fixup branch.
The main bug being addressed here is a problem introduced when two SIP
channels using SIP INFO dtmf have their media directly bridged. So, when a
DTMF END frame comes into Asterisk from an incoming INFO message, Asterisk
would try to emulate a digit of some length by first sending a DTMF BEGIN
frame and sending a DTMF END later timed off of incoming audio. However,
since there was no audio coming in, the DTMF_END was never generated. This
caused DTMF based features to no longer work.
To fix this, the core now knows when a channel doesn't care about DTMF BEGIN
frames (such as a SIP channel sending INFO dtmf). If this is the case, then
Asterisk will not emulate a digit of some length, and will instead just pass
through the single DTMF END event.
Channel drivers also now get passed the length of the digit to their digit_end
callback. This improves SIP INFO support even further by enabling us to put
the real digit duration in the INFO message instead of a hard coded 250ms.
Also, for an incoming INFO message, the duration is read from the frame and
passed into the core instead of just getting ignored.
(issue #8597, maybe others...)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r49581 | kpfleming | 2007-01-04 17:50:15 -0600 (Thu, 04 Jan 2007) | 3 lines
create the IAX2 processing threads as background threads so they will use smaller stacks
when we create a dynamic thread, put it on the dynamic_list right away so we don't lose track of it
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r49259 | file | 2007-01-02 20:19:53 -0500 (Tue, 02 Jan 2007) | 2 lines
Check pvt structure presence before passing to send_command. This gets rid of the irritating message about a packet without pvt structure. This happens because the scheduled item is getting cancelled at almost the exact moment it is getting executed.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49260 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r48564 | file | 2006-12-18 12:15:49 -0500 (Mon, 18 Dec 2006) | 2 lines
Put thread into proper list if we abort handling due to an error, and also hold the lock while putting it back into the proper idle list so we don't prematurely get a signal. (issue #8604 reported by arkadia)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48565 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r48363 | russell | 2006-12-09 10:59:42 -0500 (Sat, 09 Dec 2006) | 8 lines
Use locking when accessing the registrations list. This list is not actually
used very often, so the likelihood of there being a problem is pretty small,
but still possible. For example, if the CLI command to list the registrations
was called at the same time that a reload was occurring and the registrations
list was getting destroyed and rebuilt, a crash could occur.
In passing, go ahead and convert this list to use the linked list macros.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48364 65c4cc65-6c06-0410-ace0-fbb531ad65f3
frames. The function, before this commit, was roughly 1400 lines long. So, I
am working on breaking this up into functions so that the code is easier to
follow and debug. Also, I will be committing these changes in chunks as I do
them to ease tracking down any potentially introduced problems.
Break out roughly 150 lines from socket_process() and introduce a new function,
socket_process_meta() which handles the parsing of an incoming meta frame.
Also, restructure some of this code a bit to reduce the deep nesting that was
in this code.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48360 65c4cc65-6c06-0410-ace0-fbb531ad65f3
- Use sizeof() to pass an array size to a function
- Use a single bit for a variable in the chan_iax2_pvt stuct since that is all
it needs.
- Add some comments about the iaxs, iaxl, and lastused arrays.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48359 65c4cc65-6c06-0410-ace0-fbb531ad65f3
versions of the format string are identical. Also, since each format is only
used once, get rid of the use of defines all together. (issue #8344, julieng)
In passing, also clean up the formatting a but to get rid of the nesting
without the use of braces, as defined in the coding guidelines.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47520 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r46775 | file | 2006-11-01 13:21:34 -0500 (Wed, 01 Nov 2006) | 2 lines
It's another round of chan_iax2 fixes! Should hopefully fix the deadlock issues people have been reporting. IAXtel now has qualify turned on for 800 peers and it is handling it fine.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46777 65c4cc65-6c06-0410-ace0-fbb531ad65f3
when the number of channels fill the MTU on a given link.
In the future, this needs to be configurable per peer with trunking enabled.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46195 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r45408 | kpfleming | 2006-10-17 17:24:10 -0500 (Tue, 17 Oct 2006) | 3 lines
optimize the 'quick response' code a bit more... no more malloc() or memset() for each response
expand stringfields API a bit to allow reusing the stringfield pool on a structure when needed, and remove some unnecessary code when the structure was being freed
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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: https://origsvn.digium.com/svn/asterisk/trunk@44379 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r43783 | file | 2006-09-27 13:00:31 -0400 (Wed, 27 Sep 2006) | 2 lines
Get rid of two functions from a time now past (we THINK these are from pre-recursive lock time) that may be contributing to two open issues on the bug tracker (7562/7939) and that has the potential to just make bad things happen if the timing is right.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43792 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r43553 | russell | 2006-09-24 09:53:35 -0400 (Sun, 24 Sep 2006) | 12 lines
Merged revisions 43552 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r43552 | russell | 2006-09-24 09:50:30 -0400 (Sun, 24 Sep 2006) | 4 lines
Check to see if the channel that is activating the IAXPEER function is actually
an IAX2 channel before proceeding to process it to avoid crashing.
(issue #8017, reported by admott, fixed by myself)
........
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43554 65c4cc65-6c06-0410-ace0-fbb531ad65f3
now reports AST_MODULE_LOAD_DECLINE when loading if config file
is not there, also fixed an error in res_config_pgsql where it
had a non static function when it should.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41633 65c4cc65-6c06-0410-ace0-fbb531ad65f3
There are some situations in Asterisk where ast_frame and/or iax_frame
structures are rapidly allocatted and freed (at least 50 times per second
for one call).
This code significantly improves the performance of ast_frame_header_new(),
ast_frdup(), ast_frfree(), iax_frame_new(), and iax_frame_free() by keeping
a thread-local cache of these structures and using frames from the cache
whenever possible instead of calling malloc/free every time.
This commit also converts the ast_frame and iax_frame structures to use the
linked list macros.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41278 65c4cc65-6c06-0410-ace0-fbb531ad65f3
- 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
- instead of defining a free() wrapper in a bunch of files, define it as
ast_free() in utils.h and remove the copies from all the files.
- centralize and abstract the code used for doing thread storage. The code
lives in threadstorage.h, with one function being implemented in utils.c.
This new API includes generic thread storage as well as special functions
for handling thread local dynamic length string buffers.
- update ast_inet_ntoa() to use the new threadstorage API
- update ast_state2str() to use the new threadstorage API
- update ast_cli() to use the new threadstorage API
- Modify manager_event() to use thread storage. Instead of using a buffer of
4096 characters as the workspace for building the manager event, use a thread
local dynamic string. Now there is no length limitation on the length of the
body of a manager event.
- Significantly simplify the handling of ast_verbose() ...
- Instead of using a static char buffer and a lock to make sure only one
thread can be using ast_verbose() at a time, use a thread local dynamic
string as the workspace for preparing the verbose message. Instead of
locking around the entire function, the only locking done now is when the
message has been built and is being deliviered to the list of registered
verbose message handlers.
- This function was doing a strdup() on every message passed to it and
keeping a queue of the last 200 messages in memory. This has been
completely removed. The only place this was used was that if there were
any messages in the verbose queue when a verbose handler was registered,
all of the messages in the queue would be fed to it. So, I just made sure
that the console verbose handler and the network verbose handler (for
remote asterisk consoles) were registered before any verbose messages.
pbx_gtkconsole and pbx_kdeconsole will now lose a few verbose messages at
startup, but I didn't feel the performance hit of this message queue was
worth saving the initial verbose output for these very rarely used modules.
- I have removed the last three arguments to the verbose handlers, leaving
only the string itself because they aren't needed anymore. For example,
ast_verbose had some logic for telling the verbose handler to add
a newline if the buffer was completely full. Now that the buffer can grow
as needed, this doesn't matter anymore.
- remove unused function, ast_verbose_dmesg() which was to dispatch the
message queue
- Convert the list of verbose handlers to use the linked list macros.
- add missing newline characters to a few ast_verbose() calls
- convert the list of log channels to use the linked list macros in logger.c
- fix close_logger() to close all of the files it opened for logging
- update ast_log() to use a thread local dynamic string for its workspace
for preparing log messages instead of a buffer of size BUFSIZ (8kB on my
system) allocated on the stack. The dynamic string in this case is limited
to only growing to a maximum size of BUFSIZ.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@39272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r38903 | russell | 2006-08-05 01:07:39 -0400 (Sat, 05 Aug 2006) | 2 lines
suppress a compiler warning about the usage of a potentially uninitialized variable
........
r38904 | russell | 2006-08-05 01:08:50 -0400 (Sat, 05 Aug 2006) | 10 lines
Fix an issue that would cause a NewCallerID manager event to be generated
before the channel's NewChannel event. This was due to a somewhat recent
change that included using ast_set_callerid() where it wasn't before. This
function should not be used in the channel driver "new" functions.
(issue #7654, fixed by me)
Also, fix a couple minor bugs in usecount handling. chan_iax2 could have
increased the usecount but then returned an error. The place where chan_sip
increased the usecount did not call ast_update_usecount()
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r38328 | russell | 2006-07-27 00:25:41 -0400 (Thu, 27 Jul 2006) | 4 lines
Fix crash when using the "regexten" option with MALLOC_DEBUG enabled. This was
not reported in the bug tracker but the same bug has been demonstrated in other
places in the code.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38329 65c4cc65-6c06-0410-ace0-fbb531ad65f3
and fix a couple little things in passing
- usecnt was not initialized in chan_iax2
- ast_update_use_count() was not called after incrementing the count in chan_sip
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38077 65c4cc65-6c06-0410-ace0-fbb531ad65f3
inet_ntoa, which uses thread specific data (aka thread local storage) instead
of stack allocatted buffers to store the result.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
in vm_authenticate, it was try to start ADSI on the channel, and it WOULD because it
was "supported", according to the iaxy. There is now a config option (adsi=yes) for
this, which defaults to no. (config sample coming shortly)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37643 65c4cc65-6c06-0410-ace0-fbb531ad65f3
split support for G726-32 into RFC3551 and AAL2 packing orders, since both are in use
change "G726-32" to be RFC3551 packing order, in spite of devices that use AAL2 order with this MIME type
add ability to directly transcode between packing orders
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37494 65c4cc65-6c06-0410-ace0-fbb531ad65f3
........
r36725 | russell | 2006-07-03 00:19:09 -0400 (Mon, 03 Jul 2006) | 4 lines
use ast_set_callerid to be more consistent and to make sure that the
"callerid" option in the conf files is always handled the same way and sets ANI
(issue #7285, gkloepfer)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@36726 65c4cc65-6c06-0410-ace0-fbb531ad65f3
support the new location for zaptel.h and tonezone.h
use the dependency information output by menuselect to build Makefile rules for each module for header files and libraries
combine the common rules into a top-level Makefile.rules file
remove all (now) unnecessary stuff from subdir Makefiles
change translator API so that the newpvt() callback returns an int instead of a pointer (it no longer allocates memory)
alphabetize --with-<foo> options in configure script
enhance Net-SNMP support in configure script to provide a --with-netsnmp option
fix support for --with-pq so that if pg-config is not found when --with-pq is specified, an error will be generated
add 'optional package' usage to modules now that menuselect can output it
allow res_snmp to build by default, since the new loader changes coming soon will solve the function naming problem (and users can disable it via menuselect anyway)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@35832 65c4cc65-6c06-0410-ace0-fbb531ad65f3
- if the pbx fails to start, set the owner channel of the pvt strucutre
to be NULL
- return immediately if the pbx fails to start so the loop to set all of
the variables from the "setvar" options aren't set as a bunch of global
variables instead
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@35554 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r34627 | russell | 2006-06-18 16:15:15 -0400 (Sun, 18 Jun 2006) | 5 lines
don't store multiple secrets delimited with semicolons for peers because this
is only valid for users. Instead, only keep the last specified secret for a
peer entry. Also, document how multiple secrets are handled in the sample
config. (Reported by PCadach on #asterisk-bugs)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@34628 65c4cc65-6c06-0410-ace0-fbb531ad65f3
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r34159 | kpfleming | 2006-06-14 17:17:37 -0500 (Wed, 14 Jun 2006) | 2 lines
use existing dial string parser for strings supplied to iax2_devicestate, because they can be complete dial strings, not just device names
........
r34160 | kpfleming | 2006-06-14 17:22:21 -0500 (Wed, 14 Jun 2006) | 2 lines
coding style cleanups on queue interface handling code that was committed for the last release
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@34161 65c4cc65-6c06-0410-ace0-fbb531ad65f3
a new implementation of a fixed size jitterbuffer, as well as support for the
existing adaptive jitterbuffer implementation. (issue #3854, Slav Klenov)
Thank you very much to Slav Klenov of Securax and all of the people involved
in the testing of this feature for all of your hard work!
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31052 65c4cc65-6c06-0410-ace0-fbb531ad65f3