Commit graph

7780 commits

Author SHA1 Message Date
Luigi Rizzo
3e20f8d75d more formatting cleanup including removal of a useless check
for f == NULL



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20652 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 20:09:01 +00:00
Luigi Rizzo
09a1511672 rename a variable same as used in a very similar function,
to reduce code differences.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 19:56:08 +00:00
Luigi Rizzo
4ca8c0fc8d s/pu->chan/chan in a few places;
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20626 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 19:41:12 +00:00
Luigi Rizzo
36ea51ecd7 put some common code into functions (still more instances to be replaced)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20625 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 19:26:57 +00:00
Luigi Rizzo
70109abc39 properly reindent a large block.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20624 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 19:12:51 +00:00
Luigi Rizzo
e304a986fd more readability fixes - localize some variables and invert
a condition in an 'if' statement to reduce the nesting depth.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 19:05:19 +00:00
Luigi Rizzo
d29f8a677e introduce a function to set context, extension and priority
replacing some common blocks of code (there are still a few
instances where it can be used)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20598 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 18:49:46 +00:00
Luigi Rizzo
81ed862e67 minor readability fixes in preparation for more work on this file:
- replace nested 'if' with '&&'
- fix indentation
- annotate the end brace of some huge block
- remove useless parentheses



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20597 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 18:37:01 +00:00
Luigi Rizzo
bdfa578990 minor formatting fixes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20596 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 18:10:10 +00:00
Luigi Rizzo
3d7e2145b8 move some duplicated code outside an if/then/else block
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 17:59:37 +00:00
Luigi Rizzo
3469287168 make sure there is [almost] only a single exit point for a very long
function so the flow is easier to follow.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20569 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 17:41:05 +00:00
Luigi Rizzo
8f80cbea14 simplify the ast_channel walking routines.
(the previous version was mine, but this way it is definitely
more readable).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 16:58:56 +00:00
Luigi Rizzo
ebc152c0da move common conditions to the outside block.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20540 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 16:04:24 +00:00
Luigi Rizzo
7783a7a7e6 simplify logic in ast_generic_bridge()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20514 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 15:51:53 +00:00
Luigi Rizzo
9807aab483 move common code in one place
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20513 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 15:27:58 +00:00
Luigi Rizzo
ba7c8dbd73 avoid returning in the middle of a switch() in ast_answer()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20512 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 15:22:13 +00:00
Luigi Rizzo
ad5cfd80c0 simplify function __ast_request_and_dial() as follows:
- handle immediately failures in ast_request();
  This removes the need for checking 'chan' multiple times afterwards.
- handle immediately failures in ast_call(), by moving the one-line
  case at the top of the 'if' statement;
- use ast_strlen_zero in several places instead of expanding it inline;
- make outstate always a valid pointer;
On passing mark an unclear statement and replace a magic number
with sizeof(tmp).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 15:13:39 +00:00
Luigi Rizzo
5a6cc1ea4e properly reindent a block
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20484 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 14:14:16 +00:00
Luigi Rizzo
577b740f17 add a missing ast_channel_unlock() evidenced by previous commits.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20477 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 14:03:43 +00:00
Luigi Rizzo
5afbcc4f86 remove an extra lock.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20456 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 14:00:17 +00:00
Luigi Rizzo
845298a7b3 - replace some nested 'if' with '&&'
- bring the short case at the top of an 'if' statement
  (also fix misformatting)
- replace several 'if' with the '?' operator;
 
- invert the condition on an 'if' to reduce the nesting depth 
  (reindentation to be done later).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 13:58:43 +00:00
Luigi Rizzo
ed6def5c46 Localize some variables documenting their usage.
Comment a possible problem with locking.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20453 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 13:27:58 +00:00
Olle Johansson
4a312a044d - Fixes to ast_channel_lock functions
- New get_sip_pvt_byid function (not really used correctly yet...)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20424 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 12:57:15 +00:00
Luigi Rizzo
4c9c289a5d localize some variables, add some comments.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20396 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 08:01:10 +00:00
Luigi Rizzo
429025db22 implement ast_waitfordigit() and ast_readstring() in terms
of their '_full()' version, so we can remove the replicated
implementation and, especially, the risk that they get out of sync.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20389 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-16 07:53:25 +00:00
Joshua Colp
5c05128777 Move a bit more stuff over to the datadir (issue #6967 reported by tzafrir patch by north)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20358 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 23:37:29 +00:00
Joshua Colp
e8a94a71e2 Allow the attachment format to be specified differently for different mailboxes (issue #6961 reported by the ever fabulous Corydon76)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20357 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 23:05:18 +00:00
Joshua Colp
4657dc770c We are shaking up trunk tonight! allow data dir to be specified (issue #6967 reported by tzafrir)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20330 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 22:53:53 +00:00
Russell Bryant
8a5436c72f add indications for Thailand (issue #6971)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20329 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 22:49:45 +00:00
Russell Bryant
717445c1d8 add the ability to turn off the feature that allows agents to end calls
by pressing '*'.  This is still on by default. (issue #6897)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20328 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 22:32:23 +00:00
Russell Bryant
825d6d7c99 Big oops. I did this from my trunk directory instead of autoconf_and_menuselect ...
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20297 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 15:34:57 +00:00
Russell Bryant
aade174330 include autoconfig.h (casper)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20296 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 15:33:00 +00:00
Olle Johansson
e75fa47099 More ast_channel_lock fixes
- Update lock.h with definitions of ast_channel_lock, ast_channel_unlock and ast_channel_trylock
- Convert some functions (but not all) in channel.c
- Fix some bugs in chan_sip.c
- Convert rest of chan_sip.c


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20295 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 15:07:39 +00:00
Olle Johansson
6b3367bf5c New functions for locking a channel - these simplify debugging
when you have channel locking issues.
(Part of the SIP transfer patch, where I had a *lot* of
channel locking problems)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20264 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 08:07:50 +00:00
Luigi Rizzo
9250a6d129 applied two of the 3 chunks in #6907, and a similar one
(replace nested 'if' with '&&')
I cannot make sense of the first chunk of the proposed patch,
i think the original is correct.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20225 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 00:53:04 +00:00
Luigi Rizzo
7c1b1cc29e - use '=' to copy struct sockaddr_in
- localize a variable
- replace three replicas of the same code with a much simpler construct
  removing replicated var = var->next;
- use '?' instead of 'if' for an assignment



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20224 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 00:36:05 +00:00
Luigi Rizzo
e42087f5e3 - normalize for() loops to navigate through variables,
removing replicated var = var->next;
- remove a potential infinite loop and document the problem
- remove useless checks and document why
- mark XXX a possible bug (to be investigated)
- use ast_strlen_zero() instead of expanding it inline
- fix indentation in one place   
- replace a nested 'if' with '&&'



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-15 00:05:08 +00:00
Luigi Rizzo
1417b3498d - use '?' instead of if statements for assignment;
- fix indentation in a few places
- use a variable to store the 'other' channel, thus removing
  the need for some duplicated code;
- use '=' instead of memcpy to copy struct sockaddr_in



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 23:30:18 +00:00
Luigi Rizzo
d043954dc1 - remove some unnecessary casts and braces;
- add braces around a nested 'if'
- use S_OR and '?' to remove some duplicated function calls;
- replace nested 'if' with &&
- move out a common term in a sequence of 'if'
- add a comment on a potentially dangerous string manipulation



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20196 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 23:20:29 +00:00
Luigi Rizzo
f32e294300 remove some unnecessary braces
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20170 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 22:55:58 +00:00
Luigi Rizzo
147c9e5e73 misc. code cleanup
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20169 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 22:48:05 +00:00
Luigi Rizzo
ca9e77fe46 code simplifications
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20168 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 22:32:13 +00:00
Luigi Rizzo
8977378288 use ast_strdup instead of strdup
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20167 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 22:22:13 +00:00
Luigi Rizzo
b20429bd6b normalize cli completion code
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 22:17:27 +00:00
Luigi Rizzo
62712ea668 constification and code simplifications
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20165 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 22:02:19 +00:00
Luigi Rizzo
1029b57707 constify a couple of function arguments
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20138 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 21:00:59 +00:00
Luigi Rizzo
160031b7be code cleanup (for loop normalization, remove useless casts and parentheses)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 20:47:06 +00:00
Luigi Rizzo
6d574f36ca partial fix of the module API to use the new method.
Still not complete as we need to take care of the usecount stuff.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20104 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 19:35:37 +00:00
Luigi Rizzo
8d98d44e82 fix another svn merge bug
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20076 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 18:45:08 +00:00
Tilghman Lesher
b8317169d0 Compatibility fixes for loader changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20075 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-04-14 18:44:24 +00:00