mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 21:22:09 +00:00
FS-9924: Removed extra space in source files
This commit is contained in:
@@ -495,9 +495,9 @@
|
||||
really need to change this.
|
||||
-->
|
||||
<!-- <param name="renegotiate-codec-on-hold" value="true"/> -->
|
||||
<!-- Turn on proxy hold when proxy media and proxy mode are disabled
|
||||
<!-- Turn on proxy hold when proxy media and proxy mode are disabled
|
||||
By default it is not set
|
||||
-->
|
||||
-->
|
||||
<!-- <param name="proxy-hold" value="true"/> -->
|
||||
<!-- Choose the proxy notify events. Default is not set
|
||||
|
||||
|
||||
@@ -674,17 +674,17 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
||||
switch_core_media_proxy_remote_addr(tech_pvt->session, NULL);
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||
"3PCC-PROXY nomedia - sending ack, SDP:\n%s\n", tech_pvt->mparams.local_sdp_str);
|
||||
|
||||
|
||||
|
||||
if (sofia_use_soa(tech_pvt)) {
|
||||
nua_ack(tech_pvt->nh,
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
|
||||
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
|
||||
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
|
||||
SOATAG_REUSE_REJECTED(1),
|
||||
SOATAG_RTP_SELECT(1),
|
||||
SOATAG_RTP_SELECT(1),
|
||||
SOATAG_AUDIO_AUX("cn telephone-event"),
|
||||
TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
|
||||
TAG_END());
|
||||
@@ -696,7 +696,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
||||
TAG_IF(tech_pvt->mparams.local_sdp_str, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
|
||||
TAG_IF(tech_pvt->mparams.local_sdp_str, SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str)),
|
||||
SOATAG_AUDIO_AUX("cn telephone-event"),
|
||||
TAG_END());
|
||||
TAG_END());
|
||||
}
|
||||
|
||||
|
||||
@@ -768,7 +768,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
||||
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
|
||||
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
|
||||
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
|
||||
SOATAG_REUSE_REJECTED(1),
|
||||
SOATAG_REUSE_REJECTED(1),
|
||||
SOATAG_RTP_SELECT(1),
|
||||
SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
|
||||
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
|
||||
@@ -897,7 +897,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
||||
}
|
||||
}
|
||||
|
||||
if ((tech_pvt->mparams.last_sdp_str && strstr(tech_pvt->mparams.last_sdp_str, "a=setup")) ||
|
||||
if ((tech_pvt->mparams.last_sdp_str && strstr(tech_pvt->mparams.last_sdp_str, "a=setup")) ||
|
||||
(tech_pvt->mparams.local_sdp_str && strstr(tech_pvt->mparams.local_sdp_str, "a=setup"))) {
|
||||
session_timeout = 0;
|
||||
}
|
||||
@@ -1457,7 +1457,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
switch (msg->message_id) {
|
||||
|
||||
case SWITCH_MESSAGE_INDICATE_DEFLECT: {
|
||||
|
||||
|
||||
char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_HEADER_PREFIX);
|
||||
char ref_to[1024] = "";
|
||||
const char *var;
|
||||
@@ -1498,18 +1498,18 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
if (!switch_channel_test_flag(channel, CF_AVPF) && switch_true(switch_core_get_variable("sofia_send_info_vid_refresh"))) {
|
||||
const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control><vc_primitive><to_encoder><picture_fast_update /></to_encoder></vc_primitive></media_control>\n";
|
||||
switch_time_t now = switch_micro_time_now();
|
||||
|
||||
|
||||
if (!tech_pvt->last_vid_info || (now - tech_pvt->last_vid_info) > 500000) {
|
||||
|
||||
|
||||
tech_pvt->last_vid_info = now;
|
||||
|
||||
|
||||
if (!zstr(msg->string_arg)) {
|
||||
pl = msg->string_arg;
|
||||
}
|
||||
|
||||
|
||||
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_BROADCAST:
|
||||
@@ -1648,10 +1648,10 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
|
||||
nua_invite(tech_pvt->nh,
|
||||
NUTAG_MEDIA_ENABLE(0),
|
||||
TAG_IF(msg->string_arg, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
|
||||
TAG_IF(msg->string_arg, SIPTAG_CONTENT_TYPE_STR("application/sdp")),
|
||||
SIPTAG_PAYLOAD_STR(msg->string_arg),
|
||||
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
|
||||
|
||||
|
||||
switch_safe_free(extra_headers);
|
||||
}
|
||||
break;
|
||||
@@ -1667,7 +1667,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
|
||||
sofia_glue_clear_soa(session, SWITCH_TRUE);
|
||||
|
||||
nua_invite(tech_pvt->nh, NUTAG_MEDIA_ENABLE(0), SIPTAG_PAYLOAD_STR(""),
|
||||
nua_invite(tech_pvt->nh, NUTAG_MEDIA_ENABLE(0), SIPTAG_PAYLOAD_STR(""),
|
||||
TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
|
||||
|
||||
switch_safe_free(extra_headers);
|
||||
@@ -1699,12 +1699,12 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
switch_core_media_set_sdp_codec_string(tech_pvt->session, r_sdp, SDP_TYPE_RESPONSE);
|
||||
switch_channel_set_variable(tech_pvt->channel, "absolute_codec_string", switch_channel_get_variable(tech_pvt->channel, "ep_codec_string"));
|
||||
switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
|
||||
|
||||
|
||||
if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
goto end_lock;
|
||||
}
|
||||
|
||||
|
||||
switch_core_media_gen_local_sdp(session, SDP_TYPE_REQUEST, NULL, 0, NULL, 1);
|
||||
|
||||
if (!msg->numeric_arg) {
|
||||
@@ -1737,7 +1737,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
|
||||
"Operation not permitted on an inbound non-answered call leg!\n");
|
||||
} else {
|
||||
full_to = switch_str_nil(switch_channel_get_variable(channel, "sip_full_to"));
|
||||
full_to = switch_str_nil(switch_channel_get_variable(channel, "sip_full_to"));
|
||||
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), NUTAG_SUBSTATE(nua_substate_active),
|
||||
TAG_IF((full_to), SIPTAG_TO_STR(full_to)),SIPTAG_SUBSCRIPTION_STATE_STR("active"),
|
||||
SIPTAG_EVENT_STR(event), TAG_END());
|
||||
@@ -2185,7 +2185,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
}
|
||||
goto end_lock;
|
||||
}
|
||||
|
||||
|
||||
if (code == 302 && !zstr(msg->string_arg)) {
|
||||
char *p;
|
||||
|
||||
@@ -3038,7 +3038,7 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre
|
||||
stream->write_function(stream, " <ping>%d</ping>\n", gp->ping);
|
||||
stream->write_function(stream, " <pingfreq>%d</pingfreq>\n", gp->ping_freq);
|
||||
stream->write_function(stream, " <pingmin>%d</pingmin>\n", gp->ping_min);
|
||||
stream->write_function(stream, " <pingcount>%d</pingcount>\n", gp->ping_count);
|
||||
stream->write_function(stream, " <pingcount>%d</pingcount>\n", gp->ping_count);
|
||||
stream->write_function(stream, " <pingmax>%d</pingmax>\n", gp->ping_max);
|
||||
stream->write_function(stream, " <pingtime>%0.2f</pingtime>\n", gp->ping_time);
|
||||
stream->write_function(stream, " <pinging>%d</pinging>\n", gp->pinging);
|
||||
@@ -3856,7 +3856,7 @@ static void select_from_profile(sofia_profile_t *profile,
|
||||
if (exclude_contact) {
|
||||
sql = switch_mprintf("select contact, profile_name, '%q' "
|
||||
"from sip_registrations where profile_name='%q' "
|
||||
"and upper(sip_user)=upper('%q') "
|
||||
"and upper(sip_user)=upper('%q') "
|
||||
"and (sip_host='%q' or presence_hosts like '%%%q%%') "
|
||||
"and contact not like '%%%q%%'", (concat != NULL) ? concat : "", profile->name, user, domain, domain, exclude_contact);
|
||||
} else {
|
||||
@@ -4511,14 +4511,14 @@ static int protect_dest_uri(switch_caller_profile_t *cp)
|
||||
go = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!go) return 0;
|
||||
|
||||
|
||||
*q++ = '\0';
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (!strncasecmp(q, "sips:", 5)) {
|
||||
q += 5;
|
||||
} else if (!strncasecmp(q, "sip:", 4)) {
|
||||
@@ -4537,7 +4537,7 @@ static int protect_dest_uri(switch_caller_profile_t *cp)
|
||||
switch_url_encode(q, qenc, enclen);
|
||||
mod = 1;
|
||||
}
|
||||
|
||||
|
||||
cp->destination_number = switch_core_sprintf(cp->pool, "%s/%s@%s", o, qenc ? qenc : q, e);
|
||||
|
||||
return mod;
|
||||
@@ -5727,7 +5727,7 @@ static void general_queue_event_handler(switch_event_t *event)
|
||||
void write_csta_xml_chunk(switch_event_t *event, switch_stream_handle_t stream, const char *csta_event, char *fwdtype)
|
||||
{
|
||||
const char *device = switch_event_get_header(event, "device");
|
||||
|
||||
|
||||
switch_assert(csta_event);
|
||||
|
||||
stream.write_function(&stream, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<%s xmlns=\"http://www.ecma-international.org/standards/ecma-323/csta/ed3\">\n", csta_event);
|
||||
@@ -6263,7 +6263,7 @@ void mod_sofia_shutdown_cleanup() {
|
||||
switch_event_free_subclass(MY_EVENT_REGISTER);
|
||||
switch_event_free_subclass(MY_EVENT_GATEWAY_ADD);
|
||||
switch_event_free_subclass(MY_EVENT_BYE_RESPONSE);
|
||||
|
||||
|
||||
switch_console_del_complete_func("::sofia::list_profiles");
|
||||
switch_console_set_complete("del sofia");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Mathieu Rene <mrene@avgs.ca>
|
||||
*
|
||||
* rtp.c -- RTP Controllable Channel Module
|
||||
@@ -53,24 +53,24 @@ typedef struct {
|
||||
switch_channel_t *channel;
|
||||
switch_codec_t read_codec, write_codec;
|
||||
switch_frame_t read_frame;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
switch_rtp_bug_flag_t rtp_bugs;
|
||||
switch_rtp_t *rtp_session;
|
||||
|
||||
|
||||
uint32_t timestamp_send;
|
||||
|
||||
|
||||
const char *local_address;
|
||||
const char *remote_address;
|
||||
const char *codec;
|
||||
int ptime;
|
||||
|
||||
|
||||
const switch_codec_implementation_t *negotiated_codecs[SWITCH_MAX_CODECS];
|
||||
int num_negotiated_codecs;
|
||||
|
||||
|
||||
char *origin;
|
||||
|
||||
|
||||
switch_port_t local_port;
|
||||
switch_port_t remote_port;
|
||||
switch_payload_t agreed_pt; /*XXX*/
|
||||
@@ -86,7 +86,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session);
|
||||
static switch_status_t channel_on_destroy(switch_core_session_t *session);
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session,
|
||||
switch_core_session_t **new_session,
|
||||
switch_memory_pool_t **pool,
|
||||
switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
|
||||
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
|
||||
@@ -141,25 +141,25 @@ void crtp_init(switch_loadable_module_interface_t *module_interface)
|
||||
endpoint_interface->io_routines = &crtp_io_routines;
|
||||
endpoint_interface->state_handler = &crtp_state_handlers;
|
||||
crtp.endpoint_interface = endpoint_interface;
|
||||
|
||||
|
||||
//SWITCH_ADD_API(api_interface, "rtp_test", "test", test_function, "");
|
||||
}
|
||||
|
||||
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
|
||||
switch_caller_profile_t *outbound_profile,
|
||||
switch_core_session_t **new_session,
|
||||
switch_core_session_t **new_session,
|
||||
switch_memory_pool_t **pool,
|
||||
switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
|
||||
{
|
||||
switch_channel_t *channel;
|
||||
char name[128];
|
||||
crtp_private_t *tech_pvt = NULL;
|
||||
crtp_private_t *tech_pvt = NULL;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
switch_rtp_flag_t rtp_flags[SWITCH_RTP_FLAG_INVALID] = {0};
|
||||
|
||||
|
||||
const char *err;
|
||||
|
||||
|
||||
|
||||
const char *local_addr = switch_event_get_header_nil(var_event, kLOCALADDR),
|
||||
*szlocal_port = switch_event_get_header_nil(var_event, kLOCALPORT),
|
||||
*remote_addr = switch_event_get_header_nil(var_event, kREMOTEADDR),
|
||||
@@ -170,33 +170,33 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
//*szrfc2833_pt = switch_event_get_header_nil(var_event, kRFC2833PT),
|
||||
*szrate = switch_event_get_header_nil(var_event, kRATE),
|
||||
*szpt = switch_event_get_header_nil(var_event, kPT);
|
||||
|
||||
|
||||
|
||||
|
||||
switch_port_t local_port = !zstr(szlocal_port) ? (switch_port_t)atoi(szlocal_port) : 0,
|
||||
remote_port = !zstr(szremote_port) ? (switch_port_t)atoi(szremote_port) : 0;
|
||||
|
||||
|
||||
int ptime = !zstr(szptime) ? atoi(szptime) : 0,
|
||||
//rfc2833_pt = !zstr(szrfc2833_pt) ? atoi(szrfc2833_pt) : 0,
|
||||
rate = !zstr(szrate) ? atoi(szrate) : 8000,
|
||||
pt = !zstr(szpt) ? atoi(szpt) : 0;
|
||||
|
||||
|
||||
if (
|
||||
((zstr(remote_addr) || remote_port == 0) && (zstr(local_addr) || local_port == 0)) ||
|
||||
zstr(codec) ||
|
||||
zstr(szpt)) {
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required arguments\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (!(*new_session = switch_core_session_request(crtp.endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, 0, pool))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't request session.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
channel = switch_core_session_get_channel(*new_session);
|
||||
|
||||
|
||||
tech_pvt = switch_core_session_alloc(*new_session, sizeof *tech_pvt);
|
||||
tech_pvt->session = *new_session;
|
||||
tech_pvt->channel = channel;
|
||||
@@ -207,7 +207,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
tech_pvt->ptime = ptime;
|
||||
tech_pvt->agreed_pt = (switch_payload_t)pt;
|
||||
tech_pvt->dtmf_type = DTMF_2833; /* XXX */
|
||||
|
||||
|
||||
if (zstr(local_addr) || local_port == 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "The local address and port must be set\n");
|
||||
goto fail;
|
||||
@@ -216,16 +216,16 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
} else {
|
||||
tech_pvt->mode = RTP_SENDRECV;
|
||||
}
|
||||
|
||||
|
||||
switch_core_session_set_private(*new_session, tech_pvt);
|
||||
|
||||
|
||||
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
|
||||
switch_channel_set_caller_profile(channel, caller_profile);
|
||||
|
||||
|
||||
|
||||
|
||||
snprintf(name, sizeof(name), "rtp/%s", outbound_profile->destination_number);
|
||||
switch_channel_set_name(channel, name);
|
||||
|
||||
|
||||
switch_channel_set_state(channel, CS_INIT);
|
||||
|
||||
if (switch_core_codec_init(&tech_pvt->read_codec,
|
||||
@@ -247,50 +247,50 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||
rate,
|
||||
ptime,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/,
|
||||
SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/,
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (switch_core_session_set_read_codec(*new_session, &tech_pvt->read_codec) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set read codec?\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (switch_core_session_set_write_codec(*new_session, &tech_pvt->write_codec) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set write codec?\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (!(tech_pvt->rtp_session = switch_rtp_new(local_addr, local_port, remote_addr, remote_port, tech_pvt->agreed_pt,
|
||||
tech_pvt->read_codec.implementation->samples_per_packet, ptime * 1000,
|
||||
rtp_flags, "soft", &err, switch_core_session_get_pool(*new_session)))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't setup RTP session: [%s]\n", err);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (switch_core_session_thread_launch(*new_session) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't start session thread.\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't start session thread.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
switch_channel_mark_answered(channel);
|
||||
|
||||
|
||||
return SWITCH_CAUSE_SUCCESS;
|
||||
|
||||
|
||||
fail:
|
||||
if (tech_pvt) {
|
||||
if (tech_pvt->read_codec.implementation) {
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
}
|
||||
|
||||
|
||||
if (tech_pvt->write_codec.implementation) {
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (*new_session) {
|
||||
switch_core_session_destroy(new_session);
|
||||
}
|
||||
@@ -299,29 +299,29 @@ fail:
|
||||
|
||||
static switch_status_t channel_on_init(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
|
||||
switch_channel_set_state(channel, CS_CONSUME_MEDIA);
|
||||
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
||||
{
|
||||
crtp_private_t *tech_pvt = NULL;
|
||||
|
||||
|
||||
if ((tech_pvt = switch_core_session_get_private(session))) {
|
||||
|
||||
|
||||
if (tech_pvt->read_codec.implementation) {
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
}
|
||||
|
||||
|
||||
if (tech_pvt->write_codec.implementation) {
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -331,24 +331,24 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
crtp_private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
switch_status_t status;
|
||||
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
if (!tech_pvt->rtp_session || tech_pvt->mode == RTP_SENDONLY) {
|
||||
switch_yield(20000); /* replace by local timer XXX */
|
||||
goto cng;
|
||||
}
|
||||
|
||||
|
||||
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
|
||||
switch_dtmf_t dtmf = { 0 };
|
||||
switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf);
|
||||
switch_channel_queue_dtmf(channel, &dtmf);
|
||||
}
|
||||
|
||||
|
||||
tech_pvt->read_frame.flags = SFF_NONE;
|
||||
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
|
||||
status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags);
|
||||
@@ -356,16 +356,16 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
||||
goto cng;
|
||||
}
|
||||
|
||||
|
||||
*frame = &tech_pvt->read_frame;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
|
||||
cng:
|
||||
*frame = &tech_pvt->read_frame;
|
||||
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
|
||||
tech_pvt->read_frame.flags |= SFF_CNG;
|
||||
tech_pvt->read_frame.datalen = 0;
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -374,14 +374,14 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
||||
crtp_private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
//int frames = 0, bytes = 0, samples = 0;
|
||||
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
assert(channel != NULL);
|
||||
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
|
||||
if (tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
|
||||
@@ -389,10 +389,10 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
||||
frames = ((int) frame->datalen / bytes);
|
||||
} else
|
||||
frames = 1;
|
||||
|
||||
|
||||
samples = frames * tech_pvt->read_codec.implementation->samples_per_packet;
|
||||
}
|
||||
|
||||
|
||||
tech_pvt->timestamp_send += samples;
|
||||
#endif
|
||||
if (tech_pvt->mode == RTP_RECVONLY) {
|
||||
@@ -407,10 +407,10 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
||||
static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
|
||||
{
|
||||
crtp_private_t *tech_pvt = NULL;
|
||||
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
switch(tech_pvt->dtmf_type) {
|
||||
case DTMF_2833:
|
||||
{
|
||||
@@ -423,7 +423,7 @@ static switch_status_t channel_send_dtmf(switch_core_session_t *session, const s
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding DTMF %c of length %d, DTMF type is NONE\n", dtmf->digit, dtmf->duration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -434,7 +434,7 @@ static switch_bool_t compare_var(switch_event_t *event, switch_channel_t *channe
|
||||
|
||||
if (zstr(chan_val) || zstr(event_val)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return strcasecmp(chan_val, event_val);
|
||||
}
|
||||
@@ -466,7 +466,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
|
||||
|
||||
switch_channel_set_variable(channel, kREMOTEADDR, remote_addr);
|
||||
switch_channel_set_variable(channel, kREMOTEPORT, szremote_port);
|
||||
|
||||
|
||||
if (switch_rtp_set_remote_address(tech_pvt->rtp_session, remote_addr, remote_port, 0, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error setting RTP remote address: %s\n", err);
|
||||
} else {
|
||||
@@ -474,7 +474,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
|
||||
tech_pvt->mode = RTP_SENDRECV;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (compare_var(event, channel, kCODEC) ||
|
||||
compare_var(event, channel, kPTIME) ||
|
||||
compare_var(event, channel, kPT) ||
|
||||
@@ -501,7 +501,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
|
||||
rate,
|
||||
ptime,
|
||||
1,
|
||||
SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/,
|
||||
SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/,
|
||||
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
|
||||
goto fail;
|
||||
@@ -521,15 +521,15 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
|
||||
switch_rtp_set_default_payload(tech_pvt->rtp_session, (switch_payload_t)pt);
|
||||
//switch_rtp_set_recv_pt(tech_pvt->rtp_session, pt);
|
||||
}
|
||||
|
||||
|
||||
if (compare_var(event, channel, kRFC2833PT)) {
|
||||
const char *szpt = switch_channel_get_variable(channel, kRFC2833PT);
|
||||
int pt = !zstr(szpt) ? atoi(szpt) : 0;
|
||||
|
||||
|
||||
switch_channel_set_variable(channel, kRFC2833PT, szpt);
|
||||
switch_rtp_set_telephony_event(tech_pvt->rtp_session, (switch_payload_t)pt);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Received unknown command [%s] in event.\n", !command ? "null" : command);
|
||||
}
|
||||
@@ -540,7 +540,7 @@ fail:
|
||||
if (tech_pvt->read_codec.implementation) {
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
}
|
||||
|
||||
|
||||
if (tech_pvt->write_codec.implementation) {
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
}
|
||||
@@ -553,17 +553,17 @@ fail:
|
||||
static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
|
||||
{
|
||||
crtp_private_t *tech_pvt = NULL;
|
||||
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
switch (msg->message_id) {
|
||||
case SWITCH_MESSAGE_INDICATE_DEBUG_MEDIA:
|
||||
{
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) {
|
||||
switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0};
|
||||
int x = 0;
|
||||
|
||||
|
||||
if (!strcasecmp(msg->string_array_arg[0], "read")) {
|
||||
flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++;x++;
|
||||
} else if (!strcasecmp(msg->string_array_arg[0], "write")) {
|
||||
@@ -572,7 +572,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]++;x++;
|
||||
flags[SWITCH_RTP_FLAG_DEBUG_RTP_WRITE]++;
|
||||
}
|
||||
|
||||
|
||||
if (x) {
|
||||
if (switch_true(msg->string_array_arg[1])) {
|
||||
switch_rtp_set_flags(tech_pvt->rtp_session, flags);
|
||||
@@ -594,11 +594,11 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
{
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
int len = 0, maxlen = 0, qlen = 0, maxqlen = 50;
|
||||
|
||||
|
||||
if (msg->string_arg) {
|
||||
char *p;
|
||||
const char *s;
|
||||
|
||||
|
||||
if (!strcasecmp(msg->string_arg, "pause")) {
|
||||
switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_TRUE);
|
||||
goto end;
|
||||
@@ -613,47 +613,47 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
||||
switch_rtp_debug_jitter_buffer(tech_pvt->rtp_session, s);
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ((len = atoi(msg->string_arg))) {
|
||||
qlen = len / (tech_pvt->read_codec.implementation->microseconds_per_packet / 1000);
|
||||
if (qlen < 1) {
|
||||
qlen = 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (qlen) {
|
||||
if ((p = strchr(msg->string_arg, ':'))) {
|
||||
p++;
|
||||
maxlen = atol(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (maxlen) {
|
||||
maxqlen = maxlen / (tech_pvt->read_codec.implementation->microseconds_per_packet / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (qlen) {
|
||||
if (maxqlen < qlen) {
|
||||
maxqlen = qlen * 5;
|
||||
}
|
||||
if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen,
|
||||
tech_pvt->read_codec.implementation->samples_per_packet,
|
||||
tech_pvt->read_codec.implementation->samples_per_packet,
|
||||
tech_pvt->read_codec.implementation->samples_per_second) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
|
||||
SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
|
||||
SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n",
|
||||
len, qlen, maxqlen);
|
||||
switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER);
|
||||
if (!switch_false(switch_channel_get_variable(tech_pvt->channel, "rtp_jitter_buffer_plc"))) {
|
||||
switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER_PLC);
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
|
||||
SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", len, qlen);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
switch_rtp_deactivate_jitter_buffer(tech_pvt->rtp_session);
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
|
||||
if (argc < 2 || argc == (DIG_MAX_ARGS + 1)) {
|
||||
usage(1);
|
||||
}
|
||||
|
||||
|
||||
if (!strcasecmp(argv[i], "xml")) {
|
||||
switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "xml", "true");
|
||||
i++;
|
||||
@@ -343,7 +343,7 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor
|
||||
if (!dig->sres) {
|
||||
usage(1);
|
||||
}
|
||||
|
||||
|
||||
for (; i <= argc && (string = argv[i]); i++) {
|
||||
if (multiple)
|
||||
stream->write_function(stream, "%s", string);
|
||||
@@ -440,12 +440,12 @@ int prepare_transport(struct dig *dig, char const *tport)
|
||||
|
||||
if (!srv || srv[strlen(srv) - 1] != '.') {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: invalid transport specifier \"%s\"\n"
|
||||
|
||||
|
||||
"\tspecifier should have name/service/srv-id\n"
|
||||
"\twhere name is protocol name (e.g, \"tls-udp\")\n"
|
||||
"\t service specifies service as per RFC 2915 (e.g., \"SIPS+D2U\")\n"
|
||||
"\t srv-id is prefix for SRV lookup (e.g., \"_sips._udp.\")\n%s",
|
||||
name,
|
||||
"\t srv-id is prefix for SRV lookup (e.g., \"_sips._udp.\")\n%s",
|
||||
name,
|
||||
tport,
|
||||
srv ? "\t and it should end with a dot \".\"\n" : "");
|
||||
|
||||
@@ -881,7 +881,7 @@ void print_result(char const *addr,
|
||||
port = transport_is_secure(tport) ? "5061" : "5060";
|
||||
|
||||
if (xml) {
|
||||
stream->write_function(stream,
|
||||
stream->write_function(stream,
|
||||
" <route>\n"
|
||||
" <preference>%u</preference>\n"
|
||||
" <weight>%.3f</weight>\n"
|
||||
|
||||
@@ -123,10 +123,10 @@ void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
|
||||
{
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
|
||||
if (tech_pvt->proxy_refer_uuid && (other_session = switch_core_session_locate(tech_pvt->proxy_refer_uuid))) {
|
||||
switch_core_session_message_t *msg;
|
||||
|
||||
|
||||
msg = switch_core_session_alloc(other_session, sizeof(*msg));
|
||||
msg->message_id = SWITCH_MESSAGE_INDICATE_RESPOND;
|
||||
msg->from = __FILE__;
|
||||
@@ -138,7 +138,7 @@ void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
|
||||
tech_pvt->proxy_refer_uuid = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (status == 481 && sip && !sip->sip_retry_after && sip->sip_call_id && (!sofia_private || !sofia_private->is_call)) {
|
||||
char *sql;
|
||||
|
||||
@@ -581,10 +581,10 @@ static void sofia_parse_all_invite_headers(sip_t const *sip, switch_core_session
|
||||
static switch_status_t sofia_pass_notify(switch_core_session_t *session, const char *uuid, const char *payload)
|
||||
{
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
|
||||
if ((other_session = switch_core_session_locate(uuid))) {
|
||||
switch_core_session_message_t *msg;
|
||||
|
||||
|
||||
msg = switch_core_session_alloc(other_session, sizeof(*msg));
|
||||
MESSAGE_STAMP_FFL(msg);
|
||||
msg->message_id = SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE;
|
||||
@@ -766,7 +766,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
|
||||
}
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!(gateway = sofia_reg_find_gateway(sofia_private->gateway_name))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n");
|
||||
@@ -1067,7 +1067,7 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
|
||||
if (nsession) {
|
||||
const char *vval;
|
||||
switch_channel_t *nchannel = switch_core_session_get_channel(nsession);
|
||||
|
||||
|
||||
if (!(vval = switch_channel_get_variable(nchannel, "sip_copy_custom_headers")) || switch_true(vval)) {
|
||||
switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_BYE_HEADER_PREFIX_T);
|
||||
}
|
||||
@@ -1436,7 +1436,7 @@ static void sofia_handle_sip_r_refer(nua_t *nua, sofia_profile_t *profile, nua_h
|
||||
if (status < 200) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (tech_pvt->proxy_refer_uuid && (other_session = switch_core_session_locate(tech_pvt->proxy_refer_uuid))) {
|
||||
switch_core_session_message_t *msg;
|
||||
|
||||
@@ -1711,7 +1711,7 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) && r_sdp) {
|
||||
if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY)) {
|
||||
switch_channel_set_variable_partner(tech_pvt->channel, SWITCH_B_SDP_VARIABLE, r_sdp);
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
|
||||
sofia_media_activate_rtp(tech_pvt);
|
||||
switch_core_media_proxy_remote_addr(tech_pvt->session, r_sdp);
|
||||
@@ -1719,10 +1719,10 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||
sofia_clear_flag(tech_pvt, TFLAG_PASS_ACK);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_PASS_ACK)) {
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
@@ -1878,7 +1878,7 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||
}
|
||||
|
||||
|
||||
if ((refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to))) {
|
||||
if ((refer_to = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_refer_to))) {
|
||||
if ((iparams = strchr(refer_to, ';'))) {
|
||||
*iparams++ = '\0';
|
||||
|
||||
@@ -1991,7 +1991,7 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||
to_user = "n/a";
|
||||
to_host = "n/a";
|
||||
}
|
||||
|
||||
|
||||
while (ap) {
|
||||
switch_snprintf(accept_header + strlen(accept_header), sizeof(accept_header) - strlen(accept_header),
|
||||
"%s%s ", ap->ac_type, ap->ac_next ? "," : "");
|
||||
@@ -2064,7 +2064,7 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "profile-name", profile->name);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from-user", sofia_private->user);
|
||||
@@ -2074,7 +2074,7 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "reason", "socket-disconnection");
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
sofia_reg_check_socket(profile, sofia_private->call_id, sofia_private->network_ip, sofia_private->network_port);
|
||||
nua_handle_destroy(nh);
|
||||
@@ -2433,7 +2433,7 @@ void sofia_event_callback(nua_event_t event,
|
||||
case nua_i_notify:
|
||||
case nua_i_info:
|
||||
|
||||
|
||||
|
||||
if (event == nua_i_invite) {
|
||||
if (sip->sip_session_expires && profile->minimum_session_expires) {
|
||||
if (sip->sip_session_expires->x_delta < profile->minimum_session_expires) {
|
||||
@@ -2963,7 +2963,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
|
||||
sofia_reg_check_expire(profile, now, 0);
|
||||
ireg_loops = 0;
|
||||
}
|
||||
|
||||
|
||||
if(++iping_loops >= (uint32_t)profile->iping_freq) {
|
||||
time_t now = switch_epoch_time_now(NULL);
|
||||
sofia_reg_check_ping_expire(profile, now, profile->iping_seconds);
|
||||
@@ -2981,7 +2981,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
|
||||
}
|
||||
|
||||
if (switch_queue_pop_timeout(mod_sofia_globals.general_event_queue, &pop, 100000) == SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
|
||||
do {
|
||||
switch_event_t *event = (switch_event_t *) pop;
|
||||
general_event_handler(event);
|
||||
@@ -3865,7 +3865,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag,
|
||||
ping_min = atoi(val);
|
||||
} else if (!strcmp(var, "ping-user-agent")) {
|
||||
options_user_agent = val;
|
||||
} else if (!strcmp(var, "ping-monitoring")) { // if true then every gw ping result will fire a gateway status event
|
||||
} else if (!strcmp(var, "ping-monitoring")) { // if true then every gw ping result will fire a gateway status event
|
||||
ping_monitoring = switch_true(val);
|
||||
} else if (!strcmp(var, "proxy")) {
|
||||
proxy = val;
|
||||
@@ -4624,7 +4624,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
||||
int found = 1; // Used to break up long if/elseif chain (MSVC2015 fails (parser stack overflow) otherwise)
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s [%s]\n", var, val);
|
||||
|
||||
|
||||
if (!strcasecmp(var, "debug") && val) {
|
||||
profile->debug = atoi(val);
|
||||
} else if (!strcasecmp(var, "parse-invite-tel-params")) {
|
||||
@@ -5330,7 +5330,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
||||
found = 0;
|
||||
}
|
||||
if (found) continue;
|
||||
|
||||
|
||||
if (!strcasecmp(var, "multiple-registrations")) {
|
||||
if (val && !strcasecmp(val, "call-id")) {
|
||||
sofia_set_pflag(profile, PFLAG_MULTIREG);
|
||||
@@ -5959,7 +5959,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting nonce TTL to 60 seconds\n");
|
||||
profile->nonce_ttl = 60;
|
||||
}
|
||||
|
||||
|
||||
if (!profile->max_auth_validity) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting MAX Auth Validity to 0 Attempts\n");
|
||||
profile->max_auth_validity = 0;
|
||||
@@ -6251,14 +6251,14 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
|
||||
gateway->uptime = switch_time_now();
|
||||
do_fire_gateway_state_event = SWITCH_TRUE;
|
||||
}
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
|
||||
"Ping succeeded %s with code %d - count %d/%d/%d, state %s\n",
|
||||
gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max, sofia_gateway_status_name(gateway->status));
|
||||
}
|
||||
if (gateway->ping_sent) {
|
||||
gateway->ping_time = (float)(switch_time_now() - gateway->ping_sent) / 1000;
|
||||
gateway->ping_sent = 0;
|
||||
gateway->ping_sent = 0;
|
||||
}
|
||||
} else {
|
||||
if (gateway->state == REG_STATE_REGED) {
|
||||
@@ -6800,7 +6800,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n%s\n", status, phrase, switch_str_nil(r_sdp));
|
||||
|
||||
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
sofia_set_flag(other_tech_pvt, TFLAG_PASS_ACK);
|
||||
@@ -6815,7 +6815,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
||||
} else if (status > 299) {
|
||||
switch_core_media_reset_t38(session);
|
||||
switch_core_media_reset_t38(other_session);
|
||||
} else if (status == 200 && switch_channel_test_flag(channel, CF_T38_PASSTHRU) &&
|
||||
} else if (status == 200 && switch_channel_test_flag(channel, CF_T38_PASSTHRU) &&
|
||||
has_t38 && sip->sip_payload && sip->sip_payload->pl_data) {
|
||||
switch_t38_options_t *t38_options = switch_core_media_extract_t38_options(session, sip->sip_payload->pl_data);
|
||||
|
||||
@@ -7170,10 +7170,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
|
||||
tech_pvt->mparams.last_sdp_str = NULL;
|
||||
tech_pvt->mparams.last_sdp_response = NULL;
|
||||
|
||||
|
||||
if (r_sdp && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) {
|
||||
const char *var;
|
||||
|
||||
|
||||
if ((var = switch_channel_get_variable(channel, "bypass_media_sdp_filter"))) {
|
||||
if ((patched_sdp = switch_core_media_process_sdp_filter(r_sdp, var, session))) {
|
||||
r_sdp = patched_sdp;
|
||||
@@ -7183,7 +7183,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
|
||||
if ((switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) ||
|
||||
(sofia_test_flag(profile, TFLAG_INB_NOMEDIA) || sofia_test_flag(profile, TFLAG_PROXY_MEDIA))) {
|
||||
|
||||
|
||||
/* This marr in our code brought to you by people who can't read........ */
|
||||
if (profile->ndlb & SM_NDLB_ALLOW_BAD_IANANAME && r_sdp && (p = (char *) switch_stristr("g729a/8000", r_sdp))) {
|
||||
p += 4;
|
||||
@@ -7350,7 +7350,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
if (switch_channel_test_flag(channel, CF_PROXY_MODE) && r_sdp) {
|
||||
char ibuf[35] = "", pbuf[35] = "";
|
||||
const char *ptr;
|
||||
|
||||
|
||||
if ((ptr = switch_stristr("c=IN IP4", r_sdp))) {
|
||||
int i = 0;
|
||||
|
||||
@@ -7368,7 +7368,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
|
||||
if ((ptr = switch_stristr("m=audio", r_sdp))) {
|
||||
int i = 0;
|
||||
|
||||
|
||||
ptr += 7;
|
||||
|
||||
while(*ptr == ' ') {
|
||||
@@ -7380,7 +7380,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
|
||||
switch_channel_set_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, pbuf);
|
||||
}
|
||||
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) && switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
|
||||
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
|
||||
}
|
||||
@@ -7450,26 +7450,26 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
}
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_3P_NOMEDIA_REQUESTED)) {
|
||||
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_3P_NOMEDIA_REQUESTED_BLEG)) {
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
|
||||
switch_channel_clear_flag(channel, CF_3P_NOMEDIA_REQUESTED_BLEG);
|
||||
|
||||
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
//switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
|
||||
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
|
||||
sofia_glue_clear_soa(other_session, SWITCH_TRUE);
|
||||
|
||||
|
||||
if (sofia_use_soa(other_tech_pvt)) {
|
||||
nua_ack(other_tech_pvt->nh,
|
||||
TAG_IF(!zstr(other_tech_pvt->user_via), SIPTAG_VIA_STR(other_tech_pvt->user_via)),
|
||||
SIPTAG_CONTACT_STR(other_tech_pvt->reply_contact),
|
||||
SOATAG_USER_SDP_STR(r_sdp),
|
||||
SOATAG_REUSE_REJECTED(1),
|
||||
SOATAG_RTP_SELECT(1),
|
||||
SOATAG_RTP_SELECT(1),
|
||||
SOATAG_AUDIO_AUX("cn telephone-event"),
|
||||
TAG_IF(sofia_test_pflag(other_tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
|
||||
TAG_END());
|
||||
@@ -7488,22 +7488,22 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
|
||||
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
|
||||
TAG_END());
|
||||
|
||||
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
} else {
|
||||
switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
|
||||
}
|
||||
|
||||
|
||||
switch_channel_clear_flag(channel, CF_3P_NOMEDIA_REQUESTED);
|
||||
goto done;
|
||||
|
||||
} else if (switch_channel_test_flag(channel, CF_3P_MEDIA_REQUESTED)) {
|
||||
uint8_t match = 0;
|
||||
|
||||
|
||||
switch_channel_clear_flag(channel, CF_PROXY_MODE);
|
||||
|
||||
|
||||
switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0);
|
||||
switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_FALSE);
|
||||
|
||||
@@ -7519,7 +7519,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0);
|
||||
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED");
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_READY);
|
||||
|
||||
|
||||
sofia_set_flag(tech_pvt, TFLAG_SDP);
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RESTABLISH MEDIA SDP:\n%s\n", tech_pvt->mparams.local_sdp_str);
|
||||
|
||||
@@ -7536,7 +7536,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
|
||||
SOATAG_USER_SDP_STR(tech_pvt->mparams.local_sdp_str),
|
||||
SOATAG_REUSE_REJECTED(1),
|
||||
SOATAG_RTP_SELECT(1),
|
||||
SOATAG_RTP_SELECT(1),
|
||||
SOATAG_AUDIO_AUX("cn telephone-event"),
|
||||
TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)),
|
||||
TAG_END());
|
||||
@@ -7550,7 +7550,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
SOATAG_AUDIO_AUX("cn telephone-event"),
|
||||
TAG_END());
|
||||
}
|
||||
|
||||
|
||||
switch_channel_clear_flag(channel, CF_3P_MEDIA_REQUESTED);
|
||||
goto done;
|
||||
}
|
||||
@@ -7610,7 +7610,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
|
||||
if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
|
||||
@@ -7814,7 +7814,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
}
|
||||
|
||||
goto done;
|
||||
|
||||
|
||||
} else {
|
||||
ss_state = nua_callstate_completed;
|
||||
goto state_process;
|
||||
@@ -7879,7 +7879,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_session_message_t *msg;
|
||||
private_object_t *other_tech_pvt;
|
||||
@@ -7887,8 +7887,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
|
||||
switch_core_media_clear_rtp_flag(other_session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_RTP_FLAG_AUTOADJ);
|
||||
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 &&
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 &&
|
||||
((profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD) || media_on_hold)) {
|
||||
if (switch_stristr("sendonly", r_sdp) || switch_stristr("0.0.0.0", r_sdp) || switch_stristr("inactive", r_sdp)) {
|
||||
tech_pvt->mparams.hold_laps = 1;
|
||||
@@ -7901,7 +7901,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
//if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
|
||||
//const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
|
||||
|
||||
|
||||
|
||||
switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
|
||||
if (sofia_media_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
|
||||
@@ -8010,7 +8010,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
}
|
||||
goto done;
|
||||
} else {
|
||||
} else {
|
||||
int hold_related = 0;
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
|
||||
@@ -8018,7 +8018,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
} else if (switch_stristr("sendonly", r_sdp) || switch_stristr("0.0.0.0", r_sdp) || switch_stristr("inactive", r_sdp)) {
|
||||
hold_related = 1;
|
||||
}
|
||||
|
||||
|
||||
if (!is_t38 && hold_related && switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
switch_core_session_message_t *msg;
|
||||
@@ -8038,9 +8038,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
switch_core_session_rwunlock(other_session);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
msg = switch_core_session_alloc(other_session, sizeof(*msg));
|
||||
|
||||
|
||||
if (switch_stristr("inactive", r_sdp)) {
|
||||
sofia_set_flag_locked(other_tech_pvt, TFLAG_SIP_HOLD_INACTIVE);
|
||||
//switch_channel_set_variable(channel, "sofia_hold_inactive", "true");
|
||||
@@ -8073,9 +8073,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Indicating %s to other leg.\n%s\n", hold_msg, r_sdp);
|
||||
|
||||
switch_core_session_queue_message(other_session, msg);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
switch_core_media_gen_local_sdp(session, SDP_TYPE_RESPONSE, NULL, 0, NULL, 0);
|
||||
if (sofia_use_soa(tech_pvt)){
|
||||
nua_respond(tech_pvt->nh, SIP_200_OK,
|
||||
@@ -8092,7 +8092,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch_core_session_rwunlock(other_session);
|
||||
@@ -8145,7 +8145,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (is_ok) {
|
||||
|
||||
if (switch_core_session_local_crypto_key(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO)) {
|
||||
@@ -8165,7 +8165,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
|
||||
SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->mparams.local_sdp_str), TAG_END());
|
||||
}
|
||||
|
||||
|
||||
if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REINVITE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session));
|
||||
switch_event_fire(&s_event);
|
||||
@@ -8222,7 +8222,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
other_channel = switch_core_session_get_channel(other_session);
|
||||
switch_channel_pass_sdp(channel, other_channel, r_sdp);
|
||||
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_3PCC) && sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
|
||||
sofia_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
|
||||
@@ -8324,7 +8324,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
other_channel = switch_core_session_get_channel(other_session);
|
||||
switch_channel_pass_sdp(channel, other_channel, r_sdp);
|
||||
|
||||
|
||||
//switch_channel_answer(other_channel);
|
||||
switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER);
|
||||
|
||||
@@ -8340,9 +8340,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
} else {
|
||||
uint8_t match = 0;
|
||||
|
||||
|
||||
|
||||
match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE);
|
||||
|
||||
|
||||
|
||||
sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
|
||||
|
||||
@@ -8371,7 +8371,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "NO CODECS");
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
|
||||
}
|
||||
@@ -8584,10 +8584,10 @@ static switch_status_t sofia_process_proxy_refer(switch_core_session_t *session,
|
||||
{
|
||||
switch_core_session_t *other_session;
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_session_message_t *msg;
|
||||
|
||||
|
||||
tech_pvt->proxy_refer_uuid = switch_core_session_strdup(session, switch_core_session_get_uuid(other_session));
|
||||
msg = switch_core_session_alloc(other_session, sizeof(*msg));
|
||||
MESSAGE_STAMP_FFL(msg);
|
||||
@@ -9293,7 +9293,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"),
|
||||
SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
|
||||
}
|
||||
|
||||
|
||||
if (refer_to->r_url->url_params) {
|
||||
switch_channel_set_variable(b_channel, "sip_h_X-FS-Refer-Params", refer_to->r_url->url_params);
|
||||
}
|
||||
@@ -9424,11 +9424,11 @@ switch_status_t sofia_proxy_sip_i_message(nua_t *nua, sofia_profile_t *profile,
|
||||
}
|
||||
|
||||
other_tech_pvt = (private_object_t *) switch_core_session_get_private(other_session);
|
||||
|
||||
|
||||
if (sip->sip_content_type->c_type && sip->sip_content_type->c_subtype) {
|
||||
ct = sip->sip_content_type->c_type;
|
||||
}
|
||||
|
||||
|
||||
nua_message(other_tech_pvt->nh,
|
||||
TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(su_strdup(other_tech_pvt->nh->nh_home, ct))),
|
||||
TAG_IF(!zstr(other_tech_pvt->user_via), SIPTAG_VIA_STR(other_tech_pvt->user_via)),
|
||||
@@ -9457,13 +9457,13 @@ switch_status_t sofia_proxy_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua
|
||||
const char *ct = NULL;
|
||||
char *pl = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
|
||||
if (sip && sip->sip_payload && sip->sip_payload->pl_data) {
|
||||
pl = sip->sip_payload->pl_data;
|
||||
}
|
||||
|
||||
other_tech_pvt = (private_object_t *) switch_core_session_get_private(other_session);
|
||||
|
||||
|
||||
if (sip->sip_content_type->c_type && sip->sip_content_type->c_subtype) {
|
||||
ct = sip->sip_content_type->c_type;
|
||||
}
|
||||
@@ -9963,7 +9963,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
|
||||
uparams = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (uparams) {
|
||||
if (switch_stristr("transport=tcp", uparams)) {
|
||||
is_tcp = 1;
|
||||
@@ -10014,11 +10014,11 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
|
||||
}
|
||||
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ||
|
||||
(sofia_test_pflag(profile, PFLAG_TLS_ALWAYS_NAT) && (is_tcp || is_tls)) ||
|
||||
(!is_tcp && !is_tls && (zstr(network_ip) || !switch_check_network_list_ip(network_ip, profile->local_network)) &&
|
||||
profile->server_rport_level >= 2 && sip->sip_user_agent &&
|
||||
sip->sip_user_agent->g_string &&
|
||||
if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ||
|
||||
(sofia_test_pflag(profile, PFLAG_TLS_ALWAYS_NAT) && (is_tcp || is_tls)) ||
|
||||
(!is_tcp && !is_tls && (zstr(network_ip) || !switch_check_network_list_ip(network_ip, profile->local_network)) &&
|
||||
profile->server_rport_level >= 2 && sip->sip_user_agent &&
|
||||
sip->sip_user_agent->g_string &&
|
||||
(!strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7) || !strncasecmp(sip->sip_user_agent->g_string, "KIRK Wireless Server", 20)))
|
||||
) {
|
||||
if (sip && sip->sip_via) {
|
||||
@@ -10467,7 +10467,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
|
||||
char *var_name = NULL;
|
||||
var_name = switch_mprintf("sip_invite_%s", argv1[x1]);
|
||||
switch_channel_set_variable(channel, var_name, "true");
|
||||
switch_safe_free( var_name );
|
||||
switch_safe_free( var_name );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11044,7 +11044,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
|
||||
if (bcp->originatee_caller_profile) {
|
||||
switch_caller_profile_t *cp;
|
||||
|
||||
cp = switch_caller_profile_dup(tech_pvt->caller_profile->pool,
|
||||
cp = switch_caller_profile_dup(tech_pvt->caller_profile->pool,
|
||||
bcp->originatee_caller_profile);
|
||||
|
||||
switch_channel_set_originatee_caller_profile(tech_pvt->channel, cp);
|
||||
@@ -11099,7 +11099,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
|
||||
switch_channel_event_set_data(b_channel, event);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "att_xfer_replaced_by", sip->sip_call_id->i_id);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
}
|
||||
switch_channel_hangup(b_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Ken Rice <krice@freeswitch.org>
|
||||
* Paul D. Tinsley <pdt at jackhammer.org>
|
||||
@@ -44,8 +44,8 @@ int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip)
|
||||
{
|
||||
switch_assert(network_ip);
|
||||
|
||||
return (profile->extsipip &&
|
||||
!switch_check_network_list_ip(network_ip, "loopback.auto") &&
|
||||
return (profile->extsipip &&
|
||||
!switch_check_network_list_ip(network_ip, "loopback.auto") &&
|
||||
!switch_check_network_list_ip(network_ip, profile->local_network));
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
|
||||
switch_assert(session != NULL);
|
||||
switch_assert(profile != NULL);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
||||
|
||||
switch_core_session_add_stream(session, NULL);
|
||||
|
||||
switch_mutex_lock(tech_pvt->flag_mutex);
|
||||
@@ -183,7 +183,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
|
||||
tech_pvt->mparams.cng_pt = tech_pvt->cng_pt;
|
||||
tech_pvt->mparams.rtp_timeout_sec = profile->rtp_timeout_sec;
|
||||
tech_pvt->mparams.rtp_hold_timeout_sec = profile->rtp_hold_timeout_sec;
|
||||
|
||||
|
||||
if (profile->rtp_digit_delay) {
|
||||
tech_pvt->mparams.dtmf_delay = profile->rtp_digit_delay;
|
||||
}
|
||||
@@ -589,7 +589,7 @@ char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char
|
||||
new_uri = switch_core_session_sprintf(session, "%s;%s@%s", lhs, invite_tel_params, rhs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new_uri;
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix
|
||||
for (; hi; hi = hi->next) {
|
||||
const char *name = (char *) hi->name;
|
||||
char *value = (char *) hi->value;
|
||||
|
||||
|
||||
if (!strcasecmp(name, "sip_geolocation")) {
|
||||
stream.write_function(&stream, "Geolocation: %s\r\n", value);
|
||||
}
|
||||
@@ -643,7 +643,7 @@ void sofia_glue_set_extra_headers(switch_core_session_t *session, sip_t const *s
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
char pstr[32];
|
||||
|
||||
|
||||
|
||||
if (!sip || !channel) {
|
||||
return;
|
||||
}
|
||||
@@ -759,7 +759,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
switch_true(switch_channel_get_variable_dup(tech_pvt->channel, "sofia_hold_inactive", SWITCH_FALSE, -1))) {
|
||||
hold_char = "#";
|
||||
}
|
||||
|
||||
|
||||
if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING)) {
|
||||
const char *recover_contact = switch_channel_get_variable(tech_pvt->channel, "sip_recover_contact");
|
||||
recover_via = switch_channel_get_variable(tech_pvt->channel, "sip_recover_via");
|
||||
@@ -767,7 +767,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
if (!zstr(invite_record_route)) {
|
||||
record_route = switch_core_session_sprintf(session, "Record-Route: %s", invite_record_route);
|
||||
}
|
||||
|
||||
|
||||
if (recover_contact) {
|
||||
char *tmp = switch_core_session_strdup(session, recover_contact);
|
||||
tech_pvt->redirected = sofia_glue_get_url_from_contact(tmp, 0);
|
||||
@@ -845,7 +845,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
const char *from_display = switch_channel_get_variable(tech_pvt->channel, "sip_from_display");
|
||||
const char *invite_req_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_req_uri");
|
||||
const char *invite_domain = switch_channel_get_variable(tech_pvt->channel, "sip_invite_domain");
|
||||
|
||||
|
||||
const char *use_name, *use_number;
|
||||
|
||||
if (zstr(tech_pvt->dest)) {
|
||||
@@ -1050,7 +1050,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
}
|
||||
switch_channel_set_variable(channel, "sip_req_uri", s);
|
||||
}
|
||||
|
||||
|
||||
switch_channel_set_variable(channel, "sip_to_host", sofia_glue_get_host(to_str, switch_core_session_get_pool(session)));
|
||||
switch_channel_set_variable(channel, "sip_from_host", sofia_glue_get_host(from_str, switch_core_session_get_pool(session)));
|
||||
|
||||
@@ -1060,14 +1060,14 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
TAG_IF(!zstr(record_route), SIPTAG_HEADER_STR(record_route)),
|
||||
SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END()))) {
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT,
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT,
|
||||
"Error creating HANDLE!\nurl_str=[%s]\ncall_id=[%s]\nto_str=[%s]\nfrom_str=[%s]\ninvite_contact=[%s]\n",
|
||||
url_str,
|
||||
call_id ? call_id : "N/A",
|
||||
to_str,
|
||||
from_str,
|
||||
invite_contact);
|
||||
|
||||
|
||||
switch_safe_free(d_url);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
@@ -1294,12 +1294,12 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s sending invite version: %s\nLocal SDP:\n%s\n",
|
||||
switch_channel_get_name(tech_pvt->channel), switch_version_full_human(),
|
||||
switch_channel_get_name(tech_pvt->channel), switch_version_full_human(),
|
||||
tech_pvt->mparams.local_sdp_str ? tech_pvt->mparams.local_sdp_str : "NO SDP PRESENT\n");
|
||||
|
||||
|
||||
|
||||
if ((switch_channel_get_private(tech_pvt->channel, "t38_options")) ||
|
||||
if ((switch_channel_get_private(tech_pvt->channel, "t38_options")) ||
|
||||
((switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) ||
|
||||
switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) )
|
||||
&& switch_stristr("m=image", tech_pvt->mparams.local_sdp_str))) {
|
||||
@@ -1504,7 +1504,7 @@ void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp)
|
||||
&& (other_session = switch_core_session_locate(val))) {
|
||||
other_channel = switch_core_session_get_channel(other_session);
|
||||
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
|
||||
|
||||
|
||||
#if 0
|
||||
if (!sofia_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && !switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING) &&
|
||||
(switch_channel_direction(other_channel) == SWITCH_CALL_DIRECTION_OUTBOUND &&
|
||||
@@ -1527,7 +1527,7 @@ char *sofia_glue_get_path_from_contact(char *buf)
|
||||
contact = sofia_glue_get_url_from_contact(buf, SWITCH_TRUE);
|
||||
|
||||
if (!contact) return NULL;
|
||||
|
||||
|
||||
if ((p = strstr(contact, "fs_path="))) {
|
||||
p += 8;
|
||||
|
||||
@@ -1557,7 +1557,7 @@ char *sofia_glue_get_url_from_contact(char *buf, uint8_t to_dup)
|
||||
char *url = NULL, *e;
|
||||
|
||||
switch_assert(buf);
|
||||
|
||||
|
||||
while(*buf == ' ') {
|
||||
buf++;
|
||||
}
|
||||
@@ -1611,7 +1611,7 @@ switch_status_t sofia_glue_profile_rdlock__(const char *file, const char *func,
|
||||
switch_bool_t sofia_glue_profile_exists(const char *key)
|
||||
{
|
||||
switch_bool_t tf = SWITCH_FALSE;
|
||||
|
||||
|
||||
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||
if (switch_core_hash_find(mod_sofia_globals.profile_hash, key)) {
|
||||
tf = SWITCH_TRUE;
|
||||
@@ -1693,7 +1693,7 @@ void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *s
|
||||
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||
for (gp = profile->gateways; gp; gp = gp->next) {
|
||||
int reged = (gp->status == SOFIA_GATEWAY_UP);
|
||||
|
||||
|
||||
if (up ? reged : !reged) {
|
||||
stream->write_function(stream, "%s ", gp->name);
|
||||
}
|
||||
@@ -1773,7 +1773,7 @@ void sofia_glue_global_siptrace(switch_bool_t on)
|
||||
for (hi = switch_core_hash_first(mod_sofia_globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) {
|
||||
switch_core_hash_this(hi, &var, NULL, &val);
|
||||
if ((pptr = (sofia_profile_t *) val)) {
|
||||
nua_set_params(pptr->nua, TPTAG_LOG(on), TAG_END());
|
||||
nua_set_params(pptr->nua, TPTAG_LOG(on), TAG_END());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1886,7 +1886,7 @@ void sofia_glue_del_profile(sofia_profile_t *profile)
|
||||
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
|
||||
}
|
||||
|
||||
int sofia_recover_callback(switch_core_session_t *session)
|
||||
int sofia_recover_callback(switch_core_session_t *session)
|
||||
{
|
||||
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
@@ -1896,7 +1896,7 @@ int sofia_recover_callback(switch_core_session_t *session)
|
||||
const char *rr;
|
||||
int r = 0;
|
||||
const char *profile_name = switch_channel_get_variable_dup(channel, "recovery_profile_name", SWITCH_FALSE, -1);
|
||||
|
||||
|
||||
|
||||
if (zstr(profile_name)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Missing profile\n");
|
||||
@@ -1923,14 +1923,14 @@ int sofia_recover_callback(switch_core_session_t *session)
|
||||
int te = atoi(tmp);
|
||||
if (te > 64) {
|
||||
tech_pvt->te = (switch_payload_t)te;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((tmp = switch_channel_get_variable(tech_pvt->channel, "rtp_2833_recv_payload"))) {
|
||||
int te = atoi(tmp);
|
||||
if (te > 64) {
|
||||
tech_pvt->recv_te = (switch_payload_t)te;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rr = switch_channel_get_variable(channel, "sip_invite_record_route");
|
||||
@@ -1948,7 +1948,7 @@ int sofia_recover_callback(switch_core_session_t *session)
|
||||
if (zstr(rr)) {
|
||||
switch_channel_set_variable_printf(channel, "sip_invite_route_uri", "<sip:%s@%s:%s;transport=%s>",
|
||||
switch_channel_get_variable(channel, "sip_from_user"),
|
||||
switch_channel_get_variable(channel, "sip_network_ip"),
|
||||
switch_channel_get_variable(channel, "sip_network_ip"),
|
||||
switch_channel_get_variable(channel, "sip_network_port"),
|
||||
switch_channel_get_variable(channel,"sip_via_protocol")
|
||||
);
|
||||
@@ -1975,7 +1975,7 @@ int sofia_recover_callback(switch_core_session_t *session)
|
||||
sofia_glue_attach_private(session, profile, tech_pvt, NULL);
|
||||
switch_channel_set_name(tech_pvt->channel, switch_channel_get_variable(channel, "channel_name"));
|
||||
|
||||
|
||||
|
||||
switch_channel_set_variable(channel, "sip_invite_call_id", switch_channel_get_variable(channel, "sip_call_id"));
|
||||
|
||||
if (switch_true(switch_channel_get_variable(channel, "sip_nat_detected"))) {
|
||||
@@ -2184,7 +2184,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
" expires BIGINT\n"
|
||||
");\n";
|
||||
|
||||
|
||||
|
||||
int x;
|
||||
char *indexes[] = {
|
||||
"create index sr_call_id on sip_registrations (call_id)",
|
||||
@@ -2261,7 +2261,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
"create index ssd_expires on sip_shared_appearance_dialogs (expires)",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
switch_cache_db_handle_t *dbh = sofia_glue_get_db_handle(profile);
|
||||
char *test2;
|
||||
char *err;
|
||||
@@ -2269,7 +2269,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
if (!dbh) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
test_sql = switch_mprintf("delete from sip_registrations where sub_host is null "
|
||||
"and hostname='%q' "
|
||||
@@ -2285,9 +2285,9 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
switch_cache_db_test_reactive(dbh, "select ping_expires from sip_registrations", NULL, "alter table sip_registrations add column ping_expires INTEGER not null default 0");
|
||||
switch_cache_db_test_reactive(dbh, "select ping_time from sip_registrations", NULL, "alter table sip_registrations add column ping_time BIGINT not null default 0");
|
||||
switch_cache_db_test_reactive(dbh, "select force_ping from sip_registrations", NULL, "alter table sip_registrations add column force_ping INTEGER not null default 0");
|
||||
|
||||
|
||||
test2 = switch_mprintf("%s;%s", test_sql, test_sql);
|
||||
|
||||
|
||||
if (switch_cache_db_execute_sql(dbh, test2, &err) != SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
if (switch_stristr("read-only", err)) {
|
||||
@@ -2295,7 +2295,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "GREAT SCOTT!!! Cannot execute batched statements! [%s]\n"
|
||||
"If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS\n", err);
|
||||
|
||||
|
||||
switch_cache_db_release_db_handle(&dbh);
|
||||
free(test2);
|
||||
free(test_sql);
|
||||
@@ -2310,7 +2310,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
free(test_sql);
|
||||
|
||||
test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and full_to='XXX'", mod_sofia_globals.hostname);
|
||||
|
||||
|
||||
switch_cache_db_test_reactive(dbh, test_sql, "DROP TABLE sip_subscriptions", sub_sql);
|
||||
|
||||
free(test_sql);
|
||||
@@ -2319,7 +2319,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
|
||||
|
||||
switch_cache_db_test_reactive(dbh, test_sql, "DROP TABLE sip_dialogs", dialog_sql);
|
||||
|
||||
|
||||
free(test_sql);
|
||||
test_sql = switch_mprintf("delete from sip_presence where hostname='%q' or open_closed=''", mod_sofia_globals.hostname);
|
||||
|
||||
@@ -2341,7 +2341,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
|
||||
mod_sofia_globals.hostname);
|
||||
|
||||
switch_cache_db_test_reactive(dbh, test_sql, "DROP TABLE sip_shared_appearance_dialogs", shared_appearance_dialogs_sql);
|
||||
|
||||
|
||||
free(test_sql);
|
||||
|
||||
for (x = 0; indexes[x]; x++) {
|
||||
@@ -2359,7 +2359,7 @@ void sofia_glue_execute_sql(sofia_profile_t *profile, char **sqlp, switch_bool_t
|
||||
char *sql;
|
||||
|
||||
switch_assert(sqlp && *sqlp);
|
||||
sql = *sqlp;
|
||||
sql = *sqlp;
|
||||
|
||||
switch_sql_queue_manager_push(profile->qm, sql, 1, !sql_already_dynamic);
|
||||
|
||||
@@ -2374,7 +2374,7 @@ void sofia_glue_execute_sql_now(sofia_profile_t *profile, char **sqlp, switch_bo
|
||||
char *sql;
|
||||
|
||||
switch_assert(sqlp && *sqlp);
|
||||
sql = *sqlp;
|
||||
sql = *sqlp;
|
||||
|
||||
switch_mutex_lock(profile->dbh_mutex);
|
||||
switch_sql_queue_manager_push_confirm(profile->qm, sql, 0, !sql_already_dynamic);
|
||||
@@ -2390,7 +2390,7 @@ void sofia_glue_execute_sql_soon(sofia_profile_t *profile, char **sqlp, switch_b
|
||||
char *sql;
|
||||
|
||||
switch_assert(sqlp && *sqlp);
|
||||
sql = *sqlp;
|
||||
sql = *sqlp;
|
||||
|
||||
switch_sql_queue_manager_push(profile->qm, sql, 0, !sql_already_dynamic);
|
||||
|
||||
@@ -2404,7 +2404,7 @@ switch_cache_db_handle_t *_sofia_glue_get_db_handle(sofia_profile_t *profile, co
|
||||
{
|
||||
switch_cache_db_handle_t *dbh = NULL;
|
||||
char *dsn;
|
||||
|
||||
|
||||
if (!zstr(profile->odbc_dsn)) {
|
||||
dsn = profile->odbc_dsn;
|
||||
} else {
|
||||
@@ -2414,7 +2414,7 @@ switch_cache_db_handle_t *_sofia_glue_get_db_handle(sofia_profile_t *profile, co
|
||||
if (_switch_cache_db_get_db_handle_dsn(&dbh, dsn, file, func, line) != SWITCH_STATUS_SUCCESS) {
|
||||
dbh = NULL;
|
||||
}
|
||||
|
||||
|
||||
return dbh;
|
||||
}
|
||||
|
||||
@@ -2535,7 +2535,7 @@ char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex
|
||||
if (mutex) {
|
||||
switch_mutex_unlock(mutex);
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2576,11 +2576,11 @@ char *sofia_glue_get_register_host(const char *uri)
|
||||
}
|
||||
|
||||
register_host = strdup(s);
|
||||
|
||||
/* remove port for register_host for testing nat acl take into account
|
||||
ipv6 addresses which are required to have brackets around the addr
|
||||
|
||||
/* remove port for register_host for testing nat acl take into account
|
||||
ipv6 addresses which are required to have brackets around the addr
|
||||
*/
|
||||
|
||||
|
||||
if ((p = strchr(register_host, ']'))) {
|
||||
if (*(p + 1) == ':') {
|
||||
*(p + 1) = '\0';
|
||||
@@ -2590,7 +2590,7 @@ char *sofia_glue_get_register_host(const char *uri)
|
||||
*p = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* register_proxy should always start with "sip:" or "sips:" */
|
||||
assert(register_host);
|
||||
|
||||
@@ -2751,12 +2751,12 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
|
||||
user_via = sofia_glue_create_external_via(NULL, profile, transport);
|
||||
} else {
|
||||
user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP);
|
||||
contact_str = profile->public_url;
|
||||
contact_str = profile->public_url;
|
||||
}
|
||||
} else {
|
||||
id = switch_mprintf("sip:%s@%s", user, host);
|
||||
switch_assert(id);
|
||||
|
||||
|
||||
if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) {
|
||||
sofia_transport_t transport = sofia_glue_str2transport( ptr + 10 );
|
||||
|
||||
@@ -2818,7 +2818,7 @@ int sofia_glue_tech_simplify(private_object_t *tech_pvt)
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (switch_channel_test_flag(tech_pvt->channel, CF_BRIDGED) &&
|
||||
if (switch_channel_test_flag(tech_pvt->channel, CF_BRIDGED) &&
|
||||
(uuid = switch_channel_get_partner_uuid(tech_pvt->channel)) && (other_session = switch_core_session_locate(uuid))) {
|
||||
|
||||
other_channel = switch_core_session_get_channel(other_session);
|
||||
@@ -2846,10 +2846,10 @@ int sofia_glue_tech_simplify(private_object_t *tech_pvt)
|
||||
&& strcmp(network_addr_a, switch_str_nil(tech_pvt->profile->extsipip))) {
|
||||
|
||||
switch_core_session_message_t *msg;
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, switch_channel_get_uuid(inbound_channel),
|
||||
SWITCH_LOG_NOTICE, "Will simplify channel [%s]\n", switch_channel_get_name(inbound_channel));
|
||||
|
||||
|
||||
msg = switch_core_session_alloc(inbound_session, sizeof(*msg));
|
||||
MESSAGE_STAMP_FFL(msg);
|
||||
msg->message_id = SWITCH_MESSAGE_INDICATE_SIMPLIFY;
|
||||
@@ -2861,7 +2861,7 @@ int sofia_glue_tech_simplify(private_object_t *tech_pvt)
|
||||
switch_core_recovery_track(inbound_session);
|
||||
|
||||
switch_channel_set_flag(inbound_channel, CF_SIMPLIFY);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2932,7 +2932,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
|
||||
}
|
||||
|
||||
sofia_glue_get_addr(de->data->e_msg, np->network_ip, sizeof(np->network_ip), &np->network_port);
|
||||
|
||||
|
||||
if (sofia_glue_check_nat(profile, np->network_ip)) {
|
||||
np->is_auto_nat = 1;
|
||||
}
|
||||
@@ -3028,7 +3028,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
|
||||
if ((tp = switch_stristr("transport=", full_contact_dup))) {
|
||||
tp += 10;
|
||||
}
|
||||
|
||||
|
||||
if (zstr(tp)) {
|
||||
tp = "udp";
|
||||
}
|
||||
@@ -3039,7 +3039,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
|
||||
switch_zmalloc(path_encoded, path_encoded_len);
|
||||
switch_copy_string(path_encoded, ";fs_path=", 10);
|
||||
switch_url_encode(path_val, path_encoded + 9, path_encoded_len - 9);
|
||||
|
||||
|
||||
contact_str = switch_mprintf("%s <%s;fs_nat=yes%s>", display, full_contact_dup, path_encoded);
|
||||
|
||||
free(full_contact_dup);
|
||||
@@ -3051,20 +3051,20 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
|
||||
if (zstr(contact_host)) {
|
||||
np->is_nat = "No contact host";
|
||||
}
|
||||
|
||||
|
||||
if (np->is_nat) {
|
||||
contact_host = np->network_ip;
|
||||
switch_snprintf(new_port, sizeof(new_port), ":%d", np->network_port);
|
||||
port = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (port) {
|
||||
switch_snprintf(new_port, sizeof(new_port), ":%s", port);
|
||||
}
|
||||
|
||||
|
||||
ipv6 = strchr(contact_host, ':');
|
||||
|
||||
|
||||
|
||||
if (contact->m_url->url_params) {
|
||||
contact_str = switch_mprintf("%s <sip:%s%s%s%s%s%s;%s>%s",
|
||||
@@ -3080,7 +3080,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua
|
||||
ipv6 ? "[" : "", contact_host, ipv6 ? "]" : "", new_port, np->is_nat ? ";fs_nat=yes" : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return contact_str;
|
||||
}
|
||||
|
||||
@@ -3137,7 +3137,7 @@ void sofia_glue_clear_soa(switch_core_session_t *session, switch_bool_t partner)
|
||||
if (partner && switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
struct private_object *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
|
||||
|
||||
sofia_clear_flag(other_tech_pvt, TFLAG_ENABLE_SOA);
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
*
|
||||
@@ -107,7 +107,7 @@ static void process_mp(switch_core_session_t *session, switch_stream_handle_t *s
|
||||
stream->write_function(stream, "--%s\r\nContent-Type: %s\r\nContent-Length: %d\r\n%s\r\n", boundary, dname, strlen(dval), dval + 1);
|
||||
} else {
|
||||
stream->write_function(stream, "--%s\r\nContent-Type: %s\r\nContent-Length: %d\r\n\r\n%s\r\n", boundary, dname, strlen(dval) + 1, dval);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -709,7 +709,7 @@ static void do_normal_probe(switch_event_t *event)
|
||||
probe_euser = (p + 1);
|
||||
}
|
||||
|
||||
if (probe_euser && probe_host &&
|
||||
if (probe_euser && probe_host &&
|
||||
((profile = sofia_glue_find_profile(probe_host)) || (profile_name && (profile = sofia_glue_find_profile(profile_name))))) {
|
||||
sql = switch_mprintf("select state,status,rpid,presence_id,uuid from sip_dialogs "
|
||||
"where hostname='%q' and profile_name='%q' and call_info_state != 'seized' and "
|
||||
@@ -856,7 +856,7 @@ static void do_dialog_probe(switch_event_t *event)
|
||||
if (!profile && profile_name) {
|
||||
profile = sofia_glue_find_profile(profile_name);
|
||||
}
|
||||
|
||||
|
||||
if (!profile) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot find profile for domain %s\n", probe_host);
|
||||
goto end;
|
||||
@@ -2237,7 +2237,7 @@ static void _send_presence_notify(sofia_profile_t *profile,
|
||||
|
||||
if (!zstr(remote_ip) && sofia_glue_check_nat(profile, remote_ip)) {
|
||||
sofia_transport_t transport = sofia_glue_str2transport(tp);
|
||||
|
||||
|
||||
switch (transport) {
|
||||
case SOFIA_TRANSPORT_TCP:
|
||||
contact_str = profile->tcp_public_contact;
|
||||
@@ -2700,7 +2700,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
contact_str = profile->public_url;
|
||||
contact_str = profile->public_url;
|
||||
}
|
||||
} else {
|
||||
char *ptr;
|
||||
@@ -3207,7 +3207,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
prpid = rpid = dialog_rpid;
|
||||
}
|
||||
|
||||
contact_stripped = sofia_glue_strip_uri(contact_str);
|
||||
contact_stripped = sofia_glue_strip_uri(contact_str);
|
||||
pl = gen_pidf(user_agent, clean_id, contact_stripped, open, rpid, prpid, status, &ct);
|
||||
free(contact_stripped);
|
||||
}
|
||||
@@ -3908,7 +3908,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
char *contact = contact_str;
|
||||
|
||||
sstr = switch_mprintf("active;expires=%ld", exp_delta);
|
||||
|
||||
|
||||
if (strstr(buf, "fs_path=") && !strstr(contact_str, "fs_path=")) {
|
||||
char *e = strchr(buf,';');
|
||||
size_t l = e ? e-buf : strlen(buf);
|
||||
@@ -3921,9 +3921,9 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
"set expires=%ld, "
|
||||
"network_ip='%q',network_port='%d',sip_user='%q',sip_host='%q',full_via='%q',full_to='%q',full_from='%q',contact='%q' "
|
||||
"where call_id='%q' and profile_name='%q' and hostname='%q'",
|
||||
(long) switch_epoch_time_now(NULL) + exp_delta,
|
||||
(long) switch_epoch_time_now(NULL) + exp_delta,
|
||||
np.network_ip, np.network_port, from_user, from_host, full_via, full_to, full_from, contact,
|
||||
|
||||
|
||||
call_id, profile->name, mod_sofia_globals.hostname);
|
||||
|
||||
if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
|
||||
@@ -4510,7 +4510,7 @@ void sofia_presence_handle_sip_r_subscribe(int status,
|
||||
if (!sofia_private) {
|
||||
nua_handle_destroy(nh);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4911,17 +4911,17 @@ void sofia_presence_handle_sip_i_message(int status,
|
||||
} else {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "text/plain");
|
||||
}
|
||||
|
||||
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", full_from);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sip_profile", profile->name);
|
||||
|
||||
|
||||
|
||||
if (sip->sip_call_info) {
|
||||
sip_call_info_t *call_info = sip->sip_call_info;
|
||||
char *ci = sip_header_as_string(nua_handle_home(nh), (void *) call_info);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sip_call_info", ci);
|
||||
}
|
||||
|
||||
|
||||
/* Loop thru unknown Headers Here so we can do something with them */
|
||||
for (un = sip->sip_unknown; un; un = un->un_next) {
|
||||
if (!strncasecmp(un->un_name, "Diversion", 9)) {
|
||||
@@ -4980,7 +4980,7 @@ void sofia_presence_handle_sip_i_message(int status,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (msg) {
|
||||
switch_event_add_body(event, "%s", msg);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
*
|
||||
* Anthony Minessale II <anthm@freeswitch.org>
|
||||
* Ken Rice, <krice at freeswitch.org> (work sponsored by Comet Signaling LLC, CopperCom, Inc and Asteria Solutions Group, Inc)
|
||||
* Paul D. Tinsley <pdt at jackhammer.org>
|
||||
@@ -65,34 +65,34 @@ static void sofia_reg_new_handle(sofia_gateway_t *gateway_ptr, int attach)
|
||||
}
|
||||
|
||||
static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr)
|
||||
{
|
||||
{
|
||||
sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway;
|
||||
char *user_via = NULL;
|
||||
char *register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy);
|
||||
int ss_state = nua_callstate_authenticating;
|
||||
|
||||
|
||||
|
||||
|
||||
/* check for NAT and place a Via header if necessary (hostname or non-local IP) */
|
||||
if (register_host && sofia_glue_check_nat(gateway_ptr->profile, register_host)) {
|
||||
user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport);
|
||||
}
|
||||
|
||||
|
||||
if (gw_sub_ptr->nh) {
|
||||
nua_handle_bind(gw_sub_ptr->nh, NULL);
|
||||
nua_handle_destroy(gw_sub_ptr->nh);
|
||||
gw_sub_ptr->nh = NULL;
|
||||
sofia_private_free(gw_sub_ptr->sofia_private);
|
||||
}
|
||||
|
||||
|
||||
gw_sub_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
|
||||
NUTAG_URL(gateway_ptr->register_proxy),
|
||||
NUTAG_URL(gateway_ptr->register_proxy),
|
||||
TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
|
||||
SIPTAG_TO_STR(gateway_ptr->register_to),
|
||||
NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
|
||||
if (!gw_sub_ptr->sofia_private) {
|
||||
switch_zmalloc(gw_sub_ptr->sofia_private, sizeof(*gw_sub_ptr->sofia_private));
|
||||
}
|
||||
|
||||
|
||||
switch_set_string(gw_sub_ptr->sofia_private->gateway_name, gateway_ptr->name);
|
||||
nua_handle_bind(gw_sub_ptr->nh, gw_sub_ptr->sofia_private);
|
||||
|
||||
@@ -101,7 +101,7 @@ static void sofia_reg_new_sub_handle(sofia_gateway_subscription_t *gw_sub_ptr)
|
||||
}
|
||||
|
||||
static void sofia_reg_kill_sub(sofia_gateway_subscription_t *gw_sub_ptr)
|
||||
{
|
||||
{
|
||||
sofia_gateway_t *gateway_ptr = gw_sub_ptr->gateway;
|
||||
|
||||
sofia_private_free(gw_sub_ptr->sofia_private);
|
||||
@@ -109,7 +109,7 @@ static void sofia_reg_kill_sub(sofia_gateway_subscription_t *gw_sub_ptr)
|
||||
if (gw_sub_ptr->nh) {
|
||||
nua_handle_bind(gw_sub_ptr->nh, NULL);
|
||||
}
|
||||
|
||||
|
||||
if (gw_sub_ptr->state != SUB_STATE_SUBED && gw_sub_ptr->state != SUB_STATE_UNSUBSCRIBE) {
|
||||
if (gw_sub_ptr->nh) {
|
||||
nua_handle_destroy(gw_sub_ptr->nh);
|
||||
@@ -198,7 +198,7 @@ void sofia_reg_unregister(sofia_profile_t *profile)
|
||||
}
|
||||
|
||||
for (gw_sub_ptr = gateway_ptr->subscriptions; gw_sub_ptr; gw_sub_ptr = gw_sub_ptr->next) {
|
||||
|
||||
|
||||
if (gw_sub_ptr->state == SUB_STATE_SUBED) {
|
||||
sofia_reg_kill_sub(gw_sub_ptr);
|
||||
}
|
||||
@@ -246,12 +246,12 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
|
||||
case SUB_STATE_UNSUBED:
|
||||
|
||||
sofia_reg_new_sub_handle(gw_sub_ptr);
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name);
|
||||
|
||||
|
||||
if (now) {
|
||||
nua_subscribe(gw_sub_ptr->nh,
|
||||
NUTAG_URL(gw_sub_ptr->request_uri),
|
||||
NUTAG_URL(gw_sub_ptr->request_uri),
|
||||
SIPTAG_EVENT_STR(gw_sub_ptr->event),
|
||||
TAG_IF(strcmp(gw_sub_ptr->content_type, "NO_CONTENT_TYPE"), SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type)),
|
||||
SIPTAG_TO_STR(gateway_ptr->register_from),
|
||||
@@ -261,7 +261,7 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now)
|
||||
TAG_NULL());
|
||||
gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds;
|
||||
} else {
|
||||
nua_unsubscribe(gw_sub_ptr->nh,
|
||||
nua_unsubscribe(gw_sub_ptr->nh,
|
||||
NUTAG_URL(gw_sub_ptr->request_uri),
|
||||
SIPTAG_EVENT_STR(gw_sub_ptr->event),
|
||||
TAG_IF(strcmp(gw_sub_ptr->content_type, "NO_CONTENT_TYPE"), SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type)),
|
||||
@@ -317,7 +317,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
||||
switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->name);
|
||||
free(pkey);
|
||||
}
|
||||
|
||||
|
||||
if (gateway_ptr->state == REG_STATE_NOREG) {
|
||||
|
||||
if (last) {
|
||||
@@ -325,7 +325,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
||||
} else {
|
||||
profile->gateways = gateway_ptr->next;
|
||||
}
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleted gateway %s\n", gateway_ptr->name);
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_GATEWAY_DEL) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "profile-name", gateway_ptr->profile->name);
|
||||
@@ -414,7 +414,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
||||
if (delta < 1) {
|
||||
delta = 1;
|
||||
}
|
||||
|
||||
|
||||
gateway_ptr->expires = now + delta;
|
||||
|
||||
gateway_ptr->state = REG_STATE_REGED;
|
||||
@@ -480,7 +480,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
|
||||
case REG_STATE_TIMEOUT:
|
||||
{
|
||||
nua_handle_t *nh = gateway_ptr->nh;
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timeout Registering %s\n", gateway_ptr->name);
|
||||
|
||||
gateway_ptr->nh = NULL;
|
||||
@@ -611,7 +611,7 @@ int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames
|
||||
|
||||
dst = sofia_glue_get_destination(argv[3]);
|
||||
switch_assert(dst);
|
||||
|
||||
|
||||
nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(dst->contact), SIPTAG_CONTACT_STR(profile->url),
|
||||
SIPTAG_CALL_ID_STR(call_id), TAG_END());
|
||||
|
||||
@@ -623,7 +623,7 @@ int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames
|
||||
pvt->ping_sent = switch_time_now();
|
||||
nua_handle_bind(nh, pvt);
|
||||
|
||||
nua_options(nh,
|
||||
nua_options(nh,
|
||||
NTATAG_SIP_T2(5000),
|
||||
NTATAG_SIP_T4(10000),
|
||||
TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), TAG_END());
|
||||
@@ -811,7 +811,7 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
|
||||
sql = switch_mprintf("delete from sip_registrations where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
|
||||
}
|
||||
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -863,7 +863,7 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot)
|
||||
|
||||
long sofia_reg_uniform_distribution(int max)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* Generate a random number following a uniform distribution between 0 and max
|
||||
*/
|
||||
int result;
|
||||
@@ -892,7 +892,7 @@ void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int inter
|
||||
"profile_name='%q' and orig_hostname='%q' and "
|
||||
"ping_expires > 0 and ping_expires <= %ld",
|
||||
mod_sofia_globals.hostname, profile->name, mod_sofia_globals.hostname, (long) now);
|
||||
|
||||
|
||||
sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
|
||||
switch_safe_free(sql);
|
||||
} else if (sofia_test_pflag(profile, PFLAG_UDP_NAT_OPTIONS_PING)) {
|
||||
@@ -901,7 +901,7 @@ void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int inter
|
||||
" from sip_registrations where (status like '%%UDP-NAT%%' or force_ping=1)"
|
||||
" and hostname='%q' and profile_name='%q' and ping_expires > 0 and ping_expires <= %ld ",
|
||||
mod_sofia_globals.hostname, profile->name, (long) now);
|
||||
|
||||
|
||||
sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
|
||||
switch_safe_free(sql);
|
||||
} else if (sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) {
|
||||
@@ -912,7 +912,7 @@ void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int inter
|
||||
"and profile_name='%q' and orig_hostname='%q' and "
|
||||
"ping_expires > 0 and ping_expires <= %ld",
|
||||
mod_sofia_globals.hostname, profile->name, mod_sofia_globals.hostname, (long) now);
|
||||
|
||||
|
||||
sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_nat_callback, profile);
|
||||
switch_safe_free(sql);
|
||||
} else {
|
||||
@@ -1017,7 +1017,7 @@ void sofia_reg_check_sync(sofia_profile_t *profile)
|
||||
|
||||
sql = switch_mprintf("delete from sip_authentication where expires > 0 and hostname='%q'", mod_sofia_globals.hostname);
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
|
||||
|
||||
sql = switch_mprintf("delete from sip_subscriptions where expires >= -1 and hostname='%q'", mod_sofia_globals.hostname);
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
|
||||
@@ -1082,7 +1082,7 @@ switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *p
|
||||
|
||||
|
||||
sofia_glue_execute_sql_callback(profile, profile->dbh_mutex, sql, sofia_reg_find_callback, &cbt);
|
||||
|
||||
|
||||
switch_safe_free(sql);
|
||||
|
||||
return cbt.list;
|
||||
@@ -1145,8 +1145,8 @@ void sofia_reg_auth_challenge(sofia_profile_t *profile, nua_handle_t *nh, sofia_
|
||||
if (regtype == REG_REGISTER) {
|
||||
nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
|
||||
} else if (regtype == REG_INVITE) {
|
||||
nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED,
|
||||
TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)),
|
||||
nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED,
|
||||
TAG_IF(msg, NUTAG_WITH_THIS_MSG(msg)),
|
||||
SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
|
||||
}
|
||||
|
||||
@@ -1157,13 +1157,13 @@ uint32_t sofia_reg_reg_count(sofia_profile_t *profile, const char *user, const c
|
||||
{
|
||||
char buf[32] = "";
|
||||
char *sql;
|
||||
|
||||
|
||||
sql = switch_mprintf("select count(*) from sip_registrations where profile_name='%q' and "
|
||||
"sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", profile->name, user, host, host);
|
||||
|
||||
|
||||
sofia_glue_execute_sql2str(profile, profile->dbh_mutex, sql, buf, sizeof(buf));
|
||||
switch_safe_free(sql);
|
||||
return atoi(buf);
|
||||
return atoi(buf);
|
||||
}
|
||||
|
||||
static int debounce_check(sofia_profile_t *profile, const char *user, const char *host)
|
||||
@@ -1295,7 +1295,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
} else {
|
||||
uparams = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (sip && sip->sip_via && (vproto = sip->sip_via->v_protocol)) {
|
||||
if (!strcasecmp(vproto, "sip/2.0/ws")) {
|
||||
@@ -1360,7 +1360,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
}
|
||||
|
||||
if (!to_user || !to_host) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete header in REGISTER request from %s:%d\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete header in REGISTER request from %s:%d\n",
|
||||
network_ip, network_port);
|
||||
|
||||
nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_END());
|
||||
@@ -1599,7 +1599,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
avoid_multi_reg = 1;
|
||||
}
|
||||
|
||||
/* Allow us to force the SIP user to be something specific - needed if
|
||||
/* Allow us to force the SIP user to be something specific - needed if
|
||||
* we - for example - want to be able to ensure that the username a UA can
|
||||
* be contacted at is the same one that they used for authentication.
|
||||
*/
|
||||
@@ -1735,7 +1735,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
/* Log line added to support Fail2Ban */
|
||||
if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth %s (%s) on sofia profile '%s' "
|
||||
"for [%s@%s] from ip %s\n", forbidden ? "failure" : "challenge",
|
||||
"for [%s@%s] from ip %s\n", forbidden ? "failure" : "challenge",
|
||||
(regtype == REG_INVITE) ? "INVITE" : "REGISTER", profile->name, to_user, to_host, network_ip);
|
||||
}
|
||||
|
||||
@@ -1790,7 +1790,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
/* Log line added to support Fail2Ban */
|
||||
if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth challenge (%s) on sofia profile '%s' "
|
||||
"for [%s@%s] from ip %s\n", (regtype == REG_INVITE) ? "INVITE" : "REGISTER",
|
||||
"for [%s@%s] from ip %s\n", (regtype == REG_INVITE) ? "INVITE" : "REGISTER",
|
||||
profile->name, to_user, to_host, network_ip);
|
||||
}
|
||||
|
||||
@@ -1899,8 +1899,8 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
} else {
|
||||
char buf[32] = "";
|
||||
|
||||
|
||||
sql = switch_mprintf("select count(*) from sip_registrations where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'",
|
||||
|
||||
sql = switch_mprintf("select count(*) from sip_registrations where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'",
|
||||
to_user, username, reg_host, contact_str);
|
||||
|
||||
|
||||
@@ -1916,13 +1916,13 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
|
||||
contact = sofia_glue_get_url_from_contact(contact_str, 1);
|
||||
url = switch_mprintf("sofia/%q/%s:%q", profile->name, proto, sofia_glue_strip_proto(contact));
|
||||
|
||||
|
||||
switch_core_add_registration(to_user, reg_host, call_id, url, (long) reg_time + (long) exptime + profile->sip_expires_late_margin,
|
||||
network_ip, network_port_c, is_tls ? "tls" : is_tcp ? "tcp" : "udp", reg_meta);
|
||||
|
||||
switch_safe_free(url);
|
||||
switch_safe_free(contact);
|
||||
|
||||
|
||||
if ((is_wss || is_ws || (sofia_test_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE) && (is_tcp || is_tls))) && !sofia_private && call_id) {
|
||||
char key[256] = "";
|
||||
nua_handle_t *hnh;
|
||||
@@ -1952,7 +1952,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
switch_core_hash_insert(profile->reg_nh_hash, key, nh);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!update_registration) {
|
||||
sql = switch_mprintf("insert into sip_registrations "
|
||||
@@ -1960,9 +1960,9 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
"user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm,"
|
||||
"mwi_user,mwi_host, orig_server_host, orig_hostname, sub_host, ping_status, ping_count, force_ping) "
|
||||
"values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q','%q', '%q', %d, %d)",
|
||||
call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : "",
|
||||
call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : "",
|
||||
contact_str, reg_desc, rpid, (long) reg_time + (long) exptime + profile->sip_expires_late_margin,
|
||||
agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm,
|
||||
agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm,
|
||||
mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host, "Reachable", 0, force_ping);
|
||||
} else {
|
||||
sql = switch_mprintf("update sip_registrations set call_id='%q',"
|
||||
@@ -1975,14 +1975,14 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
mod_sofia_globals.hostname, mod_sofia_globals.hostname,
|
||||
(long) reg_time + (long) exptime + profile->sip_expires_late_margin, force_ping,
|
||||
to_user, username, reg_host, contact_str);
|
||||
}
|
||||
}
|
||||
|
||||
if (sql) {
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
if (!update_registration && sofia_reg_reg_count(profile, to_user, reg_host) == 1) {
|
||||
sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' and profile_name='%q' and open_closed='closed'",
|
||||
sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' and profile_name='%q' and open_closed='closed'",
|
||||
to_user, reg_host, profile->name);
|
||||
if (mod_sofia_globals.debug_presence > 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DELETE PRESENCE SQL: %s\n", sql);
|
||||
@@ -1996,7 +1996,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
} else {
|
||||
sql = switch_mprintf("delete from sip_registrations where call_id='%q' and expires!=%ld", call_id, (long) reg_time + (long) exptime + profile->sip_expires_late_margin);
|
||||
}
|
||||
|
||||
|
||||
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
@@ -2055,7 +2055,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (multi_reg) {
|
||||
char *icontact, *p;
|
||||
@@ -2073,7 +2073,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
} else {
|
||||
sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
|
||||
}
|
||||
|
||||
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
|
||||
switch_safe_free(icontact);
|
||||
@@ -2115,10 +2115,10 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
}
|
||||
}
|
||||
|
||||
if ((sofia_test_pflag(profile, PFLAG_PRESENCE_ON_REGISTER) ||
|
||||
(reg_count == 1 && sofia_test_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER))
|
||||
if ((sofia_test_pflag(profile, PFLAG_PRESENCE_ON_REGISTER) ||
|
||||
(reg_count == 1 && sofia_test_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER))
|
||||
|| send_pres == 1 || (reg_count == 1 && send_pres == 2)) && debounce_ok) {
|
||||
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER)) {
|
||||
if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
|
||||
@@ -2139,7 +2139,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
|
||||
switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered");
|
||||
switch_event_fire(&s_event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -2185,7 +2185,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
nua_respond(nh, SIP_200_OK, TAG_IF(contact, SIPTAG_CONTACT(sip->sip_contact)), TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
|
||||
TAG_IF(!zstr(expbuf), SIPTAG_EXPIRES_STR(expbuf)),
|
||||
NUTAG_WITH_THIS_MSG(de->data->e_msg), SIPTAG_DATE_STR(date), TAG_END());
|
||||
|
||||
|
||||
} else if ((contact_list = sofia_reg_find_reg_url_with_positive_expires_multi(profile, from_user, reg_host, reg_time, contact_str, exptime))) {
|
||||
/* all + 1 tag_i elements initialized as NULL - last one implies TAG_END() */
|
||||
switch_zmalloc(contact_tags, sizeof(*contact_tags) * (contact_list->count + 1));
|
||||
@@ -2195,7 +2195,7 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
|
||||
contact_tags[i].t_value = (tag_value_t) m->val;
|
||||
++i;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nua_respond(nh, SIP_200_OK, TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
|
||||
TAG_IF(!zstr(expbuf), SIPTAG_EXPIRES_STR(expbuf)),
|
||||
@@ -2257,7 +2257,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h
|
||||
if (sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_host) {
|
||||
const char *to_host = sip->sip_to->a_url->url_host;
|
||||
if (profile->reg_db_domain) {
|
||||
if (!sofia_glue_profile_exists(to_host)) {
|
||||
if (!sofia_glue_profile_exists(to_host)) {
|
||||
if (sofia_glue_add_profile(switch_core_strdup(profile->pool, to_host), profile) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Auto-Adding Alias [%s] for profile [%s]\n", to_host, profile->name);
|
||||
}
|
||||
@@ -2367,7 +2367,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
|
||||
if (!sofia_private_p || !*sofia_private_p) nua_handle_destroy(nh);
|
||||
|
||||
}
|
||||
@@ -2386,9 +2386,9 @@ void sofia_reg_handle_sip_r_register(int status,
|
||||
nua_handle_destroy(nh);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (sofia_private && !zstr(sofia_private->gateway_name)) {
|
||||
gateway = sofia_reg_find_gateway(sofia_private->gateway_name);
|
||||
gateway = sofia_reg_find_gateway(sofia_private->gateway_name);
|
||||
}
|
||||
|
||||
if (sofia_private && gateway) {
|
||||
@@ -2424,7 +2424,7 @@ void sofia_reg_handle_sip_r_register(int status,
|
||||
if (expi > 0 && expi != gateway->freq) {
|
||||
//gateway->freq = expi;
|
||||
//gateway->expires_str = switch_core_sprintf(gateway->pool, "%d", expi);
|
||||
|
||||
|
||||
if (expi > 60) {
|
||||
gateway->expires = switch_epoch_time_now(NULL) + (expi - 15);
|
||||
} else {
|
||||
@@ -2479,7 +2479,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
|
||||
const char *sip_auth_password = NULL;
|
||||
char *dup_user = NULL;
|
||||
char *dup_pass = NULL;
|
||||
|
||||
|
||||
if (session && (channel = switch_core_session_get_channel(session))) {
|
||||
sip_auth_username = switch_channel_get_variable(channel, "sip_auth_username");
|
||||
sip_auth_password = switch_channel_get_variable(channel, "sip_auth_password");
|
||||
@@ -2591,7 +2591,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
|
||||
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
|
||||
const char *var = switch_xml_attr_soft(x_param, "name");
|
||||
const char *val = switch_xml_attr_soft(x_param, "value");
|
||||
|
||||
|
||||
if (!strcasecmp(var, "reverse-auth-user")) {
|
||||
dup_user = strdup(val);
|
||||
sip_auth_username = dup_user;
|
||||
@@ -2613,7 +2613,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
|
||||
} else if (gateway) {
|
||||
switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->auth_username, gateway->register_password);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
|
||||
"Cannot locate any authentication credentials to complete an authentication request for realm '%s'\n", realm);
|
||||
goto cancel;
|
||||
}
|
||||
@@ -2627,8 +2627,8 @@ void sofia_reg_handle_sip_r_challenge(int status,
|
||||
|
||||
tl_gets(tags, NUTAG_CALLSTATE_REF(ss_state), SIPTAG_WWW_AUTHENTICATE_REF(authenticate), TAG_END());
|
||||
|
||||
nua_authenticate(nh,
|
||||
TAG_IF(sofia_private && !zstr(sofia_private->gateway_name), SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")),
|
||||
nua_authenticate(nh,
|
||||
TAG_IF(sofia_private && !zstr(sofia_private->gateway_name), SIPTAG_EXPIRES_STR(gateway ? gateway->expires_str : "3600")),
|
||||
NUTAG_AUTH(authentication), TAG_END());
|
||||
|
||||
goto end;
|
||||
@@ -3025,7 +3025,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
||||
ret = AUTH_FORBIDDEN;
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
||||
if (zstr(passwd) && zstr(a1_hash)) {
|
||||
ret = AUTH_OK;
|
||||
goto skip_auth;
|
||||
@@ -3343,7 +3343,7 @@ switch_status_t sofia_reg_gateway_rdlock__(const char *file, const char *func, i
|
||||
|
||||
#ifdef SOFIA_DEBUG_RWLOCKS
|
||||
if (status == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "XXXXXXXXXXXXXX GW LOCK %s\n", gateway->profile->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_ERROR, "XXXXXXXXXXXXXX GW LOCK %s\n", gateway->profile->name);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3369,7 +3369,7 @@ switch_status_t sofia_reg_add_gateway(sofia_profile_t *profile, const char *key,
|
||||
|
||||
gateway->next = profile->gateways;
|
||||
profile->gateways = gateway;
|
||||
|
||||
|
||||
switch_mutex_unlock(profile->gw_mutex);
|
||||
|
||||
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||
|
||||
Reference in New Issue
Block a user