Russell Bryant [Sat, 5 Aug 2006 09:03:27 +0000 (09:03 +0000)]
Merged revisions 38982 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r38982 | russell | 2006-08-05 05:01:37 -0400 (Sat, 05 Aug 2006) | 6 lines
Always generate a Newstate event in ast_setstate() instead of making it a
Newchannel event if the state was AST_STATE_DOWN. The Newchannel event will
always be generated in ast_request(), so this just causes a duplicated
Newchannel event in some cases.
(issue #7506, repoted by capouch, fixed by me)
Russell Bryant [Sat, 5 Aug 2006 05:26:29 +0000 (05:26 +0000)]
Merged revisions 38903-38904 via svnmerge from
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()
* removed pp_l2_check (fixed L2 bug in mISDNuser)
* added blocking flag to stack object. A port can be blocked/unblocked from the
cli
* added EVENT_PORT_ALARM to send alarm infos to the chan_misdn.c layer (later
we can add a manager event for that)
* added block_on_alarm option, to block the port whenever a ALARM occurs
* added need_busy flag to indicate if we've sended a CONTROL_BUSY already
* changed a bunch of cb_log(-1,..) to cb_log(0,..) due to funny behaviour in
recent asterisk ast_log messages..
* fixed a few ETSI state violations, especially when finishing calls in
different seldom states
* changed debug levels a lot to make the log more readable in low debuglevels
* some first fixes for the HOLD/RETRIEVE stuff (doesn't work totally still)
* removed the PRECONNECTED state stuff
* added cause 27 when we get a CLEANUP directly after a outgoing SETUP, this
creates a CHANISUNAVAIL instead of a NOANSWER
* removed the addr pointer from "misdn show stacks" that's not needed anymore
and makes the output more unreadable
* added cause saving on RELEASE/RELEASE_COMPLETE
* set cause to 16 on prepare_bc
* removed stack getting from ph_control functions, we don't really need it
there
* added beroec api
fix brain-damage I introduced when trying to fix the CANCEL/BYE sending mechanism for pending INVITES
accept unknown 1xx responses as 183 responses (as RFC3261 mandates we should do)
ensure that the 'feature digit timeout' value is taken into account when deciding how long the bridge should run (this fixes a problem report where a digit press that did not invoke a feature is never passed across the bridge)
Close the stream when file based MOH stop. This won't get rid of their position in the file but it will cause the translation path to be setup again. (issue #7634 reported by asimpson)
don't reissue hangup requests for SIP channels that have expired their RTP timeouts (one time is enough)
don't rescan the SIP private structure list too fast, it can cause channels to not be able to hang up (issue #7495, and probably others)
use ast_softhangup_nolock() since we already hold the channel's lock
Add missing code to bring transferee channel out of MOH/autoservice under certain circumstance (issue #7611 reported by guillecabeza with minor mods by myself)
Poking at a structure when it may not even be allocated is not healthy. Essentially make sure an RTCP structure exists before trying to delete it's scheduled item. (issue #7514 reported by jmls fixed by AuPix)
How many attempts does it take to make a SIP URI parser that works well? I'm up to 5 personally. On to the good stuff - parse the domain first, user second, and get rid of port & options/params last. (issue #7616 reported by andrew)
Russell Bryant [Fri, 28 Jul 2006 23:30:18 +0000 (23:30 +0000)]
the pure attribute was not implemented before gcc 2.96. Since we have this
version check here anwyay, define attribute_pure to be empty if it's an earlier
version.
Russell Bryant [Fri, 28 Jul 2006 22:14:49 +0000 (22:14 +0000)]
Add the function attribute "pure" or "const" to various functions that perform
int to string or string to int operations.
"pure" essentially says that this function has no side effects aside from its
result, and the result depends on nothing else other than its arguments and
global variables. "const" is a more strict form of "pure", where the function
also doesn't access any global variables.
From the gcc manual: "Such a function can be subject to common subexpression
elimination and loop optimization just as an arithmetic operator would be."
This also tells the compiler that it is safe to call the function fewer times
than the code says to, given the same arguments, since the result will always
be the same.
Russell Bryant [Fri, 28 Jul 2006 19:17:56 +0000 (19:17 +0000)]
As discussed and decided on the asterisk-dev mailing list ...
- Fix some breakage I introduced a while ago that made the timestamps option
not functional for CLI verbose output.
- Remove the use of the timestamps option for log output, since it was not
functional.
- clarify text referring to the timestamps option so that it is clear that it
only applies to CLI verbose output
Make a copy of the request URI in check_user_full instead of modifying the one on the structure, and also strip params properly from the user portion of the SIP URI so as to preserve the domain (issue #7552 reported by dan42)
Kevin P. Fleming [Fri, 28 Jul 2006 18:03:57 +0000 (18:03 +0000)]
more slinfactory structure definition to inside implementation module
make read/write/hold work on samples, not bytes
add an API call to find out how many samples are available in a slinfactory
Kevin P. Fleming [Thu, 27 Jul 2006 23:16:08 +0000 (23:16 +0000)]
more simplification, and correct a bug i introduced in the last commit
fix prototype for a channel walking function to use a const input pointer
use existing channel walk by name prefix instead of reproducing that code in this app
Kevin P. Fleming [Thu, 27 Jul 2006 23:00:27 +0000 (23:00 +0000)]
remove local channel finding wrappers
move guts of dialplan application into separate function, so it can be shared bythe new application i'm about to add :-)
Kevin P. Fleming [Thu, 27 Jul 2006 22:20:52 +0000 (22:20 +0000)]
various cleanups:
use API call for finding channel by name prefix
code formatting to match guidelines (lost about half the of the indenting)
remove useless automatic variable initializations
don't set the spying channel's read format to SLINEAR when we don't do anything with the voice frames we read from it anyway
use proper option argument checking for volume argument
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.
Russell Bryant [Wed, 26 Jul 2006 23:12:47 +0000 (23:12 +0000)]
fix setting the CFLAGS for building codec libs so that they are built with
astmm support and astmm doesn't get really upset and complain that it is being
asked to free memory that was never allocated
Russell Bryant [Tue, 25 Jul 2006 19:51:31 +0000 (19:51 +0000)]
This exact deadlock situation that I observed can't happen in trunk due to the
recent hold changes so that MOH is not started on the bridged channel directly.
However, the change is still not a bad idea.
Merged revisions 38200 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
This resolves a deadlock that a tech support customer was getting frequently
when his users would answer call waiting. If another thread is currently
holding the zt_pvt lock for the first channel, unlock both channels and let
asterisk retry the native bridge, just like what is done for the second channel
directly below these changes.
Steve Murphy [Mon, 24 Jul 2006 20:58:27 +0000 (20:58 +0000)]
Added a small fix to exclude the AMD optimized assembly file from being included in the compile.
I don't particular like the approach, which basically tries to exclude the file based on
NOT being in a list of arches. This, IMHO, is backwards, it should be a list of AMD arches
instead. "Better to light a candle, than to curse the darkness", is apropo here. But since I don't
have an exhaustive list of what those arches could be, I leave as-is for now.
Start out with cleared RTP payload structures instead of defaults. This should prevent issues where if a stream (audio/stream) is not present and it's RTP payload structure is combined with the overall capability then the capability would be every codec that Asterisk supports.
Russell Bryant [Sun, 23 Jul 2006 15:21:44 +0000 (15:21 +0000)]
ast_malloc is sufficient here, since snprintf is called on the buffer
immediately after it gets allocated, which will automatically NULL terminate
the string
Russell Bryant [Sun, 23 Jul 2006 15:19:16 +0000 (15:19 +0000)]
Merge team/russell/ast_cli_tls into the trunk.
This improves the performance of ast_cli() by not doing a heap memory
allocation and deallocation every single time the function is called. Instead,
a thread-specific buffer is allocatted the first time the function is called
and automatically free'd when the thread exits. Also note that this buffer will
only be allocatted in threads that actually call this function, which is
probably only the threads spawned to service connected asterisk consoles.
This does introduce a new limitation on the maximum length of the resulting
string from the arguments passed to ast_cli. Previously there was no limit
since it was just allocating a buffer big enough every time the function was
called. The current buffer size is 16kB. If there is ever a case where we want
to print more than 16k characters in a single call to ast_cli(), this will have
to be increased.
Russell Bryant [Sun, 23 Jul 2006 05:06:47 +0000 (05:06 +0000)]
resolve another XXX comment by implementing proper handling of control frames
in ast_write(), which is to call the channel's indicate function if it exists
Russell Bryant [Sun, 23 Jul 2006 04:58:56 +0000 (04:58 +0000)]
take the advice of an XXX comment and use an atomic operation to decrement a
variable. Also, change a use of strdup to ast_strdup and remove a duplicated
error message.
Russell Bryant [Sun, 23 Jul 2006 02:41:02 +0000 (02:41 +0000)]
various cleanups regarding coding guidelines issues
- malloc to ast_malloc
- malloc + memset to ast_calloc
- sizeof(struct foo) to sizeof(*bar)
- remove indentation of the entire body of a function by returning immediately
on an allocation failure
(issue #7581, tempest1)
Russell Bryant [Sat, 22 Jul 2006 00:33:56 +0000 (00:33 +0000)]
use ast_atomic_fetchadd_int in chan_zap, sip, and iax2 for usecount handling
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
Russell Bryant [Sat, 22 Jul 2006 00:08:21 +0000 (00:08 +0000)]
remove an XXX comment and document that ast_autoservice_start() will return -1
if the channel is already in the autoservice list.
Why is this a valid case to return -1, you ask? Well, there should never be
any code where it is not clear if the channel is in autoservice or not because
trying to read frames from a channel that is in the autoservice list will lead
to bad results because more than one thread will be waiting on frames to arrive
on the channel and then trying to read them.
This corrects the crash condition present in #7575, but I'm not really sure if it's the "right" fix. Please review and make any adjustments you see necessary.
Russell Bryant [Fri, 21 Jul 2006 17:31:28 +0000 (17:31 +0000)]
Merge a new implementation of ast_inet_ntoa, our thread safe replacement for
inet_ntoa, which uses thread specific data (aka thread local storage) instead
of stack allocatted buffers to store the result.
Only bitmaskify the RTP payload structure for video if an RTP structure exists for it... otherwise the default values will cause codec combination madness
Russell Bryant [Thu, 20 Jul 2006 16:18:07 +0000 (16:18 +0000)]
add a verbose message to the AGI command, STREAM FILE, similar to the
verbose messages when using Playback, Background, or the GET DATA command
(issue #7297, softins)
Kevin P. Fleming [Wed, 19 Jul 2006 20:44:39 +0000 (20:44 +0000)]
merge Russell's 'hold_handling' branch, finally implementing music-on-hold handling the way it was decided at AstriDevCon Europe 2006 (and the way people really want it to be)
Expand speech API so that the developer can interact with the engine more directly and use specific functions of the connector even if a generic API call is not available