[Freeswitch-svn] [commit] r10710 - in freeswitch/trunk/src: . include mod/languages/mod_managed mod/languages/mod_managed/managed
FreeSWITCH SVN
mikej at freeswitch.org
Thu Dec 11 07:20:24 PST 2008
Author: mikej
Date: Thu Dec 11 10:20:24 2008
New Revision: 10710
Log:
FSCORE-237 make channel flags array based so we do not have 32 flag limit
Modified:
freeswitch/trunk/src/include/switch_channel.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx
freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs
freeswitch/trunk/src/switch_channel.c
Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h (original)
+++ freeswitch/trunk/src/include/switch_channel.h Thu Dec 11 10:20:24 2008
@@ -145,7 +145,7 @@
\param flags the initial channel flags
*/
SWITCH_DECLARE(switch_status_t) switch_channel_init(switch_channel_t *channel, switch_core_session_t *session, switch_channel_state_t state,
- uint32_t flags);
+ switch_channel_flag_t flag);
/*!
\brief Fire A presence event for the channel
@@ -259,49 +259,49 @@
SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_caller_extension(switch_channel_t *channel);
/*!
- \brief Test for presence of given flag(s) on a given channel
+ \brief Test for presence of given flag on a given channel
\param channel channel to test
- \param flags or'd list of channel flags to test
+ \param flag to test
\return TRUE if flags were present
*/
-SWITCH_DECLARE(uint32_t) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags);
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flag);
/*!
\brief Set given flag(s) on a given channel
- \param channel channel on which to set flag(s)
- \param flags or'd list of flags to set
+ \param channel channel on which to set flag
+ \param flag or'd list of flags to set
*/
-SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flags);
+SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flag);
/*!
\brief Set given flag(s) on a given channel's bridge partner
- \param channel channel to derive the partner channel to set flag(s) on
- \param flags or'd list of flags to set
+ \param channel channel to derive the partner channel to set flag on
+ \param flag to set
\return true if the flag was set
*/
-SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t *channel, switch_channel_flag_t flags);
+SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag);
/*!
\brief Clears given flag(s) on a given channel's bridge partner
\param channel channel to derive the partner channel to clear flag(s) from
- \param flags the flags to clear
+ \param flag the flag to clear
\return true if the flag was cleared
*/
-SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flags);
+SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag);
/*!
\brief Set given flag(s) on a given channel to be applied on the next state change
\param channel channel on which to set flag(s)
- \param flags or'd list of flags to set
+ \param flag flag to set
*/
-SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flags);
+SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flag);
/*!
\brief Clear given flag(s) from a channel
\param channel channel to clear flags from
- \param flags or'd list of flags to clear
+ \param flag flag to clear
*/
-SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flags);
+SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag);
SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line);
@@ -484,7 +484,7 @@
_In_opt_ const char *prefix);
SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(_In_ switch_channel_t *channel);
-#define switch_channel_stop_broadcast(_channel) if (switch_channel_test_flag(_channel, CF_BROADCAST)) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
+#define switch_channel_stop_broadcast(_channel) for(;;) {if (switch_channel_test_flag(_channel, CF_BROADCAST)) {switch_channel_set_flag(_channel, CF_STOP_BROADCAST); switch_channel_set_flag(_channel, CF_BREAK); } break;}
#define switch_channel_media_ready(_channel) ((switch_channel_test_flag(_channel, CF_ANSWERED) || switch_channel_test_flag(_channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(_channel, CF_PROXY_MODE))
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Thu Dec 11 10:20:24 2008
@@ -732,73 +732,70 @@
\brief Channel Flags
<pre>
-CF_ANSWERED = (1 << 0) - Channel is answered
-CF_OUTBOUND = (1 << 1) - Channel is an outbound channel
-CF_EARLY_MEDIA = (1 << 2) - Channel is ready for audio before answer
-CF_ORIGINATOR = (1 << 3) - Channel is an originator
-CF_TRANSFER = (1 << 4) - Channel is being transfered
-CF_ACCEPT_CNG = (1 << 5) - Channel will accept CNG frames
-CF_REDIRECT = (1 << 6) - Channel is being redirected
-CF_BRIDGED = (1 << 7) - Channel in a bridge
-CF_HOLD = (1 << 8) - Channel is on hold
-CF_SERVICE = (1 << 9) - Channel has a service thread
-CF_TAGGED = (1 << 10) - Channel is tagged
-CF_WINNER = (1 << 11) - Channel is the winner
-CF_CONTROLLED = (1 << 12) - Channel is under control
-CF_PROXY_MODE = (1 << 13) - Channel has no media
-CF_SUSPEND = (1 << 14) - Suspend i/o
-CF_EVENT_PARSE = (1 << 15) - Suspend control events
-CF_USE_ME = (1 << 16) - use me
-CF_GEN_RINGBACK = (1 << 17) - Channel is generating it's own ringback
-CF_RING_READY = (1 << 18) - Channel is ready to send ringback
-CF_BREAK = (1 << 19) - Channel should stop what it's doing
-CF_BROADCAST = (1 << 20) - Channel is broadcasting
-CF_UNICAST = (1 << 21) - Channel has a unicast connection
-CF_VIDEO = (1 << 22) - Channel has video
-CF_EVENT_LOCK = (1 << 23) - Don't parse events
-CF_RESET = (1 << 24) - Tell extension parser to reset
-CF_ORIGINATING = (1 << 25) - Channel is originating
-CF_STOP_BROADCAST = (1 << 26) - Signal to stop broadcast
+CF_ANSWERED - Channel is answered
+CF_OUTBOUND - Channel is an outbound channel
+CF_EARLY_MEDIA - Channel is ready for audio before answer
+CF_ORIGINATOR - Channel is an originator
+CF_TRANSFER - Channel is being transfered
+CF_ACCEPT_CNG - Channel will accept CNG frames
+CF_REDIRECT - Channel is being redirected
+CF_BRIDGED - Channel in a bridge
+CF_HOLD - Channel is on hold
+CF_SERVICE - Channel has a service thread
+CF_TAGGED - Channel is tagged
+CF_WINNER - Channel is the winner
+CF_CONTROLLED - Channel is under control
+CF_PROXY_MODE - Channel has no media
+CF_SUSPEND - Suspend i/o
+CF_EVENT_PARSE - Suspend control events
+CF_GEN_RINGBACK - Channel is generating it's own ringback
+CF_RING_READY - Channel is ready to send ringback
+CF_BREAK - Channel should stop what it's doing
+CF_BROADCAST - Channel is broadcasting
+CF_UNICAST - Channel has a unicast connection
+CF_VIDEO - Channel has video
+CF_EVENT_LOCK - Don't parse events
+CF_RESET - Tell extension parser to reset
+CF_ORIGINATING - Channel is originating
+CF_STOP_BROADCAST - Signal to stop broadcast
</pre>
*/
typedef enum {
- CF_ANSWERED = (1 << 0),
- CF_OUTBOUND = (1 << 1),
- CF_EARLY_MEDIA = (1 << 2),
- CF_ORIGINATOR = (1 << 3),
- CF_TRANSFER = (1 << 4),
- CF_ACCEPT_CNG = (1 << 5),
- CF_REDIRECT = (1 << 6),
- CF_BRIDGED = (1 << 7),
- CF_HOLD = (1 << 8),
- CF_SERVICE = (1 << 9),
- CF_TAGGED = (1 << 10),
- CF_WINNER = (1 << 11),
- CF_CONTROLLED = (1 << 12),
- CF_PROXY_MODE = (1 << 13),
- CF_SUSPEND = (1 << 14),
- CF_EVENT_PARSE = (1 << 15),
- CF_USE_ME = (1 << 16),
- CF_GEN_RINGBACK = (1 << 17),
- CF_RING_READY = (1 << 18),
- CF_BREAK = (1 << 19),
- CF_BROADCAST = (1 << 20),
- CF_UNICAST = (1 << 21),
- CF_VIDEO = (1 << 22),
- CF_EVENT_LOCK = (1 << 23),
- CF_RESET = (1 << 24),
- CF_ORIGINATING = (1 << 25),
- CF_STOP_BROADCAST = (1 << 26),
- CF_PROXY_MEDIA = (1 << 27),
- CF_INNER_BRIDGE = (1 << 28),
- CF_REQ_MEDIA = (1 << 29),
- CF_VERBOSE_EVENTS = (1 << 30)
-} switch_channel_flag_enum_t;
-
-typedef uint32_t switch_channel_flag_t;
-
-
+ CF_ANSWERED = 1,
+ CF_OUTBOUND,
+ CF_EARLY_MEDIA,
+ CF_ORIGINATOR,
+ CF_TRANSFER,
+ CF_ACCEPT_CNG,
+ CF_REDIRECT,
+ CF_BRIDGED,
+ CF_HOLD,
+ CF_SERVICE,
+ CF_TAGGED,
+ CF_WINNER,
+ CF_CONTROLLED,
+ CF_PROXY_MODE,
+ CF_SUSPEND,
+ CF_EVENT_PARSE,
+ CF_GEN_RINGBACK,
+ CF_RING_READY,
+ CF_BREAK,
+ CF_BROADCAST,
+ CF_UNICAST,
+ CF_VIDEO,
+ CF_EVENT_LOCK,
+ CF_RESET,
+ CF_ORIGINATING,
+ CF_STOP_BROADCAST,
+ CF_PROXY_MEDIA,
+ CF_INNER_BRIDGE,
+ CF_REQ_MEDIA,
+ CF_VERBOSE_EVENTS,
+
+ /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
+ CF_FLAG_MAX
+} switch_channel_flag_t;
/*!
\enum switch_frame_flag_t
Modified: freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx (original)
+++ freeswitch/trunk/src/mod/languages/mod_managed/freeswitch_wrap.cxx Thu Dec 11 10:20:24 2008
@@ -17084,7 +17084,7 @@
}
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_wait_for_flag(void * jarg1, unsigned long jarg2, int jarg3, unsigned long jarg4, void * jarg5) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_wait_for_flag(void * jarg1, int jarg2, int jarg3, unsigned long jarg4, void * jarg5) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_channel_flag_t arg2 ;
@@ -17230,18 +17230,18 @@
}
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_init(void * jarg1, void * jarg2, int jarg3, unsigned long jarg4) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_init(void * jarg1, void * jarg2, int jarg3, int jarg4) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
switch_channel_state_t arg3 ;
- uint32_t arg4 ;
+ switch_channel_flag_t arg4 ;
switch_status_t result;
arg1 = (switch_channel_t *)jarg1;
arg2 = (switch_core_session_t *)jarg2;
arg3 = (switch_channel_state_t)jarg3;
- arg4 = (uint32_t)jarg4;
+ arg4 = (switch_channel_flag_t)jarg4;
result = (switch_status_t)switch_channel_init(arg1,arg2,arg3,arg4);
jresult = result;
return jresult;
@@ -17481,7 +17481,7 @@
}
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag(void * jarg1, unsigned long jarg2) {
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag(void * jarg1, int jarg2) {
unsigned long jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_channel_flag_t arg2 ;
@@ -17495,7 +17495,7 @@
}
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_flag(void * jarg1, unsigned long jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_flag(void * jarg1, int jarg2) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_channel_flag_t arg2 ;
@@ -17505,7 +17505,7 @@
}
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_flag_partner(void * jarg1, unsigned long jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_flag_partner(void * jarg1, int jarg2) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_channel_flag_t arg2 ;
@@ -17519,7 +17519,7 @@
}
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_clear_flag_partner(void * jarg1, unsigned long jarg2) {
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_clear_flag_partner(void * jarg1, int jarg2) {
int jresult ;
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_channel_flag_t arg2 ;
@@ -17533,7 +17533,7 @@
}
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_state_flag(void * jarg1, unsigned long jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_state_flag(void * jarg1, int jarg2) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_channel_flag_t arg2 ;
@@ -17543,7 +17543,7 @@
}
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_flag(void * jarg1, unsigned long jarg2) {
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_flag(void * jarg1, int jarg2) {
switch_channel_t *arg1 = (switch_channel_t *) 0 ;
switch_channel_flag_t arg2 ;
Modified: freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs (original)
+++ freeswitch/trunk/src/mod/languages/mod_managed/managed/swig.cs Thu Dec 11 10:20:24 2008
@@ -2209,8 +2209,8 @@
freeswitchPINVOKE.switch_channel_wait_for_state(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state);
}
- public static switch_status_t switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel channel, uint want_flag, switch_bool_t pres, uint to, SWIGTYPE_p_switch_channel super_channel) {
- switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), want_flag, (int)pres, to, SWIGTYPE_p_switch_channel.getCPtr(super_channel));
+ public static switch_status_t switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint to, SWIGTYPE_p_switch_channel super_channel) {
+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)want_flag, (int)pres, to, SWIGTYPE_p_switch_channel.getCPtr(super_channel));
return ret;
}
@@ -2260,8 +2260,8 @@
return ret;
}
- public static switch_status_t switch_channel_init(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_core_session session, switch_channel_state_t state, uint flags) {
- switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_init(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_core_session.getCPtr(session), (int)state, flags);
+ public static switch_status_t switch_channel_init(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_core_session session, switch_channel_state_t state, switch_channel_flag_t flag) {
+ switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_init(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_core_session.getCPtr(session), (int)state, (int)flag);
return ret;
}
@@ -2358,31 +2358,31 @@
return ret;
}
- public static uint switch_channel_test_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
- uint ret = freeswitchPINVOKE.switch_channel_test_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+ public static uint switch_channel_test_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+ uint ret = freeswitchPINVOKE.switch_channel_test_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
return ret;
}
- public static void switch_channel_set_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
- freeswitchPINVOKE.switch_channel_set_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+ public static void switch_channel_set_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+ freeswitchPINVOKE.switch_channel_set_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
}
- public static switch_bool_t switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel channel, uint flags) {
- switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+ public static switch_bool_t switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+ switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
return ret;
}
- public static switch_bool_t switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel channel, uint flags) {
- switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+ public static switch_bool_t switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+ switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
return ret;
}
- public static void switch_channel_set_state_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
- freeswitchPINVOKE.switch_channel_set_state_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+ public static void switch_channel_set_state_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+ freeswitchPINVOKE.switch_channel_set_state_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
}
- public static void switch_channel_clear_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
- freeswitchPINVOKE.switch_channel_clear_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+ public static void switch_channel_clear_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+ freeswitchPINVOKE.switch_channel_clear_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
}
public static switch_status_t switch_channel_perform_answer(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
@@ -8343,7 +8343,7 @@
public static extern void switch_channel_wait_for_state(HandleRef jarg1, HandleRef jarg2, int jarg3);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_flag")]
- public static extern int switch_channel_wait_for_flag(HandleRef jarg1, uint jarg2, int jarg3, uint jarg4, HandleRef jarg5);
+ public static extern int switch_channel_wait_for_flag(HandleRef jarg1, int jarg2, int jarg3, uint jarg4, HandleRef jarg5);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_set_state")]
public static extern int switch_channel_perform_set_state(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
@@ -8373,7 +8373,7 @@
public static extern int switch_channel_alloc(HandleRef jarg1, HandleRef jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_init")]
- public static extern int switch_channel_init(HandleRef jarg1, HandleRef jarg2, int jarg3, uint jarg4);
+ public static extern int switch_channel_init(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_presence")]
public static extern void switch_channel_presence(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
@@ -8433,22 +8433,22 @@
public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_flag")]
- public static extern uint switch_channel_test_flag(HandleRef jarg1, uint jarg2);
+ public static extern uint switch_channel_test_flag(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag")]
- public static extern void switch_channel_set_flag(HandleRef jarg1, uint jarg2);
+ public static extern void switch_channel_set_flag(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag_partner")]
- public static extern int switch_channel_set_flag_partner(HandleRef jarg1, uint jarg2);
+ public static extern int switch_channel_set_flag_partner(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag_partner")]
- public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, uint jarg2);
+ public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_state_flag")]
- public static extern void switch_channel_set_state_flag(HandleRef jarg1, uint jarg2);
+ public static extern void switch_channel_set_state_flag(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag")]
- public static extern void switch_channel_clear_flag(HandleRef jarg1, uint jarg2);
+ public static extern void switch_channel_clear_flag(HandleRef jarg1, int jarg2);
[DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_answer")]
public static extern int switch_channel_perform_answer(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
@@ -16832,38 +16832,38 @@
namespace FreeSWITCH.Native {
-[System.Flags] public enum switch_channel_flag_enum_t {
- CF_ANSWERED = (1 << 0),
- CF_OUTBOUND = (1 << 1),
- CF_EARLY_MEDIA = (1 << 2),
- CF_ORIGINATOR = (1 << 3),
- CF_TRANSFER = (1 << 4),
- CF_ACCEPT_CNG = (1 << 5),
- CF_REDIRECT = (1 << 6),
- CF_BRIDGED = (1 << 7),
- CF_HOLD = (1 << 8),
- CF_SERVICE = (1 << 9),
- CF_TAGGED = (1 << 10),
- CF_WINNER = (1 << 11),
- CF_CONTROLLED = (1 << 12),
- CF_PROXY_MODE = (1 << 13),
- CF_SUSPEND = (1 << 14),
- CF_EVENT_PARSE = (1 << 15),
- CF_USE_ME = (1 << 16),
- CF_GEN_RINGBACK = (1 << 17),
- CF_RING_READY = (1 << 18),
- CF_BREAK = (1 << 19),
- CF_BROADCAST = (1 << 20),
- CF_UNICAST = (1 << 21),
- CF_VIDEO = (1 << 22),
- CF_EVENT_LOCK = (1 << 23),
- CF_RESET = (1 << 24),
- CF_ORIGINATING = (1 << 25),
- CF_STOP_BROADCAST = (1 << 26),
- CF_PROXY_MEDIA = (1 << 27),
- CF_INNER_BRIDGE = (1 << 28),
- CF_REQ_MEDIA = (1 << 29),
- CF_VERBOSE_EVENTS = (1 << 30)
+public enum switch_channel_flag_t {
+ CF_ANSWERED = 1,
+ CF_OUTBOUND,
+ CF_EARLY_MEDIA,
+ CF_ORIGINATOR,
+ CF_TRANSFER,
+ CF_ACCEPT_CNG,
+ CF_REDIRECT,
+ CF_BRIDGED,
+ CF_HOLD,
+ CF_SERVICE,
+ CF_TAGGED,
+ CF_WINNER,
+ CF_CONTROLLED,
+ CF_PROXY_MODE,
+ CF_SUSPEND,
+ CF_EVENT_PARSE,
+ CF_GEN_RINGBACK,
+ CF_RING_READY,
+ CF_BREAK,
+ CF_BROADCAST,
+ CF_UNICAST,
+ CF_VIDEO,
+ CF_EVENT_LOCK,
+ CF_RESET,
+ CF_ORIGINATING,
+ CF_STOP_BROADCAST,
+ CF_PROXY_MEDIA,
+ CF_INNER_BRIDGE,
+ CF_REQ_MEDIA,
+ CF_VERBOSE_EVENTS,
+ CF_FLAG_MAX
}
}
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Thu Dec 11 10:20:24 2008
@@ -115,9 +115,9 @@
switch_core_session_t *session;
switch_channel_state_t state;
switch_channel_state_t running_state;
- switch_channel_flag_t flags;
+ uint8_t flags[CF_FLAG_MAX];
+ uint8_t state_flags[CF_FLAG_MAX];
uint32_t private_flags;
- switch_channel_flag_t state_flags;
switch_caller_profile_t *caller_profile;
const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS];
int state_handler_index;
@@ -410,11 +410,11 @@
}
SWITCH_DECLARE(switch_status_t) switch_channel_init(switch_channel_t *channel, switch_core_session_t *session, switch_channel_state_t state,
- uint32_t flags)
+ switch_channel_flag_t flag)
{
switch_assert(channel != NULL);
channel->state = state;
- channel->flags = flags;
+ switch_channel_set_flag(channel, flag);
channel->session = session;
channel->running_state = CS_NONE;
return SWITCH_STATUS_SUCCESS;
@@ -643,13 +643,13 @@
return SWITCH_STATUS_FALSE;
}
-SWITCH_DECLARE(uint32_t) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags)
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flag)
{
switch_assert(channel != NULL);
- return switch_test_flag(channel, flags) ? 1 : 0;
+ return channel->flags[flag] ? 1 : 0;
}
-SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t *channel, switch_channel_flag_t flags)
+SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
{
const char *uuid;
@@ -658,7 +658,7 @@
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
- switch_channel_set_flag(switch_core_session_get_channel(session), flags);
+ switch_channel_set_flag(switch_core_session_get_channel(session), flag);
switch_core_session_rwunlock(session);
return SWITCH_TRUE;
}
@@ -667,7 +667,7 @@
return SWITCH_FALSE;
}
-SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flags)
+SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
{
const char *uuid;
@@ -676,7 +676,7 @@
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
- switch_channel_clear_flag(switch_core_session_get_channel(session), flags);
+ switch_channel_clear_flag(switch_core_session_get_channel(session), flag);
switch_core_session_rwunlock(session);
return SWITCH_TRUE;
}
@@ -714,11 +714,11 @@
for (;;) {
if (pres) {
- if (switch_test_flag(channel, want_flag)) {
+ if (switch_channel_test_flag(channel, want_flag)) {
break;
}
} else {
- if (!switch_test_flag(channel, want_flag)) {
+ if (!switch_channel_test_flag(channel, want_flag)) {
break;
}
}
@@ -741,11 +741,16 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flags)
+SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flag)
{
- switch_assert(channel != NULL);
- switch_set_flag_locked(channel, flags);
- if (flags & CF_OUTBOUND) {
+ switch_assert(channel);
+ switch_assert(channel->flag_mutex);
+
+ switch_mutex_lock(channel->flag_mutex);
+ channel->flags[flag] = 1;
+ switch_mutex_unlock(channel->flag_mutex);
+
+ if (flag == CF_OUTBOUND) {
switch_channel_set_variable(channel, "is_outbound", "true");
}
}
@@ -773,21 +778,25 @@
return (channel->private_flags & flags);
}
-
-SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flags)
+SWITCH_DECLARE(void) switch_channel_set_state_flag(switch_channel_t *channel, switch_channel_flag_t flag)
{
switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
- channel->state_flags |= flags;
+ channel->state_flags[0] = 1;
+ channel->state_flags[flag] = 1;
switch_mutex_unlock(channel->flag_mutex);
}
-SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flags)
+SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag)
{
switch_assert(channel != NULL);
- switch_clear_flag_locked(channel, flags);
- if (flags & CF_OUTBOUND) {
+ switch_assert(channel->flag_mutex);
+
+ switch_mutex_lock(channel->flag_mutex);
+ channel->flags[flag] = 0;
+ switch_mutex_unlock(channel->flag_mutex);
+ if (flag == CF_OUTBOUND) {
switch_channel_set_variable(channel, "is_outbound", NULL);
}
}
@@ -823,7 +832,7 @@
switch_assert(channel != NULL);
if (!channel->hangup_cause && channel->state > CS_ROUTING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
- !switch_test_flag(channel, CF_TRANSFER)) {
+ !switch_channel_test_flag(channel, CF_TRANSFER)) {
ret++;
}
@@ -867,16 +876,22 @@
SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(switch_channel_t *channel, switch_channel_state_t state,
const char *file, const char *func, int line)
{
+ int x;
switch_mutex_lock(channel->flag_mutex);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "(%s) Running State Change %s\n", channel->name, state_names[state]);
channel->running_state = state;
- if (channel->state_flags) {
- channel->flags |= channel->state_flags;
- channel->state_flags = 0;
+ if (channel->state_flags[0]) {
+ for(x = 1; x < CF_FLAG_MAX ; x++ ) {
+ if (channel->state_flags[x]) {
+ channel->flags[x] = 1;
+ channel->state_flags[x] = 0;
+ }
+ }
+ channel->state_flags[0] = 0;
}
- switch_clear_flag(channel, CF_TAGGED);
+ switch_channel_clear_flag(channel, CF_TAGGED);
if (channel->state >= CS_ROUTING) {
switch_channel_presence(channel, "unknown", (char *) state_names[state], NULL);
@@ -1185,7 +1200,7 @@
}
- if (switch_test_flag(channel, CF_VERBOSE_EVENTS) ||
+ if (switch_channel_test_flag(channel, CF_VERBOSE_EVENTS) ||
event->event_id == SWITCH_EVENT_CHANNEL_ORIGINATE ||
event->event_id == SWITCH_EVENT_CHANNEL_UUID ||
event->event_id == SWITCH_EVENT_CHANNEL_ANSWER ||
More information about the Freeswitch-svn
mailing list