convert sofia TFLAGs to use array based flags.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11892 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
a07f3af49d
commit
092553d043
|
@ -373,7 +373,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
|||
switch_safe_free(stream.data);
|
||||
}
|
||||
|
||||
switch_clear_flag(tech_pvt, TFLAG_IO);
|
||||
sofia_clear_flag(tech_pvt, TFLAG_IO);
|
||||
|
||||
if (tech_pvt->read_codec.implementation) {
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
|
@ -622,7 +622,7 @@ static switch_status_t sofia_write_video_frame(switch_core_session_t *session, s
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!sofia_test_flag(frame, SFF_CNG)) {
|
||||
if (!switch_test_flag(frame, SFF_CNG)) {
|
||||
switch_rtp_write_frame(tech_pvt->video_rtp_session, frame);
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||
}
|
||||
|
||||
/* Fast PASS! */
|
||||
if (sofia_test_flag((&tech_pvt->read_frame), SFF_PROXY_PACKET)) {
|
||||
if (switch_test_flag((&tech_pvt->read_frame), SFF_PROXY_PACKET)) {
|
||||
sofia_clear_flag_locked(tech_pvt, TFLAG_READING);
|
||||
*frame = &tech_pvt->read_frame;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
@ -702,7 +702,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||
size_t bytes = 0;
|
||||
int frames = 1;
|
||||
|
||||
if (!sofia_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
|
||||
if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
|
||||
if (!tech_pvt->read_codec.implementation) {
|
||||
*frame = NULL;
|
||||
return SWITCH_STATUS_GENERR;
|
||||
|
@ -878,7 +878,7 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
|
|||
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_WRITING);
|
||||
|
||||
if (!sofia_test_flag(frame, SFF_CNG) && !sofia_test_flag(frame, SFF_PROXY_PACKET)) {
|
||||
if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
|
||||
if (tech_pvt->read_impl.encoded_bytes_per_packet) {
|
||||
bytes = tech_pvt->read_impl.encoded_bytes_per_packet;
|
||||
frames = ((int) frame->datalen / bytes);
|
||||
|
|
|
@ -174,6 +174,8 @@ typedef enum {
|
|||
PFLAG_CALLID_AS_UUID,
|
||||
PFLAG_UUID_AS_CALLID,
|
||||
PFLAG_SCROOGE,
|
||||
|
||||
/* No new flags below this line */
|
||||
PFLAG_MAX
|
||||
} PFLAGS;
|
||||
|
||||
|
@ -189,38 +191,41 @@ typedef enum {
|
|||
} STUNFLAGS;
|
||||
|
||||
typedef enum {
|
||||
TFLAG_IO = (1 << 0),
|
||||
TFLAG_CHANGE_MEDIA = (1 << 1),
|
||||
TFLAG_OUTBOUND = (1 << 2),
|
||||
TFLAG_READING = (1 << 3),
|
||||
TFLAG_WRITING = (1 << 4),
|
||||
TFLAG_HUP = (1 << 5),
|
||||
TFLAG_RTP = (1 << 6),
|
||||
TFLAG_BYE = (1 << 7),
|
||||
TFLAG_ANS = (1 << 8),
|
||||
TFLAG_EARLY_MEDIA = (1 << 9),
|
||||
TFLAG_SECURE = (1 << 10),
|
||||
TFLAG_VAD_IN = (1 << 11),
|
||||
TFLAG_VAD_OUT = (1 << 12),
|
||||
TFLAG_VAD = (1 << 13),
|
||||
TFLAG_3PCC = (1 << 14),
|
||||
TFLAG_READY = (1 << 15),
|
||||
TFLAG_REINVITE = (1 << 16),
|
||||
TFLAG_REFER = (1 << 17),
|
||||
TFLAG_NOHUP = (1 << 18),
|
||||
TFLAG_NOSDP_REINVITE = (1 << 19),
|
||||
TFLAG_NAT = (1 << 20),
|
||||
TFLAG_USEME = (1 << 21),
|
||||
TFLAG_SIP_HOLD = (1 << 22),
|
||||
TFLAG_INB_NOMEDIA = (1 << 23),
|
||||
TFLAG_LATE_NEGOTIATION = (1 << 24),
|
||||
TFLAG_SDP = (1 << 25),
|
||||
TFLAG_VIDEO = (1 << 26),
|
||||
TFLAG_TPORT_LOG = (1 << 27),
|
||||
TFLAG_SENT_UPDATE = (1 << 28),
|
||||
TFLAG_PROXY_MEDIA = (1 << 29),
|
||||
TFLAG_HOLD_LOCK = (1 << 30),
|
||||
TFLAG_3PCC_HAS_ACK = (1 << 31)
|
||||
TFLAG_IO,
|
||||
TFLAG_CHANGE_MEDIA,
|
||||
TFLAG_OUTBOUND,
|
||||
TFLAG_READING,
|
||||
TFLAG_WRITING,
|
||||
TFLAG_HUP,
|
||||
TFLAG_RTP,
|
||||
TFLAG_BYE,
|
||||
TFLAG_ANS,
|
||||
TFLAG_EARLY_MEDIA,
|
||||
TFLAG_SECURE,
|
||||
TFLAG_VAD_IN,
|
||||
TFLAG_VAD_OUT,
|
||||
TFLAG_VAD,
|
||||
TFLAG_3PCC,
|
||||
TFLAG_READY,
|
||||
TFLAG_REINVITE,
|
||||
TFLAG_REFER,
|
||||
TFLAG_NOHUP,
|
||||
TFLAG_NOSDP_REINVITE,
|
||||
TFLAG_NAT,
|
||||
TFLAG_USEME,
|
||||
TFLAG_SIP_HOLD,
|
||||
TFLAG_INB_NOMEDIA,
|
||||
TFLAG_LATE_NEGOTIATION,
|
||||
TFLAG_SDP,
|
||||
TFLAG_VIDEO,
|
||||
TFLAG_TPORT_LOG,
|
||||
TFLAG_SENT_UPDATE,
|
||||
TFLAG_PROXY_MEDIA,
|
||||
TFLAG_HOLD_LOCK,
|
||||
TFLAG_3PCC_HAS_ACK,
|
||||
|
||||
/* No new flags below this line */
|
||||
TFLAG_MAX
|
||||
} TFLAGS;
|
||||
|
||||
struct mod_sofia_globals {
|
||||
|
@ -250,8 +255,11 @@ struct mod_sofia_globals {
|
|||
extern struct mod_sofia_globals mod_sofia_globals;
|
||||
|
||||
typedef enum {
|
||||
REG_FLAG_AUTHED = (1 << 0),
|
||||
REG_FLAG_CALLERID = (1 << 1)
|
||||
REG_FLAG_AUTHED,
|
||||
REG_FLAG_CALLERID,
|
||||
|
||||
/* No new flags below this line */
|
||||
REG_FLAG_MAX
|
||||
} reg_flags_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -332,7 +340,7 @@ struct sofia_gateway {
|
|||
int pinging;
|
||||
sofia_gateway_status_t status;
|
||||
uint32_t ping_freq;
|
||||
uint32_t flags;
|
||||
uint8_t flags[REG_FLAG_MAX];
|
||||
int32_t retry_seconds;
|
||||
reg_state_t state;
|
||||
switch_memory_pool_t *pool;
|
||||
|
@ -399,7 +407,7 @@ struct sofia_profile {
|
|||
char *codec_string;
|
||||
int running;
|
||||
int dtmf_duration;
|
||||
unsigned int flags;
|
||||
uint8_t flags[TFLAG_MAX];
|
||||
uint8_t pflags[PFLAG_MAX];
|
||||
unsigned int mflags;
|
||||
unsigned int ndlb;
|
||||
|
@ -450,7 +458,7 @@ struct sofia_profile {
|
|||
|
||||
struct private_object {
|
||||
sofia_private_t *sofia_private;
|
||||
uint32_t flags;
|
||||
uint8_t flags[TFLAG_MAX];
|
||||
switch_payload_t agreed_pt;
|
||||
switch_core_session_t *session;
|
||||
switch_channel_t *channel;
|
||||
|
@ -597,10 +605,14 @@ switch_mutex_unlock(obj->flag_mutex);
|
|||
#define sofia_clear_pflag_locked(obj, flag) switch_mutex_lock(obj->flag_mutex); (obj)->pflags[flag] = 0; switch_mutex_unlock(obj->flag_mutex);
|
||||
#define sofia_clear_pflag(obj, flag) (obj)->pflags[flag] = 0
|
||||
|
||||
#define sofia_set_flag_locked(obj, flag) switch_set_flag_locked(obj, flag)
|
||||
#define sofia_set_flag(obj, flag) switch_set_flag(obj, flag)
|
||||
#define sofia_clear_flag_locked(obj, flag) switch_clear_flag_locked(obj, flag)
|
||||
#define sofia_test_flag(obj, flag) switch_test_flag(obj, flag)
|
||||
#define sofia_set_flag_locked(obj, flag) assert(obj->flag_mutex != NULL);\
|
||||
switch_mutex_lock(obj->flag_mutex);\
|
||||
(obj)->flags[flag] = 1;\
|
||||
switch_mutex_unlock(obj->flag_mutex);
|
||||
#define sofia_set_flag(obj, flag) (obj)->flags[flag] = 1
|
||||
#define sofia_clear_flag(obj, flag) (obj)->flags[flag] = 0
|
||||
#define sofia_clear_flag_locked(obj, flag) switch_mutex_lock(obj->flag_mutex); (obj)->flags[flag] = 0; switch_mutex_unlock(obj->flag_mutex);
|
||||
#define sofia_test_flag(obj, flag) ((obj)->flags[flag] ? 1 : 0)
|
||||
|
||||
/* Function Prototypes */
|
||||
/*************************************************************************************************************************************************************/
|
||||
|
|
|
@ -1401,7 +1401,7 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
|||
if (switch_true(val)) {
|
||||
sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
|
||||
} else {
|
||||
switch_clear_flag(profile, TFLAG_INB_NOMEDIA);
|
||||
sofia_clear_flag(profile, TFLAG_INB_NOMEDIA);
|
||||
}
|
||||
} else if (!strcasecmp(var, "force-subscription-expires")) {
|
||||
int tmp = atoi(val);
|
||||
|
@ -1412,13 +1412,13 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
|||
if (switch_true(val)) {
|
||||
sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
|
||||
} else {
|
||||
switch_clear_flag(profile, TFLAG_LATE_NEGOTIATION);
|
||||
sofia_clear_flag(profile, TFLAG_LATE_NEGOTIATION);
|
||||
}
|
||||
} else if (!strcasecmp(var, "inbound-proxy-media")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_flag(profile, TFLAG_PROXY_MEDIA);
|
||||
} else {
|
||||
switch_clear_flag(profile, TFLAG_PROXY_MEDIA);
|
||||
sofia_clear_flag(profile, TFLAG_PROXY_MEDIA);
|
||||
}
|
||||
} else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
|
||||
if (switch_true(val)) {
|
||||
|
@ -4472,13 +4472,13 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
|||
if (rpid) {
|
||||
if (rpid->rpid_privacy) {
|
||||
if (!strcasecmp(rpid->rpid_privacy, "yes")) {
|
||||
sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
|
||||
switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
|
||||
} else if (!strcasecmp(rpid->rpid_privacy, "full")) {
|
||||
sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
|
||||
switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
|
||||
} else if (!strcasecmp(rpid->rpid_privacy, "name")) {
|
||||
sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
|
||||
switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
|
||||
} else if (!strcasecmp(rpid->rpid_privacy, "number")) {
|
||||
sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NUMBER);
|
||||
switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NUMBER);
|
||||
} else {
|
||||
switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
|
||||
switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NUMBER);
|
||||
|
@ -4492,7 +4492,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
|||
|
||||
if ((privacy = sip_privacy(sip))) {
|
||||
if(msg_params_find(privacy->priv_values, "id")) {
|
||||
sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
|
||||
switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -463,6 +463,7 @@ void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
|
|||
void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *profile, private_object_t *tech_pvt, const char *channame)
|
||||
{
|
||||
char name[256];
|
||||
unsigned int x;
|
||||
|
||||
switch_assert(session != NULL);
|
||||
switch_assert(profile != NULL);
|
||||
|
@ -472,7 +473,12 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
|
|||
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
tech_pvt->flags = profile->flags;
|
||||
|
||||
/* copy flags from profile to the sofia private */
|
||||
for(x = 0; x < TFLAG_MAX; x++ ) {
|
||||
tech_pvt->flags[x] = profile->flags[x];
|
||||
}
|
||||
|
||||
tech_pvt->profile = profile;
|
||||
profile->inuse++;
|
||||
switch_mutex_unlock(profile->flag_mutex);
|
||||
|
@ -1289,16 +1295,16 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
|||
}
|
||||
|
||||
/* TODO: We should use the new tags for making an rpid and add profile options to turn this on/off */
|
||||
if (sofia_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
|
||||
if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
|
||||
priv = "name";
|
||||
if (sofia_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
|
||||
if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
|
||||
priv = "full";
|
||||
}
|
||||
} else if (sofia_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
|
||||
} else if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
|
||||
priv = "full";
|
||||
}
|
||||
|
||||
if (sofia_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
|
||||
if (switch_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
|
||||
screen = "yes";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue