summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-12-16 03:15:20 +0000
committerMark Spencer <markster@digium.com>2004-12-16 03:15:20 +0000
commitcadb8d010b824f7f89a61b9441406f4b33914911 (patch)
tree7f1ec5178785b3a1389a6a65e35a0d1c1a19c0f6
parentda6073e8c604c4904286e4ac23c5bfdc2a1b447d (diff)
Merge russell's flag macro patch (with slight mods) (bug #3046)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4469 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rwxr-xr-xapps/app_dial.c2
-rwxr-xr-xchannels/chan_agent.c13
-rwxr-xr-xinclude/asterisk/channel.h37
-rwxr-xr-xinclude/asterisk/utils.h11
-rwxr-xr-xindications.c1
5 files changed, 13 insertions, 51 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index b8785561c..89cf37521 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -914,7 +914,7 @@ static int dial_exec(struct ast_channel *chan, void *data)
/* Presense of ADSI CPE on outgoing channel follows ours */
tmp->chan->adsicpe = chan->adsicpe;
/* pass the digital flag */
- ast_dup_flag(tmp->chan, chan, AST_FLAG_DIGITAL);
+ ast_copy_flags(tmp->chan, chan, AST_FLAG_DIGITAL);
/* If we have an outbound group, set this peer channel to it */
if (outbound_group)
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index d9bc19eb5..c953ba389 100755
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -354,19 +354,6 @@ static struct ast_frame *agent_read(struct ast_channel *ast)
p->acknowledged = 0;
}
}
-#if 0
- /* I don't know what this code does and was unable to get a hold of Jim to
- find out, but it causes chan_agent to crash (see bug #3043) at
- http://bugs.digium.com */
- if ((!strncmp(p->chan->name,"Zap",3)) && (!p->ackcall) && (!p->acknowledged))
- {
-
- p->acknowledged = 1;
- f = &answer_frame;
- if (p->chan)
- p->chan->_bridge = ast;
- }
-#endif
if (f && (f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_ANSWER)) {
/* TC */
if (p->ackcall) {
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 28c566364..0a1bf0222 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -231,43 +231,6 @@ struct ast_channel {
#define AST_FLAG_ZOMBIE (1 << 4) /* if we are a zombie */
#define AST_FLAG_EXCEPTION (1 << 5) /* if there is a pending exception */
-static inline int ast_test_flag(struct ast_channel *chan, int mode)
-{
- return chan->flags & mode;
-}
-
-static inline void ast_set_flag(struct ast_channel *chan, int mode)
-{
- chan->flags |= mode;
-}
-
-static inline void ast_clear_flag(struct ast_channel *chan, int mode)
-{
- chan->flags &= ~mode;
-}
-
-static inline void ast_copy_flags(struct ast_channel *dest, struct ast_channel *src, int flags)
-{
- dest->flags &= ~flags;
- dest->flags |= (src->flags & flags);
-}
-
-static inline void ast_set2_flag(struct ast_channel *chan, int value, int mode)
-{
- if (value)
- ast_set_flag(chan, mode);
- else
- ast_clear_flag(chan, mode);
-}
-
-static inline void ast_dup_flag(struct ast_channel *dstchan, struct ast_channel *srcchan, int mode)
-{
- if (ast_test_flag(srcchan, mode))
- ast_set_flag(dstchan, mode);
- else
- ast_clear_flag(dstchan, mode);
-}
-
struct ast_bridge_config {
int play_to_caller;
int play_to_callee;
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 7c47fac89..b70a1ffca 100755
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -17,6 +17,17 @@
#include <pthread.h>
#include <asterisk/lock.h>
+#define ast_test_flag(p,flag) ((p)->flags & (flag))
+
+#define ast_set_flag(p,flag) ((p)->flags |= (flag))
+
+#define ast_clear_flag(p,flag) ((p)->flags &= ~(flag))
+
+#define ast_copy_flags(dest,src,flagz) do { dest->flags &= ~(flagz); \
+ dest->flags |= (src->flags & flagz); } while(0)
+
+#define ast_set2_flag(p,value,flag) ((value) ? ast_set_flag(p,flag) : ast_clear_flag(p,flag))
+
static inline int ast_strlen_zero(const char *s)
{
return (*s == '\0');
diff --git a/indications.c b/indications.c
index 02cc9d016..9e85ff240 100755
--- a/indications.c
+++ b/indications.c
@@ -26,6 +26,7 @@
#include <asterisk/channel.h>
#include <asterisk/logger.h>
#include <asterisk/lock.h>
+#include <asterisk/utils.h>
struct playtones_item {
int freq1;