sofia_glue_tech_absorb_sdp(tech_pvt);
}
- if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
const char *var;
if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && !switch_strlen_zero(var)) {
if (switch_true(var) || !strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_32)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
sofia_glue_build_crypto(tech_pvt, 1, AES_CM_128_HMAC_SHA1_32, SWITCH_RTP_CRYPTO_SEND);
} else if (!strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_80)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
sofia_glue_build_crypto(tech_pvt, 1, AES_CM_128_HMAC_SHA1_80, SWITCH_RTP_CRYPTO_SEND);
}
}
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
private_object_t *tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
- if (!switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
}
}
- if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
+ if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
const char *buuid;
switch_core_session_t *bsession;
switch_channel_t *bchannel;
switch_core_session_rwunlock(bsession);
}
}
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
}
sofia_glue_deactivate_rtp(tech_pvt);
- if (tech_pvt->nh && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
+ if (tech_pvt->nh && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
char reason[128] = "";
switch_stream_handle_t stream = { 0 };
switch_event_header_t *hi;
switch_snprintf(reason, sizeof(reason), "FreeSWITCH;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
}
- if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_ANS)) {
if (!tech_pvt->got_bye) {
switch_channel_set_variable(channel, "sip_hangup_disposition", "send_bye");
}
TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
TAG_END());
} else {
- if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel));
if (!tech_pvt->got_bye) {
switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel");
}
}
- switch_set_flag(tech_pvt, TFLAG_BYE);
+ sofia_set_flag(tech_pvt, TFLAG_BYE);
switch_safe_free(stream.data);
}
int is_proxy = 0;
char *sticky = NULL;
- if (switch_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
return SWITCH_STATUS_SUCCESS;
}
}
} else {
/* This if statement check and handles the 3pcc proxy mode */
- if ((tech_pvt->profile->pflags & PFLAG_3PCC_PROXY) && switch_test_flag(tech_pvt, TFLAG_3PCC)) {
+ if ((tech_pvt->profile->pflags & PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
/* Send the 200 OK */
nua_respond(tech_pvt->nh, SIP_200_OK,
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
// Maybe we should timeout?
switch_mutex_unlock(tech_pvt->sofia_mutex);
- while(switch_channel_ready(channel) && !switch_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
+ while(switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
switch_cond_next();
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
}
- if ((is_proxy && !b_sdp) || switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
- switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
+ if ((is_proxy && !b_sdp) || sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
if (is_proxy) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disabling proxy mode due to call answer with no bridge\n");
}
}
- if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+ if (sofia_test_flag(tech_pvt, TFLAG_NAT) ||
(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
sticky = tech_pvt->record_route;
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
- switch_set_flag_locked(tech_pvt, TFLAG_ANS);
+ sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
return SWITCH_STATUS_SUCCESS;
}
switch_assert(tech_pvt != NULL);
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
}
tech_pvt->video_read_frame.datalen = 0;
- if (switch_test_flag(tech_pvt, TFLAG_IO)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_IO)) {
switch_status_t status;
- if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
return SWITCH_STATUS_GENERR;
}
switch_assert(tech_pvt->rtp_session != NULL);
tech_pvt->video_read_frame.datalen = 0;
- while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->video_read_frame.datalen == 0) {
+ while (sofia_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->video_read_frame.datalen == 0) {
tech_pvt->video_read_frame.flags = SFF_NONE;
status = switch_rtp_zerocopy_read_frame(tech_pvt->video_rtp_session, &tech_pvt->video_read_frame, flags);
}
}
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
}
- if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
return SWITCH_STATUS_GENERR;
}
- if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_IO)) {
return SWITCH_STATUS_SUCCESS;
}
- if (!switch_test_flag(frame, SFF_CNG)) {
+ if (!sofia_test_flag(frame, SFF_CNG)) {
switch_rtp_write_frame(tech_pvt->video_rtp_session, frame);
}
switch_assert(tech_pvt != NULL);
- if (!(tech_pvt->profile->pflags & PFLAG_RUNNING)) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_RUNNING)) {
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_NORMAL_CLEARING);
return SWITCH_STATUS_FALSE;
}
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
}
}
tech_pvt->read_frame.datalen = 0;
- switch_set_flag_locked(tech_pvt, TFLAG_READING);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READING);
- if (switch_test_flag(tech_pvt, TFLAG_HUP) || switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP) || sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
return SWITCH_STATUS_FALSE;
}
- if (switch_test_flag(tech_pvt, TFLAG_IO)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_IO)) {
switch_status_t status;
- if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
return SWITCH_STATUS_GENERR;
}
switch_assert(tech_pvt->rtp_session != NULL);
tech_pvt->read_frame.datalen = 0;
- while (switch_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
+ while (sofia_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
tech_pvt->read_frame.flags = SFF_NONE;
status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags);
}
/* Fast PASS! */
- if (switch_test_flag((&tech_pvt->read_frame), SFF_PROXY_PACKET)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+ if (sofia_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;
}
size_t bytes = 0;
int frames = 1;
- if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
+ if (!sofia_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
if (!tech_pvt->read_codec.implementation) {
*frame = NULL;
return SWITCH_STATUS_GENERR;
}
}
- switch_clear_flag_locked(tech_pvt, TFLAG_READING);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_READING);
if (tech_pvt->read_frame.datalen == 0) {
*frame = NULL;
return SWITCH_STATUS_GENERR;
}
- if (switch_test_flag(tech_pvt, TFLAG_HUP)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_HUP)) {
return SWITCH_STATUS_FALSE;
}
- if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_RTP)) {
return SWITCH_STATUS_GENERR;
}
- if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_IO)) {
return SWITCH_STATUS_SUCCESS;
}
- if (switch_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
+ if (sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation) {
return SWITCH_STATUS_FALSE;
}
- switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
+ sofia_set_flag_locked(tech_pvt, TFLAG_WRITING);
- if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
+ if (!sofia_test_flag(frame, SFF_CNG) && !sofia_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);
tech_pvt->timestamp_send += samples;
switch_rtp_write_frame(tech_pvt->rtp_session, frame);
- switch_clear_flag_locked(tech_pvt, TFLAG_WRITING);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_WRITING);
return status;
}
break;
case SWITCH_SIG_KILL:
default:
- switch_clear_flag_locked(tech_pvt, TFLAG_IO);
- switch_set_flag_locked(tech_pvt, TFLAG_HUP);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_IO);
+ sofia_set_flag_locked(tech_pvt, TFLAG_HUP);
if (switch_rtp_ready(tech_pvt->rtp_session)) {
switch_rtp_kill_socket(tech_pvt->rtp_session);
{
const char *var;
if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
}
}
break;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Sending media re-direct:\n%s\n",
switch_channel_get_name(channel), msg->string_arg);
tech_pvt->local_sdp_str = switch_core_session_strdup(session, msg->string_arg);
- switch_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
sofia_glue_do_invite(session);
}
break;
switch_channel_get_name(channel), tech_pvt->local_sdp_str);
- switch_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
sofia_glue_do_invite(session);
}
break;
case SWITCH_MESSAGE_INDICATE_HOLD:
{
- switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
sofia_glue_do_invite(session);
if (!switch_strlen_zero(msg->string_arg)) {
char message[256] = "";
case SWITCH_MESSAGE_INDICATE_UNHOLD:
{
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
sofia_glue_do_invite(session);
}
break;
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Redirecting to %s\n", msg->string_arg);
nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(msg->string_arg), TAG_END());
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Too late for redirecting to %s, already answered\n", msg->string_arg);
}
SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL),
TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
}
} else if (code == 302 && !switch_strlen_zero(msg->string_arg)) {
char * p = strchr(msg->string_arg, ' ');
nua_respond(tech_pvt->nh, code, su_strdup(tech_pvt->nh->nh_home, reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
}
if (!switch_channel_test_flag(channel, CF_ANSWERED) && code >= 300) {
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
}
}
char *sticky = NULL;
const char *val = NULL;
- if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_ANS) && !sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
- switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+ sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
/* Transmit 183 Progress with SDP */
}
}
} else {
- if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
- switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
+ if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
switch_channel_mark_pre_answered(channel);
- if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+ if (sofia_test_flag(tech_pvt, TFLAG_NAT) ||
(val = switch_channel_get_variable(channel, "sip-force-contact")) ||
((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
sticky = tech_pvt->record_route;
stream->write_function(stream, "CNG \t%d\n", profile->cng_pt);
stream->write_function(stream, "SESSION-TO \t%d\n", profile->session_timeout);
stream->write_function(stream, "MAX-DIALOG \t%d\n", profile->max_proceeding);
- stream->write_function(stream, "NOMEDIA \t%s\n", switch_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
- stream->write_function(stream, "LATE-NEG \t%s\n", switch_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
- stream->write_function(stream, "PROXY-MEDIA \t%s\n", switch_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
+ stream->write_function(stream, "NOMEDIA \t%s\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
+ stream->write_function(stream, "LATE-NEG \t%s\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
+ stream->write_function(stream, "PROXY-MEDIA \t%s\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
stream->write_function(stream, "AGGRESSIVENAT \t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
stream->write_function(stream, "STUN_ENABLED \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
stream->write_function(stream, "STUN_AUTO_DISABLE\t%s\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
stream->write_function(stream, "<CNG>%d</CNG>\n", profile->cng_pt);
stream->write_function(stream, "<SESSION-TO>%d</SESSION-TO>\n", profile->session_timeout);
stream->write_function(stream, "<MAX-DIALOG>%d</MAX-DIALOG>\n", profile->max_proceeding);
- stream->write_function(stream, "<NOMEDIA>%s</NOMEDIA>\n", switch_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
- stream->write_function(stream, "<LATE-NEG>%s</LATE-NEG>\n", switch_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
- stream->write_function(stream, "<PROXY-MEDIA>%s</PROXY-MEDIA>\n", switch_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
+ stream->write_function(stream, "<NOMEDIA>%s</NOMEDIA>\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
+ stream->write_function(stream, "<LATE-NEG>%s</LATE-NEG>\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
+ stream->write_function(stream, "<PROXY-MEDIA>%s</PROXY-MEDIA>\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
stream->write_function(stream, "<AGGRESSIVENAT>%s</AGGRESSIVENAT>\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
stream->write_function(stream, "<STUN_ENABLED>%s</STUN_ENABLED>\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
stream->write_function(stream, "<STUN_AUTO_DISABLE>%s</STUN_AUTO_DISABLE>\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
if (argv[2]) {
int is_true = switch_true(argv[2]);
if (is_true) {
- profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+ sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
} else {
- profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE;
+ sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
}
}
if (argv[2]) {
int is_true = switch_true(argv[2]);
if (is_true) {
- profile->pflags |= PFLAG_STUN_ENABLED;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
} else {
- profile->pflags &= ~PFLAG_STUN_ENABLED;
+ sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
}
}
tech_pvt->gateway_name = switch_core_session_strdup(nsession, gateway_ptr->name);
switch_channel_set_variable(nchannel, "sip_gateway_name", gateway_ptr->name);
- if (!switch_test_flag(gateway_ptr, REG_FLAG_CALLERID)) {
+ if (!sofia_test_flag(gateway_ptr, REG_FLAG_CALLERID)) {
tech_pvt->gateway_from_str = switch_core_session_strdup(nsession, gateway_ptr->register_from);
}
caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest);
switch_channel_set_caller_profile(nchannel, caller_profile);
switch_channel_set_flag(nchannel, CF_OUTBOUND);
- switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
- switch_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
+ sofia_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
if (switch_channel_get_state(nchannel) == CS_NEW) {
switch_channel_set_state(nchannel, CS_INIT);
}
tech_pvt->video_rm_rate = 90000;
tech_pvt->video_codec_ms = 0;
switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
- switch_set_flag(tech_pvt, TFLAG_VIDEO);
+ sofia_set_flag(tech_pvt, TFLAG_VIDEO);
}
}
}
sofia_private->destroy_me = 22;
}
- if ((profile->pflags & PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
+ if (sofia_test_pflag(profile, PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
sip_authorization_t const *authorization = NULL;
if (sip->sip_authorization) {
goto end;
}
- if (switch_test_flag(profile, TFLAG_TPORT_LOG)) {
+ if (sofia_test_flag(profile, TFLAG_TPORT_LOG)) {
tportlog = 1;
}
gateway->auth_username = switch_core_strdup(gateway->pool, auth_username);
gateway->register_password = switch_core_strdup(gateway->pool, password);
if (switch_true(caller_id_in_from)) {
- switch_set_flag(gateway, REG_FLAG_CALLERID);
+ sofia_set_flag(gateway, REG_FLAG_CALLERID);
}
register_transport = (char *) sofia_glue_transport2str(gateway->register_transport);
if (contact_params) {
/* you could change profile->foo here if it was a minor change like context or dialplan ... */
profile->rport_level = 1; /* default setting */
profile->acl_count = 0;
- profile->pflags |= PFLAG_STUN_ENABLED;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
if (xprofiledomain) {
profile->domain_name = switch_core_strdup(profile->pool, xprofiledomain);
profile->record_template = switch_core_strdup(profile->pool, val);;
} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media"))) {
if (switch_true(val)) {
- switch_set_flag(profile, TFLAG_INB_NOMEDIA);
+ sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
} else {
switch_clear_flag(profile, TFLAG_INB_NOMEDIA);
}
}
} else if (!strcasecmp(var, "inbound-late-negotiation")) {
if (switch_true(val)) {
- switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
+ sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
} else {
switch_clear_flag(profile, TFLAG_LATE_NEGOTIATION);
}
} else if (!strcasecmp(var, "inbound-proxy-media")) {
if (switch_true(val)) {
- switch_set_flag(profile, TFLAG_PROXY_MEDIA);
+ sofia_set_flag(profile, TFLAG_PROXY_MEDIA);
} else {
switch_clear_flag(profile, TFLAG_PROXY_MEDIA);
}
} else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_CALLID_AS_UUID;
+ sofia_set_pflag(profile, PFLAG_CALLID_AS_UUID);
} else {
- profile->pflags &= ~PFLAG_CALLID_AS_UUID;
+ sofia_clear_pflag(profile, PFLAG_CALLID_AS_UUID);
}
} else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_UUID_AS_CALLID;
+ sofia_set_pflag(profile, PFLAG_UUID_AS_CALLID);
} else {
- profile->pflags &= ~PFLAG_UUID_AS_CALLID;
+ sofia_clear_pflag(profile, PFLAG_UUID_AS_CALLID);
}
} else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+ sofia_set_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
} else {
- profile->pflags &= ~PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+ sofia_clear_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
}
} else if (!strcasecmp(var, "aggressive-nat-detection")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
+ sofia_set_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
} else {
- profile->pflags &= ~PFLAG_AGGRESSIVE_NAT_DETECTION;
+ sofia_clear_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
}
} else if (!strcasecmp(var, "disable-rtp-auto-adjust")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_RTP_AUTOADJ;
+ sofia_set_pflag(profile, PFLAG_DISABLE_RTP_AUTOADJ);
} else {
- profile->pflags &= ~PFLAG_DISABLE_RTP_AUTOADJ;
+ sofia_clear_pflag(profile, PFLAG_DISABLE_RTP_AUTOADJ);
}
} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_SRTP_AUTH;
+ sofia_set_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
} else {
- profile->pflags &= ~PFLAG_DISABLE_SRTP_AUTH;
+ sofia_clear_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
}
} else if (!strcasecmp(var, "NDLB-funny-stun")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_FUNNY_STUN;
+ sofia_set_pflag(profile, PFLAG_FUNNY_STUN);
} else {
- profile->pflags &= ~PFLAG_FUNNY_STUN;
+ sofia_clear_pflag(profile, PFLAG_FUNNY_STUN);
}
} else if (!strcasecmp(var, "stun-enabled")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_STUN_ENABLED;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
} else {
- profile->pflags &= ~PFLAG_STUN_ENABLED;
+ sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
}
} else if (!strcasecmp(var, "stun-auto-disable")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+ sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
} else {
- profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE;
+ sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
}
} else if (!strcasecmp(var, "apply-nat-acl")) {
if (profile->acl_count < SOFIA_MAX_ACL) {
}
} else if (!strcasecmp(var, "rfc2833-pt")) {
profile->te = (switch_payload_t) atoi(val);
- } else if (!strcasecmp(var, "cng-pt") && !(profile->pflags & PFLAG_SUPPRESS_CNG)) {
+ } else if (!strcasecmp(var, "cng-pt") && !(sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG))) {
profile->cng_pt = (switch_payload_t) atoi(val);
} else if (!strcasecmp(var, "vad")) {
if (!strcasecmp(val, "in")) {
- switch_set_flag(profile, TFLAG_VAD_IN);
+ sofia_set_flag(profile, TFLAG_VAD_IN);
} else if (!strcasecmp(val, "out")) {
- switch_set_flag(profile, TFLAG_VAD_OUT);
+ sofia_set_flag(profile, TFLAG_VAD_OUT);
} else if (!strcasecmp(val, "both")) {
- switch_set_flag(profile, TFLAG_VAD_IN);
- switch_set_flag(profile, TFLAG_VAD_OUT);
+ sofia_set_flag(profile, TFLAG_VAD_IN);
+ sofia_set_flag(profile, TFLAG_VAD_OUT);
} else if (strcasecmp(val, "none")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
}
} else if (!strcasecmp(var, "unregister-on-options-fail")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_UNREG_OPTIONS_FAIL;
+ sofia_set_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL);
} else {
- profile->pflags &= ~PFLAG_UNREG_OPTIONS_FAIL;
+ sofia_clear_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL);
}
} else if (!strcasecmp(var, "require-secure-rtp")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_SECURE;
+ sofia_set_pflag(profile, PFLAG_SECURE);
} else {
- profile->pflags &= ~PFLAG_SECURE;
+ sofia_clear_pflag(profile, PFLAG_SECURE);
}
} else if (!strcasecmp(var, "multiple-registrations")) {
if (!strcasecmp(val, "call-id")) {
- profile->pflags |= PFLAG_MULTIREG;
+ sofia_set_pflag(profile, PFLAG_MULTIREG);
} else if (!strcasecmp(val, "contact") || switch_true(val)) {
- profile->pflags |= PFLAG_MULTIREG;
- profile->pflags |= PFLAG_MULTIREG_CONTACT;
+ sofia_set_pflag(profile, PFLAG_MULTIREG);
+ sofia_set_pflag(profile, PFLAG_MULTIREG_CONTACT);
} else if (switch_true(val)) {
- profile->pflags &= ~PFLAG_MULTIREG;
- //profile->pflags &= ~PFLAG_MULTIREG_CONTACT;
+ sofia_clear_pflag(profile, PFLAG_MULTIREG);
+ //sofia_clear_pflag(profile, PFLAG_MULTIREG_CONTACT);
}
} else if (!strcasecmp(var, "supress-cng") || !strcasecmp(var, "suppress-cng")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_SUPPRESS_CNG;
+ sofia_set_pflag(profile, PFLAG_SUPPRESS_CNG);
profile->cng_pt = 0;
} else {
- profile->pflags &= ~PFLAG_SUPPRESS_CNG;
+ sofia_clear_pflag(profile, PFLAG_SUPPRESS_CNG);
}
} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
if (switch_true(val)) {
}
} else if (!strcasecmp(var, "pass-rfc2833")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_PASS_RFC2833;
+ sofia_set_pflag(profile, PFLAG_PASS_RFC2833);
} else {
- profile->pflags &= ~PFLAG_PASS_RFC2833;
+ sofia_clear_pflag(profile, PFLAG_PASS_RFC2833);
}
} else if (!strcasecmp(var, "inbound-codec-negotiation")) {
if (!strcasecmp(val, "greedy")) {
- profile->pflags |= PFLAG_GREEDY;
+ sofia_set_pflag(profile, PFLAG_GREEDY);
} else {
- profile->pflags &= ~PFLAG_GREEDY;
+ sofia_clear_pflag(profile, PFLAG_GREEDY);
}
} else if (!strcasecmp(var, "disable-transcoding")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_TRANSCODING;
+ sofia_set_pflag(profile, PFLAG_DISABLE_TRANSCODING);
} else {
- profile->pflags &= ~PFLAG_DISABLE_TRANSCODING;
+ sofia_clear_pflag(profile, PFLAG_DISABLE_TRANSCODING);
}
} else if (!strcasecmp(var, "rtp-rewrite-timestamps")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_REWRITE_TIMESTAMPS;
+ sofia_set_pflag(profile, PFLAG_REWRITE_TIMESTAMPS);
} else {
- profile->pflags &= ~PFLAG_REWRITE_TIMESTAMPS;
+ sofia_clear_pflag(profile, PFLAG_REWRITE_TIMESTAMPS);
}
} else if (!strcasecmp(var, "auth-calls")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_AUTH_CALLS;
+ sofia_set_pflag(profile, PFLAG_AUTH_CALLS);
} else {
- profile->pflags &= ~PFLAG_AUTH_CALLS;
+ sofia_clear_pflag(profile, PFLAG_AUTH_CALLS);
}
} else if (!strcasecmp(var, "force-register-domain")) {
profile->reg_domain = switch_core_strdup(profile->pool, val);
profile->tls_version = 0;
profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
profile->rport_level = 1;
- profile->pflags |= PFLAG_STUN_ENABLED;
- profile->pflags |= PFLAG_DISABLE_100REL;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
+ sofia_set_pflag(profile, PFLAG_DISABLE_100REL);
profile->auto_restart = 1;
profile->manage_shared_appearance = 0; /* Initialize default */
profile->disable_srv = 0;
if (!strcasecmp(var, "debug")) {
profile->debug = atoi(val);
} else if (!strcasecmp(var, "sip-trace") && switch_true(val)) {
- switch_set_flag(profile, TFLAG_TPORT_LOG);
+ sofia_set_flag(profile, TFLAG_TPORT_LOG);
} else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
#ifdef SWITCH_HAVE_ODBC
profile->odbc_dsn = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "record-template")) {
profile->record_template = switch_core_strdup(profile->pool, val);
} else if ((!strcasecmp(var, "inbound-no-media") || !strcasecmp(var, "inbound-bypass-media")) && switch_true(val)) {
- switch_set_flag(profile, TFLAG_INB_NOMEDIA);
+ sofia_set_flag(profile, TFLAG_INB_NOMEDIA);
} else if (!strcasecmp(var, "inbound-late-negotiation") && switch_true(val)) {
- switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
+ sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION);
} else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
- switch_set_flag(profile, TFLAG_PROXY_MEDIA);
+ sofia_set_flag(profile, TFLAG_PROXY_MEDIA);
} else if (!strcasecmp(var, "force-subscription-expires")) {
int tmp = atoi(val);
if (tmp > 0) {
}
} else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_CALLID_AS_UUID;
+ sofia_set_pflag(profile, PFLAG_CALLID_AS_UUID);
} else {
- profile->pflags &= ~PFLAG_CALLID_AS_UUID;
+ sofia_clear_pflag(profile, PFLAG_CALLID_AS_UUID);
}
} else if (!strcasecmp(var, "outbound-use-uuid-as-callid")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_UUID_AS_CALLID;
+ sofia_set_pflag(profile, PFLAG_UUID_AS_CALLID);
} else {
- profile->pflags &= ~PFLAG_UUID_AS_CALLID;
+ sofia_clear_pflag(profile, PFLAG_UUID_AS_CALLID);
}
} else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact") && switch_true(val)) {
- profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+ sofia_set_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
} else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
- profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
+ sofia_set_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
} else if (!strcasecmp(var, "disable-rtp-auto-adjust") && switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_RTP_AUTOADJ;
+ sofia_set_pflag(profile, PFLAG_DISABLE_RTP_AUTOADJ);
} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth") && switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_SRTP_AUTH;
+ sofia_set_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
} else if (!strcasecmp(var, "NDLB-funny-stun")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_FUNNY_STUN;
+ sofia_set_pflag(profile, PFLAG_FUNNY_STUN);
} else {
- profile->pflags &= ~PFLAG_FUNNY_STUN;
+ sofia_clear_pflag(profile, PFLAG_FUNNY_STUN);
}
} else if (!strcasecmp(var, "stun-enabled")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_STUN_ENABLED;
+ sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
} else {
- profile->pflags &= ~PFLAG_STUN_ENABLED;
+ sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
}
} else if (!strcasecmp(var, "stun-auto-disable")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_STUN_AUTO_DISABLE;
+ sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
} else {
- profile->pflags &= ~PFLAG_STUN_AUTO_DISABLE;
+ sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
}
} else if (!strcasecmp(var, "rfc2833-pt")) {
profile->te = (switch_payload_t) atoi(val);
- } else if (!strcasecmp(var, "cng-pt") && !(profile->pflags & PFLAG_SUPPRESS_CNG)) {
+ } else if (!strcasecmp(var, "cng-pt") && !sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG)) {
profile->cng_pt = (switch_payload_t) atoi(val);
} else if (!strcasecmp(var, "sip-port")) {
profile->sip_port = atoi(val);
} else if (!strcasecmp(var, "vad")) {
if (!strcasecmp(val, "in")) {
- switch_set_flag(profile, TFLAG_VAD_IN);
+ sofia_set_flag(profile, TFLAG_VAD_IN);
} else if (!strcasecmp(val, "out")) {
- switch_set_flag(profile, TFLAG_VAD_OUT);
+ sofia_set_flag(profile, TFLAG_VAD_OUT);
} else if (!strcasecmp(val, "both")) {
- switch_set_flag(profile, TFLAG_VAD_IN);
- switch_set_flag(profile, TFLAG_VAD_OUT);
+ sofia_set_flag(profile, TFLAG_VAD_IN);
+ sofia_set_flag(profile, TFLAG_VAD_OUT);
} else if (strcasecmp(val, "none")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
}
}
} else if (!strcasecmp(var, "unregister-on-options-fail")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_UNREG_OPTIONS_FAIL;
+ sofia_set_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL);
}
} else if (!strcasecmp(var, "require-secure-rtp")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_SECURE;
+ sofia_set_pflag(profile, PFLAG_SECURE);
}
} else if (!strcasecmp(var, "multiple-registrations")) {
if (!strcasecmp(val, "call-id")) {
- profile->pflags |= PFLAG_MULTIREG;
+ sofia_set_pflag(profile, PFLAG_MULTIREG);
} else if (!strcasecmp(val, "contact") || switch_true(val)) {
- profile->pflags |= PFLAG_MULTIREG;
- profile->pflags |= PFLAG_MULTIREG_CONTACT;
+ sofia_set_pflag(profile, PFLAG_MULTIREG);
+ sofia_set_pflag(profile, PFLAG_MULTIREG_CONTACT);
} else if (switch_true(val)) {
- profile->pflags &= ~PFLAG_MULTIREG;
- //profile->pflags &= ~PFLAG_MULTIREG_CONTACT;
+ sofia_clear_pflag(profile, PFLAG_MULTIREG);
+ //sofia_clear_pflag(profile, PFLAG_MULTIREG_CONTACT);
}
} else if (!strcasecmp(var, "supress-cng") || !strcasecmp(var, "suppress-cng")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_SUPPRESS_CNG;
+ sofia_set_pflag(profile, PFLAG_SUPPRESS_CNG);
profile->cng_pt = 0;
}
} else if (!strcasecmp(var, "NDLB-to-in-200-contact")) {
}
} else if (!strcasecmp(var, "pass-rfc2833")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_PASS_RFC2833;
+ sofia_set_pflag(profile, PFLAG_PASS_RFC2833);
}
} else if (!strcasecmp(var, "inbound-codec-negotiation")) {
if (!strcasecmp(val, "greedy")) {
- profile->pflags |= PFLAG_GREEDY;
+ sofia_set_pflag(profile, PFLAG_GREEDY);
}
} else if (!strcasecmp(var, "disable-transcoding")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_TRANSCODING;
+ sofia_set_pflag(profile, PFLAG_DISABLE_TRANSCODING);
}
} else if (!strcasecmp(var, "rtp-rewrite-timestamps")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_REWRITE_TIMESTAMPS;
+ sofia_set_pflag(profile, PFLAG_REWRITE_TIMESTAMPS);
}
} else if (!strcasecmp(var, "auth-calls")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_AUTH_CALLS;
+ sofia_set_pflag(profile, PFLAG_AUTH_CALLS);
}
} else if (!strcasecmp(var, "nonce-ttl")) {
profile->nonce_ttl = atoi(val);
} else if (!strcasecmp(var, "accept-blind-reg")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_BLIND_REG;
+ sofia_set_pflag(profile, PFLAG_BLIND_REG);
}
} else if (!strcasecmp(var, "enable-3pcc")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_3PCC;
+ sofia_set_pflag(profile, PFLAG_3PCC);
}
else if(!strcasecmp(val, "proxy")){
- profile->pflags |= PFLAG_3PCC_PROXY;
+ sofia_set_pflag(profile, PFLAG_3PCC_PROXY);
}
} else if (!strcasecmp(var, "accept-blind-auth")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_BLIND_AUTH;
+ sofia_set_pflag(profile, PFLAG_BLIND_AUTH);
}
} else if (!strcasecmp(var, "auth-all-packets")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_AUTH_ALL;
+ sofia_set_pflag(profile, PFLAG_AUTH_ALL);
}
} else if (!strcasecmp(var, "full-id-in-dialplan")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_FULL_ID;
+ sofia_set_pflag(profile, PFLAG_FULL_ID);
}
} else if (!strcasecmp(var, "inbound-reg-force-matching-username")) {
if (switch_true(val)) {
- profile->pflags |= PFLAG_CHECKUSER;
+ sofia_set_pflag(profile, PFLAG_CHECKUSER);
}
} else if (!strcasecmp(var, "enable-timer")) {
if (!switch_true(val)) {
- profile->pflags |= PFLAG_DISABLE_TIMER;
+ sofia_set_pflag(profile, PFLAG_DISABLE_TIMER);
}
} else if (!strcasecmp(var, "minimum-session-expires")) {
profile->minimum_session_expires = atoi(val);
}
} else if (!strcasecmp(var, "enable-100rel")) {
if (switch_true(val)) {
- profile->pflags &= ~PFLAG_DISABLE_100REL;
+ sofia_clear_pflag(profile, PFLAG_DISABLE_100REL);
}
} else if (!strcasecmp(var, "bitpacking")) {
if (!strcasecmp(val, "aal2")) {
gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq;
sofia_reg_release_gateway(gateway);
gateway->pinging = 0;
- } else if ((profile->pflags & PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
+ } else if (sofia_test_pflag(profile, PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
char *sql;
time_t now = switch_epoch_time_now(NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n",
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- if (!switch_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
return;
}
- switch_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
const char *r_sdp = NULL;
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
if (switch_core_session_compare(session, other_session)) {
- switch_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+ sofia_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
switch_ivr_media(switch_core_session_get_uuid(other_session), SMF_REBRIDGE);
if (tech_pvt->rtp_session) {
if (r_sdp) {
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+ sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_channel_mark_pre_answered(channel);
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
goto done;
} else {
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
- } else if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
+ } else if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
} else {
if (sofia_glue_tech_media(tech_pvt, (char *) r_sdp) != SWITCH_STATUS_SUCCESS) {
nua_ack(nh, TAG_END());
break;
case nua_callstate_received:
- if (!switch_test_flag(tech_pvt, TFLAG_SDP)) {
- if (r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_SDP)) {
+ if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOMEDIA");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_channel_get_state(channel) == CS_NEW) {
switch_channel_set_state(channel, CS_INIT);
}
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
goto done;
} else if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_channel_get_state(channel) == CS_NEW) {
switch_channel_set_state(channel, CS_INIT);
}
- } else if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
+ } else if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_channel_get_state(channel) == CS_NEW) {
switch_channel_set_state(channel, CS_INIT);
}
sip_replaces_t *replaces;
su_home_t *home = NULL;
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (switch_channel_get_state(channel) == CS_NEW) {
switch_channel_set_state(channel, CS_INIT);
}
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
if (replaces_str) {
home = su_home_new(sizeof(*home));
switch_assert(home != NULL);
if (br_b) {
switch_ivr_uuid_bridge(br_a, br_b);
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
- switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
switch_channel_hangup(channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
} else {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
goto done;
} else {
- if (profile->pflags & PFLAG_3PCC) {
+ if (sofia_test_pflag(profile, PFLAG_3PCC)) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
sofia_glue_tech_choose_port(tech_pvt, 0);
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
- switch_set_flag_locked(tech_pvt, TFLAG_3PCC);
+ sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
switch_channel_set_state(channel, CS_HIBERNATE);
nua_respond(tech_pvt->nh, SIP_200_OK,
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
- TAG_IF((profile->pflags & PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
- } else if(profile->pflags & PFLAG_3PCC_PROXY){
+ TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+ } else if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
//3PCC proxy mode delays the 200 OK until the call is answered
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
- switch_set_flag_locked(tech_pvt, TFLAG_3PCC);
+ sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
sofia_glue_tech_choose_port(tech_pvt, 0);
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
switch_channel_set_flag(channel, TFLAG_LATE_NEGOTIATION);
}
}
- } else if (tech_pvt && switch_test_flag(tech_pvt, TFLAG_SDP) && !r_sdp) {
+ } else if (tech_pvt && sofia_test_flag(tech_pvt, TFLAG_SDP) && !r_sdp) {
nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
- switch_set_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
goto done;
} else {
ss_state = nua_callstate_completed;
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
- TAG_IF((profile->pflags & PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+ TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
launch_media_on_hold(session);
switch_core_session_rwunlock(other_session);
msg.string_arg = (char *) r_sdp;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Passing SDP to other leg.\n%s\n", r_sdp);
- if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
if (!switch_stristr("sendonly", r_sdp)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
}
} else if (switch_stristr("sendonly", r_sdp)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
}
goto done;
}
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
- switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Reinvite RTP Error!\n");
is_ok = 0;
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
- TAG_IF((profile->pflags & PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+ TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
} else {
nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
}
break;
case nua_callstate_ready:
- if (r_sdp && switch_test_flag(tech_pvt, TFLAG_NOSDP_REINVITE)) {
+ if (r_sdp && sofia_test_flag(tech_pvt, TFLAG_NOSDP_REINVITE)) {
sdp_parser_t *parser;
sdp_session_t *sdp;
uint8_t match = 0;
int is_ok = 1;
- switch_clear_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
if (tech_pvt->num_codecs) {
if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
}
if (match) {
- switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Error!\n");
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RTP ERROR");
is_ok = 0;
}
- switch_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
} else {
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
is_ok = 0;
}
if (tech_pvt && nh == tech_pvt->nh2) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cheater Reinvite!\n");
- switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
tech_pvt->nh = tech_pvt->nh2;
tech_pvt->nh2 = NULL;
if (sofia_glue_tech_choose_port(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
}
if (channel) {
- if (switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
- switch_set_flag_locked(tech_pvt, TFLAG_ANS);
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ if (sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
+ sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
switch_channel_mark_answered(channel);
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
goto done;
}
- if (!r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
+ if (!r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
r_sdp = (const char *) switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
}
- if (r_sdp && !switch_test_flag(tech_pvt, TFLAG_SDP)) {
+ if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
- switch_set_flag_locked(tech_pvt, TFLAG_ANS);
- switch_set_flag_locked(tech_pvt, TFLAG_SDP);
+ sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SDP);
switch_channel_mark_answered(channel);
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
}
if (match) {
- switch_set_flag_locked(tech_pvt, TFLAG_ANS);
+ sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
if (sofia_glue_tech_choose_port(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
if (sofia_glue_activate_rtp(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
switch_channel_mark_answered(channel);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
}
- if (switch_test_flag(tech_pvt, TFLAG_3PCC)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
/* Check if we are in 3PCC proxy mode, if so then set the flag to indicate we received the ack */
- if (profile->pflags & PFLAG_3PCC_PROXY ) {
+ if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY )) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
- switch_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
+ sofia_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
} else if (switch_channel_get_state(channel) == CS_HIBERNATE) {
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
switch_channel_set_state(channel, CS_INIT);
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ sofia_set_flag(tech_pvt, TFLAG_SDP);
}
}
goto done;
case nua_callstate_terminating:
if (status == 488 || switch_channel_get_state(channel) == CS_HIBERNATE) {
tech_pvt->q850_cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
- } else if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ } else if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
}
break;
case nua_callstate_terminated:
- if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
- if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
+ if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
+ if (sofia_test_flag(tech_pvt, TFLAG_NOHUP)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
} else {
int cause;
if (tech_pvt->q850_cause) {
tuuid_str = switch_core_session_get_uuid(tsession);
switch_ivr_uuid_bridge(nhelper->bridge_to_uuid, tuuid_str);
switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
- switch_set_flag_locked(tech_pvt, TFLAG_BYE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(nhelper->event), TAG_END());
switch_core_session_rwunlock(tsession);
char *rep;
full_ref_to = sip_header_as_string(home, (void *) sip->sip_refer_to);
- if (profile->pflags & PFLAG_FULL_ID) {
+ if (sofia_test_pflag(profile, PFLAG_FULL_ID)) {
exten = switch_core_session_sprintf(session, "%s@%s", (char *) refer_to->r_url->url_user, (char *) refer_to->r_url->url_host);
} else {
exten = (char *) refer_to->r_url->url_user;
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
- switch_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
- switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+ sofia_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
switch_channel_set_variable(switch_core_session_get_channel(b_session), "park_timeout", "2");
switch_channel_set_state(switch_core_session_get_channel(b_session), CS_PARK);
private_object_t *h_tech_pvt = (private_object_t *) switch_core_session_get_private(b_session);
t_session = switch_core_session_locate(br_b);
hup_channel = channel_a;
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
- switch_clear_flag_locked(h_tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(h_tech_pvt, TFLAG_SIP_HOLD);
switch_channel_hangup(channel_b, SWITCH_CAUSE_ATTENDED_TRANSFER);
}
char *is_nat = NULL;
char *acl_token = NULL;
- if (sess_count >= sess_max || !(profile->pflags & PFLAG_RUNNING)) {
+ if (sess_count >= sess_max || !sofia_test_pflag(profile, PFLAG_RUNNING)) {
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
return;
}
get_addr(network_ip, sizeof(network_ip), my_addrinfo->ai_addr, my_addrinfo->ai_addrlen);
network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
- if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+ if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) {
if (sip && sip->sip_via) {
const char *port = sip->sip_via->v_port;
const char *host = sip->sip_via->v_host;
if (token) {
acl_token = strdup(token);
}
- if ((profile->pflags & PFLAG_AUTH_CALLS)) {
+ if (sofia_test_pflag(profile, PFLAG_AUTH_CALLS)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl \"%s[%s]\". Access Granted.\n",
network_ip, switch_str_nil(last_acl), switch_str_nil(acl_token));
is_auth = 1;
}
} else {
- if (!(profile->pflags & PFLAG_AUTH_CALLS)) {
+ if (!sofia_test_pflag(profile, PFLAG_AUTH_CALLS)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", network_ip, switch_str_nil(last_acl));
nua_respond(nh, SIP_403_FORBIDDEN, TAG_END());
return;
}
if (!is_auth &&
- ((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
+ (sofia_test_pflag(profile, PFLAG_AUTH_CALLS) || (!sofia_test_pflag(profile, PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
calling_myself++;
} else {
}
if (sofia_endpoint_interface) {
- if (profile->pflags & PFLAG_CALLID_AS_UUID) {
+ if (sofia_test_pflag(profile, PFLAG_CALLID_AS_UUID)) {
session = switch_core_session_request_uuid(sofia_endpoint_interface, NULL, sip->sip_call_id->i_id);
} else {
session = switch_core_session_request(sofia_endpoint_interface, NULL);
if (sip->sip_request->rq_url) {
const char *req_uri = url_set_chanvars(session, sip->sip_request->rq_url, sip_req);
- if (profile->pflags & PFLAG_FULL_ID) {
+ if (sofia_test_pflag(profile, PFLAG_FULL_ID)) {
destination_number = req_uri;
} else {
destination_number = sip->sip_request->rq_url->url_user;
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "INBOUND CALL");
- if (switch_test_flag(tech_pvt, TFLAG_INB_NOMEDIA)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_INB_NOMEDIA)) {
switch_channel_set_flag(channel, CF_PROXY_MODE);
}
- if (switch_test_flag(tech_pvt, TFLAG_PROXY_MEDIA)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_PROXY_MEDIA)) {
switch_channel_set_flag(channel, CF_PROXY_MEDIA);
}
if (!one_leg &&
- (!b_tech_pvt || !switch_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) &&
- (!c_tech_pvt || !switch_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) {
+ (!b_tech_pvt || !sofia_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) &&
+ (!c_tech_pvt || !sofia_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) {
char *ext = switch_core_session_sprintf(b_session, "conference:%s@sla+flags{mintwo}", uuid);
switch_channel_set_flag(c_channel, CF_REDIRECT);
if (rpid) {
if (rpid->rpid_privacy) {
if (!strcasecmp(rpid->rpid_privacy, "yes")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
+ sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
} else if (!strcasecmp(rpid->rpid_privacy, "full")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
+ sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
} else if (!strcasecmp(rpid->rpid_privacy, "name")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
+ sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
} else if (!strcasecmp(rpid->rpid_privacy, "number")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NUMBER);
+ sofia_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);
if ((privacy = sip_privacy(sip))) {
if(msg_params_find(privacy->priv_values, "id")) {
- switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
+ sofia_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
}
}
}
if (is_nat) {
- switch_set_flag(tech_pvt, TFLAG_NAT);
+ sofia_set_flag(tech_pvt, TFLAG_NAT);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting NAT mode based on %s\n", is_nat);
switch_channel_set_variable(channel, "sip_nat_detected", "true");
}
"m=audio %d RTP/%sAVP",
tech_pvt->owner_id, tech_pvt->session_id, family, ip, family, ip, port,
(!switch_strlen_zero(tech_pvt->local_crypto_key)
- && switch_test_flag(tech_pvt,TFLAG_SECURE)) ? "S" : "");
+ && sofia_test_flag(tech_pvt,TFLAG_SECURE)) ? "S" : "");
if (tech_pvt->rm_encoding) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
}
- if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
}
if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
}
- if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt);
if (!tech_pvt->rm_encoding) {
tech_pvt->cng_pt = 0;
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr);
}
- if (!switch_strlen_zero(tech_pvt->local_crypto_key) && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
+ if (!switch_strlen_zero(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key);
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
#if 0
#endif
}
- if (switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_VIDEO)) {
if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && !switch_channel_test_flag(tech_pvt->channel, CF_EARLY_MEDIA) &&
!tech_pvt->local_sdp_video_port) {
sofia_glue_tech_choose_video_port(tech_pvt, 0);
}
if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
- if (!codec_string || (tech_pvt->profile->pflags & PFLAG_DISABLE_TRANSCODING)) {
+ if (!codec_string || sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_TRANSCODING)) {
codec_string = ocodec;
} else {
if (!(codec_string = switch_core_session_sprintf(tech_pvt->session, "%s,%s", ocodec, codec_string))) {
void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
{
- if (tech_pvt->num_codecs && !switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
+ if (tech_pvt->num_codecs && !sofia_test_flag(tech_pvt, TFLAG_VIDEO)) {
int i;
tech_pvt->video_count = 0;
for (i = 0; i < tech_pvt->num_codecs; i++) {
}
}
if (tech_pvt->video_count) {
- switch_set_flag_locked(tech_pvt, TFLAG_VIDEO);
+ sofia_set_flag_locked(tech_pvt, TFLAG_VIDEO);
}
}
}
tech_pvt->dtmf_type = profile->dtmf_type;
- if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG)) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
if (tech_pvt->bcng_pt) {
tech_pvt->cng_pt = tech_pvt->bcng_pt;
} else if (!tech_pvt->cng_pt) {
} else if (!strncasecmp(sourceip, "stun:", 5)) {
char *p;
- if (!(profile->pflags & PFLAG_STUN_ENABLED)) {
+ if (!sofia_test_pflag(profile, PFLAG_STUN_ENABLED)) {
*ip = switch_core_strdup(pool, tech_pvt->profile->rtpip);
return SWITCH_STATUS_SUCCESS;
}
}
for (x = 0; x < 5; x++) {
- if ((profile->pflags & PFLAG_FUNNY_STUN) ||
+ if (sofia_test_pflag(profile, PFLAG_FUNNY_STUN) ||
(tech_pvt && (var = switch_channel_get_variable(tech_pvt->channel, "funny_stun")) && switch_true(var))) {
error = "funny";
funny++;
if (tech_pvt) {
if (myport == *port && !strcmp(*ip, tech_pvt->profile->rtpip)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "STUN Not Required ip and port match. [%s]:[%d]\n", *ip, *port);
- if (profile->pflags & PFLAG_STUN_AUTO_DISABLE) {
- profile->pflags &= ~PFLAG_STUN_ENABLED;
+ if (sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE)) {
+ sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "STUN completely disabled.\n");
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote video address:port [%s:%d] has not changed.\n",
tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
} else {
- switch_set_flag_locked(tech_pvt, TFLAG_VIDEO);
+ sofia_set_flag_locked(tech_pvt, TFLAG_VIDEO);
switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
if (switch_rtp_set_remote_address(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip,
switch_assert(tech_pvt != NULL);
- switch_clear_flag_locked(tech_pvt, TFLAG_SDP);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SDP);
caller_profile = switch_channel_get_caller_profile(channel);
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ sofia_set_flag_locked(tech_pvt, TFLAG_READY);
if (!tech_pvt->nh) {
char *d_url = NULL, *url = NULL;
}
if (!(call_id = switch_channel_get_variable(channel, "sip_outgoing_call_id"))) {
- if (tech_pvt->profile->pflags & PFLAG_UUID_AS_CALLID) {
+ if (sofia_test_pflag(tech_pvt->profile, PFLAG_UUID_AS_CALLID)) {
call_id = switch_core_session_get_uuid(session);
}
}
if (tech_pvt->dest && (strstr(tech_pvt->dest, ";fs_nat") || strstr(tech_pvt->dest, ";received")
|| ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val)))) {
- switch_set_flag(tech_pvt, TFLAG_NAT);
+ sofia_set_flag(tech_pvt, TFLAG_NAT);
tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
route_uri = tech_pvt->record_route;
session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
}
/* TODO: We should use the new tags for making an rpid and add profile options to turn this on/off */
- if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
+ if (sofia_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
priv = "name";
- if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
+ if (sofia_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
priv = "full";
}
- } else if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
+ } else if (sofia_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
priv = "full";
}
- if (switch_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
+ if (sofia_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
screen = "yes";
}
free(e_dest);
}
- holdstr = switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) ? "*" : "";
+ holdstr = sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD) ? "*" : "";
if (!switch_channel_get_variable(channel, "sofia_profile_name")) {
switch_channel_set_variable(channel, "sofia_profile_name", tech_pvt->profile->name);
{
int loops = 0;
if (switch_rtp_ready(tech_pvt->rtp_session)) {
- while (loops < 10 && (switch_test_flag(tech_pvt, TFLAG_READING) || switch_test_flag(tech_pvt, TFLAG_WRITING))) {
+ while (loops < 10 && (sofia_test_flag(tech_pvt, TFLAG_READING) || sofia_test_flag(tech_pvt, TFLAG_WRITING))) {
switch_yield(10000);
loops++;
}
}
if ((var = switch_channel_get_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
- switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
}
goto end;
}
- if (switch_rtp_ready(tech_pvt->rtp_session) && !switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
+ if (switch_rtp_ready(tech_pvt->rtp_session) && !sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
status = SWITCH_STATUS_SUCCESS;
goto end;
}
}
}
- if ((tech_pvt->profile->pflags & PFLAG_PASS_RFC2833)
+ if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_RFC2833)
|| ((val = switch_channel_get_variable(tech_pvt->channel, "pass_rfc2833")) && switch_true(val))) {
flags |= SWITCH_RTP_FLAG_PASS_RFC2833;
}
- if (!((tech_pvt->profile->pflags & PFLAG_REWRITE_TIMESTAMPS) ||
+ if (!(sofia_test_pflag(tech_pvt->profile, PFLAG_REWRITE_TIMESTAMPS) ||
((val = switch_channel_get_variable(tech_pvt->channel, "rtp_rewrite_timestamps")) && !switch_true(val)))) {
flags |= SWITCH_RTP_FLAG_RAW_WRITE;
}
- if (tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) {
+ if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
tech_pvt->cng_pt = 0;
} else if (tech_pvt->cng_pt) {
flags |= SWITCH_RTP_FLAG_AUTO_CNG;
}
- if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
+ if (tech_pvt->rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
//const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
//const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
- if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
- switch_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
+ if (tech_pvt->rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
+ sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, SWITCH_TRUE, &err) !=
SWITCH_STATUS_SUCCESS) {
(switch_rtp_flag_t) flags, timer_name, &err, switch_core_session_get_pool(tech_pvt->session));
if (switch_rtp_ready(tech_pvt->rtp_session)) {
- uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
- uint8_t vad_out = switch_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
- uint8_t inb = switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
+ uint8_t vad_in = sofia_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
+ uint8_t vad_out = sofia_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
+ uint8_t inb = sofia_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
uint32_t stun_ping = 0;
if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_enable_vad_in")) && switch_true(val)) {
}
tech_pvt->ssrc = switch_rtp_get_ssrc(tech_pvt->rtp_session);
- switch_set_flag(tech_pvt, TFLAG_RTP);
- switch_set_flag(tech_pvt, TFLAG_IO);
+ sofia_set_flag(tech_pvt, TFLAG_RTP);
+ sofia_set_flag(tech_pvt, TFLAG_IO);
switch_rtp_intentional_bugs(tech_pvt->rtp_session, tech_pvt->rtp_bugs);
if ((vad_in && inb) || (vad_out && !inb)) {
switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING);
- switch_set_flag(tech_pvt, TFLAG_VAD);
+ sofia_set_flag(tech_pvt, TFLAG_VAD);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP Engage VAD for %s ( %s %s )\n",
switch_channel_get_name(switch_core_session_get_channel(tech_pvt->session)), vad_in ? "in" : "", vad_out ? "out" : "");
}
tech_pvt->cng_pt = 0;
}
- if (tech_pvt->cng_pt && !(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG)) {
+ if (tech_pvt->cng_pt && !sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", tech_pvt->cng_pt);
switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt);
}
- if (tech_pvt->remote_crypto_key && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
+ if (tech_pvt->remote_crypto_key && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->crypto_type, tech_pvt->local_raw_key,
SWITCH_RTP_KEY_LEN);
sofia_glue_check_video_codecs(tech_pvt);
- if (switch_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) {
+ if (sofia_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) {
if (!tech_pvt->local_sdp_video_port) {
sofia_glue_tech_choose_video_port(tech_pvt, 1);
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err));
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_IO);
status = SWITCH_STATUS_FALSE;
goto end;
}
- switch_set_flag(tech_pvt, TFLAG_IO);
+ sofia_set_flag(tech_pvt, TFLAG_IO);
status = SWITCH_STATUS_SUCCESS;
end:
return SWITCH_STATUS_FALSE;
}
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA");
- switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
+ sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_channel_mark_pre_answered(tech_pvt->channel);
return SWITCH_STATUS_SUCCESS;
}
void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly)
{
if (sendonly && switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED)) {
- if (!switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+ if (!sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
const char *stream;
- switch_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
if (tech_pvt->max_missed_hold_packets) {
}
}
} else {
- if (switch_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
- switch_set_flag(tech_pvt, TFLAG_SIP_HOLD);
+ if (sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
+ sofia_set_flag(tech_pvt, TFLAG_SIP_HOLD);
}
- switch_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
- if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
+ if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
const char *uuid;
switch_core_session_t *b_session;
switch_core_session_rwunlock(b_session);
}
- switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
+ sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
}
}
switch_assert(tech_pvt != NULL);
- greedy = !!(tech_pvt->profile->pflags & PFLAG_GREEDY);
+ greedy = !!sofia_test_pflag(tech_pvt->profile, PFLAG_GREEDY);
if (!greedy) {
if ((val = switch_channel_get_variable(channel, "sip_codec_negotiation")) && !strcasecmp(val, "greedy")) {
tech_pvt->remote_crypto_key = switch_core_session_strdup(tech_pvt->session, crypto);
tech_pvt->crypto_tag = crypto_tag;
- if (switch_rtp_ready(tech_pvt->rtp_session) && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
+ if (switch_rtp_ready(tech_pvt->rtp_session) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag,
tech_pvt->crypto_type, tech_pvt->remote_raw_key, SWITCH_RTP_KEY_LEN);
}
}
- if (!(tech_pvt->profile->pflags & PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
+ if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && !cng_pt && !strcasecmp(rm_encoding, "CN")) {
cng_pt = (switch_payload_t) map->rm_pt;
if (tech_pvt->rtp_session) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", cng_pt);
done:
tech_pvt->cng_pt = cng_pt;
- switch_set_flag_locked(tech_pvt, TFLAG_SDP);
+ sofia_set_flag_locked(tech_pvt, TFLAG_SDP);
return match;
}
other_channel = switch_core_session_get_channel(other_session);
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
- if (!switch_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
+ if (!sofia_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND) &&
switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE))) {
switch_ivr_nomedia(val, SMF_FORCE);
- switch_set_flag_locked(tech_pvt, TFLAG_CHANGE_MEDIA);
+ sofia_set_flag_locked(tech_pvt, TFLAG_CHANGE_MEDIA);
}
switch_core_session_rwunlock(other_session);
}
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if ((profile = (sofia_profile_t *) switch_core_hash_find(mod_sofia_globals.profile_hash, key))) {
- if (!(profile->pflags & PFLAG_RUNNING)) {
+ if (!sofia_test_pflag(profile, PFLAG_RUNNING)) {
#ifdef SOFIA_DEBUG_RWLOCKS
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is not running\n", profile->name);
#endif