Merge branch 'master' of git@git.freeswitch.org:freeswitch

This commit is contained in:
David Yat Sin 2010-04-22 14:20:37 -04:00
commit 90bd259f11
23 changed files with 317 additions and 87 deletions

View File

@ -22,7 +22,7 @@ ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[
if test -z "$ac_version"; then
echo "bootstrap: autoconf not found."
echo " You need autoconf version 2.59 or newer installed"
echo " to build FreeSWITCH from SVN."
echo " to build FreeSWITCH from source."
exit 1
fi
@ -37,7 +37,7 @@ IFS=.; set $ac_version; IFS=' '
if test "$1" = "2" -a "$2" -lt "59" || test "$1" -lt "2"; then
echo "bootstrap: autoconf version $ac_version found."
echo " You need autoconf version 2.59 or newer installed"
echo " to build FreeSWITCH from SVN."
echo " to build FreeSWITCH from source."
exit 1
else
echo "bootstrap: autoconf version $ac_version (ok)"
@ -50,7 +50,7 @@ am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[
if test -z "$am_version"; then
echo "bootstrap: automake not found."
echo " You need automake version 1.7 or newer installed"
echo " to build FreeSWITCH from SVN."
echo " to build FreeSWITCH from source."
exit 1
fi
IFS=_; set $am_version; IFS=' '
@ -59,7 +59,7 @@ IFS=.; set $am_version; IFS=' '
if test "$1" = "1" -a "$2" -lt "7"; then
echo "bootstrap: automake version $am_version found."
echo " You need automake version 1.7 or newer installed"
echo " to build FreeSWITCH from SVN."
echo " to build FreeSWITCH from source."
exit 1
else
echo "bootstrap: automake version $am_version (ok)"
@ -71,7 +71,7 @@ acl_version=`${ACLOCAL:-aclocal} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a
if test -z "$acl_version"; then
echo "bootstrap: aclocal not found."
echo " You need aclocal version 1.7 or newer installed"
echo " to build FreeSWITCH from SVN."
echo " to build FreeSWITCH from source."
exit 1
fi
IFS=_; set $acl_version; IFS=' '
@ -80,7 +80,7 @@ IFS=.; set $acl_version; IFS=' '
if test "$1" = "1" -a "$2" -lt "7"; then
echo "bootstrap: aclocal version $acl_version found."
echo " You need aclocal version 1.7 or newer installed"
echo " to build FreeSWITCH from SVN."
echo " to build FreeSWITCH from source."
exit 1
else
echo "bootstrap: aclocal version $acl_version (ok)"
@ -96,7 +96,7 @@ libtool=${LIBTOOL:-`${LIBDIR}/apr/build/PrintPath glibtool libtool libtool22 lib
lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
if test -z "$lt_pversion"; then
echo "bootstrap: libtool not found."
echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from SVN."
echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from source."
exit 1
fi
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
@ -121,7 +121,7 @@ if test $lt_status = "good"; then
echo "bootstrap: libtool version $lt_pversion (ok)"
else
echo "bootstrap: libtool version $lt_pversion found."
echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from SVN."
echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from source."
exit 1
fi

View File

@ -208,8 +208,9 @@
<!--all inbound reg will stored in the db using this domain -->
<param name="force-register-db-domain" value="$${domain}"/>
<!-- enable rtcp on every channel also can be done per leg basis with rtcp_interval_msec variable -->
<!--<param name="rtcp-interval-msec" value="10000"/>-->
<!-- enable rtcp on every channel also can be done per leg basis with rtcp_audio_interval_msec variable set to passthru to pass it across a call-->
<!--<param name="rtcp-audio-interval-msec" value="5000"/>-->
<!--<param name="rtcp-video-interval-msec" value="5000"/>-->
<!--force suscription expires to a lower value than requested-->
<!--<param name="force-subscription-expires" value="60"/>-->

View File

@ -48,6 +48,11 @@
/opt/freeswitch/conf/dialplan/features.xml
/opt/freeswitch/conf/dialplan/public/00_inbound_did.xml
/opt/freeswitch/conf/dialplan/public.xml
/opt/freeswitch/conf/dialplan/skinny-patterns/20-Demo.xml
/opt/freeswitch/conf/dialplan/skinny-patterns/99-Default_Drop.xml
/opt/freeswitch/conf/dialplan/skinny-patterns/20-Local_extension.xml
/opt/freeswitch/conf/dialplan/skinny-patterns/90-External.xml
/opt/freeswitch/conf/dialplan/skinny-patterns.xml
/opt/freeswitch/conf/directory/default/1000.xml
/opt/freeswitch/conf/directory/default/1001.xml
/opt/freeswitch/conf/directory/default/1002.xml

View File

@ -55,6 +55,11 @@ opt/freeswitch/conf/dialplan/default.xml
opt/freeswitch/conf/dialplan/features.xml
opt/freeswitch/conf/dialplan/public/00_inbound_did.xml
opt/freeswitch/conf/dialplan/public.xml
opt/freeswitch/conf/dialplan/skinny-patterns/20-Demo.xml
opt/freeswitch/conf/dialplan/skinny-patterns/99-Default_Drop.xml
opt/freeswitch/conf/dialplan/skinny-patterns/20-Local_extension.xml
opt/freeswitch/conf/dialplan/skinny-patterns/90-External.xml
opt/freeswitch/conf/dialplan/skinny-patterns.xml
opt/freeswitch/conf/directory/default/1000.xml
opt/freeswitch/conf/directory/default/1001.xml
opt/freeswitch/conf/directory/default/1002.xml

View File

@ -1,3 +1,20 @@
freeswitch (1.0.7)
config: move limit.conf to db.conf
libesl: Fix potential race condition (ESL-36)
mod_db: fix stack corruption (MODAPP-407)
mod_tts_commandline: fix core dump, temp file problem. flush can be called several times (FSMOD-35)
mod_lcr: Expand variables (MODAPP-418)
mod_sofia: Send SIP MESSAGE to unregistered users by prefixing sip: to user@domain
mod_sofia: fix callee being updated with callee information
freeswitch (1.0.6)
all: migrate to git
core: add ... and shutdown as a fail-safe when no modules are loaded
core: fix high mem usage during shutdown
freeswitch (1.0.5)
all: run indent on the whole tree and update copyright dates in prep for 1.0.5 (r:16579)
@ -50,6 +67,7 @@ freeswitch (1.0.5)
build: Remove libuuid from tree (r:16072)
build: Avoid building static version of modules (e.g. mod_enum.a) by adding the "-shared" libtool option. (r:16225)
build: Fix pidfile path in debian init script (FSBUILD-264/r:17040)
build: Numerous debian improvements (r:17119)
config: improvements to French language handling (MODASRTTS-20/r:14911)
config: Add valet_parking to default config (r:15124)
config: Add valet macros (r:15156)
@ -66,6 +84,7 @@ freeswitch (1.0.5)
config: Allow specifying auth-scheme in config (r:16350/MDXMLINT-56)
config: Improvements to french lang (FSCONFIG-18/r:16585)
config: Add new English sounds, sound prompts (r:16911)
config: Improvements to French sound prompts (FSCONFIG-23/r:17118)
core: Add per-call logging (r:14509)
core: Fix IVR menu timeout when caller presses no digits (DP-4/r:14548)
core: re-factor node allocation and make a copy of userdata in case the session gets killed before the logger module gets the node (r:14555)
@ -253,6 +272,9 @@ freeswitch (1.0.5)
core: Break the loop in switch_ivr_parse_all_events() if CF_BREAK flag has been set (FSCORE-577/r:17074)
core: Fix memory leak caused by the function switch_core_codec_copy (FSCORE-579/r:17105)
core: add sanity check to project size of decoded codec data (r:17108)
core: handle some errors on missing db handle conditions (r:17136)
core: Fix warning message (FSCORE-578)
core: add switch_channel_export_variable
docs: Add large Doxygen update (thanks Muhammed Shahzad) (r:14973)
docs: update es phrase file (MODAPP-317/r:15575)
embedded_languages: Prevent unloading of embedded languages modules (also fixes MODLANG-121/r:14491)
@ -387,6 +409,7 @@ freeswitch (1.0.5)
mod_dptools: Fix bypass_media ignored in dial string (DP-14/r:16588)
mod_dptools: add param setting function to asr (r:16600)
mod_dptools: add action='user_call' to xml_curl lookups for the user endpoint (r:17115)
mod_enum: fix mod_enum build when udns is already on the base system
mod_erlang_event: Add support for simply sending an arbitrary message to an arbitrary registered process at a node (r:14875)
mod_erlang_event: Deprecate new_pid message in favor of get_pid which has an extra element, the call's UUID (r:14877)
mod_erlang_event: optionally allow compatibility with nodes running older OTP releases (R7 through current) (r:15189)
@ -455,6 +478,7 @@ freeswitch (1.0.5)
mod_memcache: update to libmemcached 0.32 (r:14935)
mod_memcache: add --with-memcached=no to libmemcached configure (r:14938)
mod_nibblebill: Support custom sql with var expansion (MODAPP-409/r:17081)
mod_nibblebill: Fix url (FSCORE-580/r:17129)
mod_opal: Added setting of outgoing number and display name from extension number so H.323/Q.931 fields are set correctly in ALERTING and CONNECT messages sent for incoming calls.(r:14900)
mod_opal: Fixed compile issues with latest Opal (r:15545)
mod_portaudio: fix compilation failure in mod_portaudio_stream (MODFORM-35/r:14531)
@ -624,6 +648,7 @@ freeswitch (1.0.5)
mod_sofia: prevent race in killgw followed by an immediate rescan with the same gateway name (r:17096)
mod_sofia: fix telephone-event negotiation with devices that don't do what the rfc says they SHOULD do (r:17097)
mod_sofia: Double @ in To header (MODENDP-300/r:17098)
mod_sofia: add killgw _all_ to delete all gws
mod_spidermonkey: allow inline javascript, use a ~ as first script character (r:15598)
mod_spidermonkey: fix mod_spidermonkey on OSX 10.6 (lets see if this breaks any other platforms) (r:15650)
mod_spidermonkey: fix teletone issues in javascript (MODLANG-159/MODLANG-162/r:16909)

View File

@ -2050,6 +2050,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co
case FTDM_COMMAND_SET_RX_GAIN:
{
if (!FTDM_IS_VOICE_CHANNEL(ftdmchan)) {
ftdm_log(FTDM_LOG_ERROR, "Cannot set rx gain in non-voice channel of type: %s\n", ftdm_chan_type2str(ftdmchan->type));
GOTO_STATUS(done, FTDM_FAIL);
}
ftdmchan->rxgain = FTDM_COMMAND_OBJ_FLOAT;
reset_gain_table(ftdmchan->rxgain_table, ftdmchan->rxgain, ftdmchan->native_codec);
if (ftdmchan->rxgain == 0.0) {
@ -2068,6 +2072,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co
break;
case FTDM_COMMAND_SET_TX_GAIN:
{
if (!FTDM_IS_VOICE_CHANNEL(ftdmchan)) {
ftdm_log(FTDM_LOG_ERROR, "Cannot set tx gain in non-voice channel of type: %s\n", ftdm_chan_type2str(ftdmchan->type));
GOTO_STATUS(done, FTDM_FAIL);
}
ftdmchan->txgain = FTDM_COMMAND_OBJ_FLOAT;
reset_gain_table(ftdmchan->txgain_table, ftdmchan->txgain, ftdmchan->native_codec);
if (ftdmchan->txgain == 0.0) {
@ -2468,17 +2476,17 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data
ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "ftdmchan is null\n");
ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "No I/O module attached to ftdmchan\n");
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) {
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) {
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "channel not open");
return FTDM_FAIL;
}
return FTDM_FAIL;
}
if (!ftdmchan->fio->read) {
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "method not implemented");
return FTDM_FAIL;
}
status = ftdmchan->fio->read(ftdmchan, data, datalen);
status = ftdmchan->fio->read(ftdmchan, data, datalen);
if (ftdmchan->fds[0] > -1) {
int dlen = (int) *datalen;
if (write(ftdmchan->fds[0], data, dlen) != dlen) {

View File

@ -2137,23 +2137,23 @@ static ftdm_status_t ftdm_sangoma_boost_start(ftdm_span_t *span)
static ftdm_status_t ftdm_sangoma_boost_stop(ftdm_span_t *span)
{
int cnt = 10;
ftdm_status_t status = FTDM_SUCCESS;
ftdm_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
if (sangoma_boost_data->sigmod) {
/* FIXME: we should make sure the span thread is stopped (use pthread_kill or freetdm thread kill function) */
/* I think stopping the span before destroying the queue makes sense
otherwise may be boost events would still arrive when the queue is already destroyed! */
status = sangoma_boost_data->sigmod->stop_span(span);
ftdm_queue_enqueue(sangoma_boost_data->boost_queue, NULL);
while(ftdm_test_flag(sangoma_boost_data, FTDM_SANGOMA_BOOST_RUNNING) && cnt-- > 0) {
ftdm_log(FTDM_LOG_DEBUG, "Waiting for boost thread\n");
ftdm_sleep(500);
}
}
while (ftdm_test_flag(sangoma_boost_data, FTDM_SANGOMA_BOOST_RUNNING)) {
ftdm_log(FTDM_LOG_DEBUG, "Waiting for boost thread\n");
ftdm_sleep(100);
}
if (sangoma_boost_data->sigmod) {
ftdm_queue_destroy(&sangoma_boost_data->boost_queue);
return status;
}
return status;
}

View File

@ -168,7 +168,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
\param port the remote port
\param err pointer for error messages
*/
SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port,
SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, switch_port_t remote_rtcp_port,
switch_bool_t change_adv_addr, const char **err);
SWITCH_DECLARE(char *) switch_rtp_get_remote_host(switch_rtp_t *rtp_session);
@ -219,7 +219,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
\param send_rate interval in milliseconds to send at
\return SWITCH_STATUS_SUCCESS
*/
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_session, int send_rate);
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_session, int send_rate, switch_port_t remote_port);
/*!
\brief Acvite a jitter buffer on an RTP session

View File

@ -535,7 +535,9 @@ typedef enum {
SWITCH_RTP_FLAG_DEBUG_RTP_READ = (1 << 27),
SWITCH_RTP_FLAG_DEBUG_RTP_WRITE = (1 << 28),
SWITCH_RTP_FLAG_VIDEO = (1 << 29),
SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30)
SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30),
SWITCH_RTP_FLAG_RTCP_PASSTHRU = (1 << 31)
/* don't add any more 31 is the limit! gotta chnge to an array to add more */
} switch_rtp_flag_enum_t;
typedef uint32_t switch_rtp_flag_t;

View File

@ -944,7 +944,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_nibblebill_load)
/* Add dialplan applications */
SWITCH_ADD_APP(app_interface, "nibblebill", "Handle billing for the current channel/call",
"Pause, resume, reset, adjust, flush, heartbeat commands to handle billing.", nibblebill_app_function, APP_SYNTAX,
SAF_NONE | SAF_ROUTING_EXEC);
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
/* register state handlers for billing */
switch_core_add_state_handler(&nibble_state_handler);

View File

@ -39,7 +39,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;gsmlib\gsmlib-1.10-patched-12ubuntu1&quot;"
AdditionalIncludeDirectories="&quot;gsmlib\gsmlib-1.10-patched-12ubuntu1&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src\msvc&quot;;&quot;$(InputDir)..\..\..\..\libs\spandsp\src&quot;;&quot;$(InputDir)..\..\..\..\libs\tiff-3.8.2\libtiff&quot;"
PreprocessorDefinitions="NO_ALSA"
UsePrecompiledHeader="0"
WarningLevel="4"
@ -56,7 +56,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions=" gsmlib.lib &quot;..\..\..\..\w32\library\debug\freeswitchcore.lib&quot; &quot;..\..\..\..\libs\libteletone\Debug\libteletone.lib&quot; ksuser.lib &quot;..\..\..\..\libs\win32\apr\debug\libapr-1.lib&quot;"
AdditionalOptions=" gsmlib.lib &quot;..\..\..\..\w32\library\debug\freeswitchcore.lib&quot; &quot;..\..\..\..\libs\libteletone\Debug\libteletone.lib&quot; ksuser.lib &quot;..\..\..\..\libs\win32\apr\debug\libapr-1.lib&quot;&#x0D;&#x0A;rpcrt4.lib &quot;..\..\..\..\debug\libtiff.lib&quot; &quot;..\..\..\..\libs\spandsp\src\debug\spandsp.lib&quot;"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/Debug/&quot;"
RandomizedBaseAddress="1"

View File

@ -44,8 +44,6 @@ SWITCH_MODULE_DEFINITION(mod_loopback, mod_loopback_load, mod_loopback_shutdown,
static switch_endpoint_interface_t *loopback_endpoint_interface = NULL;
static switch_memory_pool_t *module_pool = NULL;
typedef enum {
TFLAG_LINKED = (1 << 0),
TFLAG_OUTBOUND = (1 << 1),
@ -887,10 +885,6 @@ static switch_io_routines_t channel_io_routines = {
SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load)
{
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
return SWITCH_STATUS_TERM;
}
memset(&globals, 0, sizeof(globals));

View File

@ -466,7 +466,8 @@ struct sofia_profile {
char *record_path;
char *presence_hosts;
char *challenge_realm;
char *rtcp_interval_msec;
char *rtcp_audio_interval_msec;
char *rtcp_video_interval_msec;
sofia_cid_type_t cid_type;
sofia_dtmf_t dtmf_type;
int auto_restart;

View File

@ -2459,8 +2459,10 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
profile->hold_music = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "outbound-proxy")) {
profile->outbound_proxy = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "rtcp-interval-msec")) {
profile->rtcp_interval_msec = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "rtcp-audio-interval-msec")) {
profile->rtcp_audio_interval_msec = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "rtcp-video-interval-msec")) {
profile->rtcp_video_interval_msec = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "session-timeout")) {
int v_session_timeout = atoi(val);
if (v_session_timeout >= 0) {
@ -2998,8 +3000,10 @@ switch_status_t config_sofia(int reload, char *profile_name)
profile->hold_music = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "outbound-proxy")) {
profile->outbound_proxy = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "rtcp-interval-msec")) {
profile->rtcp_interval_msec = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "rtcp-audio-interval-msec")) {
profile->rtcp_audio_interval_msec = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "rtcp-video-interval-msec")) {
profile->rtcp_video_interval_msec = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "session-timeout")) {
int v_session_timeout = atoi(val);
if (v_session_timeout >= 0) {
@ -3748,6 +3752,12 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
char *full_contact = NULL;
char *invite_contact;
const char *br;
const char *v;
if ((v = switch_channel_get_variable(channel, "outbound_redirect_fatal")) && switch_true(v)) {
switch_channel_hangup(channel, SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL);
goto end;
}
if (!p_contact) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing contact header in redirect request\n");

View File

@ -691,7 +691,7 @@ const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name)
switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int force)
{
char *lookup_rtpip = tech_pvt->profile->rtpip; /* Pointer to externally looked up address */
switch_port_t sdp_port; /* The external port to be sent in the SDP */
switch_port_t sdp_port, rtcp_port; /* The external port to be sent in the SDP */
const char *use_ip = NULL; /* The external IP to be sent in the SDP */
/* Don't do anything if we're in proxy mode or if a (remote) port already has been found */
@ -734,6 +734,7 @@ switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int forc
if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
/* Yes, map the port through switch_nat */
switch_nat_add_mapping(tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE);
switch_nat_add_mapping(tech_pvt->local_sdp_audio_port + 1, SWITCH_NAT_UDP, &rtcp_port, SWITCH_FALSE);
} else {
/* No NAT detected */
use_ip = tech_pvt->profile->rtpip;
@ -1126,8 +1127,16 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
sofia_set_flag_locked(tech_pvt, TFLAG_VIDEO);
switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
const char *rport = NULL;
switch_port_t remote_rtcp_port = 0;
if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_video_rtcp_port"))) {
remote_rtcp_port = atoi(rport);
}
if (switch_rtp_set_remote_address(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip,
tech_pvt->remote_sdp_video_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
tech_pvt->remote_sdp_video_port, remote_rtcp_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", err);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "VIDEO RTP CHANGING DEST TO: [%s:%d]\n",
@ -1148,6 +1157,8 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
if (switch_rtp_ready(tech_pvt->rtp_session)) {
char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session);
switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session);
const char *rport = NULL;
switch_port_t remote_rtcp_port = 0;
if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_audio_ip) && remote_port == tech_pvt->remote_sdp_audio_port) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n",
@ -1155,8 +1166,13 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
return SWITCH_STATUS_SUCCESS;
}
if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_audio_rtcp_port"))) {
remote_rtcp_port = atoi(rport);
}
if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip,
tech_pvt->remote_sdp_audio_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
tech_pvt->remote_sdp_audio_port, remote_rtcp_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", err);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "AUDIO RTP CHANGING DEST TO: [%s:%d]\n",
@ -2604,9 +2620,17 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
if (tech_pvt->rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
const char *rport = NULL;
switch_port_t remote_rtcp_port = 0;
sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, SWITCH_TRUE, &err) !=
if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_audio_rtcp_port"))) {
remote_rtcp_port = atoi(rport);
}
if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port,
remote_rtcp_port, SWITCH_TRUE, &err) !=
SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", err);
} else {
@ -2726,12 +2750,21 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
(tech_pvt->stun_flags & STUN_FLAG_FUNNY) ? 1 : 0);
}
if ((val = switch_channel_get_variable(tech_pvt->channel, "rtcp_interval_msec")) || (val = tech_pvt->profile->rtcp_interval_msec)) {
int interval = atoi(val);
if (interval < 100 || interval > 5000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Invalid rtcp interval spec [%d] must be between 100 and 5000\n", interval);
if ((val = switch_channel_get_variable(tech_pvt->channel, "rtcp_audio_interval_msec")) || (val = tech_pvt->profile->rtcp_audio_interval_msec)) {
const char *rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_audio_rtcp_port");
switch_port_t remote_port = 0;
if (rport) {
remote_port = atoi(rport);
}
if (!strcasecmp(val, "passthru")) {
switch_rtp_activate_rtcp(tech_pvt->rtp_session, -1, remote_port);
} else {
switch_rtp_activate_rtcp(tech_pvt->rtp_session, interval);
int interval = atoi(val);
if (interval < 100 || interval > 5000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Invalid rtcp interval spec [%d] must be between 100 and 5000\n", interval);
} else {
switch_rtp_activate_rtcp(tech_pvt->rtp_session, interval, remote_port);
}
}
}
@ -2849,10 +2882,17 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE, tmp);
if (tech_pvt->video_rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
const char *rport = NULL;
switch_port_t remote_rtcp_port = 0;
sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_video_rtcp_port"))) {
remote_rtcp_port = atoi(rport);
}
if (switch_rtp_set_remote_address
(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port, SWITCH_TRUE,
(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port, remote_rtcp_port, SWITCH_TRUE,
&err) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", err);
} else {
@ -2949,6 +2989,27 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
switch_channel_set_variable_printf(tech_pvt->channel, "sip_use_video_pt", "%d", tech_pvt->video_agreed_pt);
tech_pvt->video_ssrc = switch_rtp_get_ssrc(tech_pvt->rtp_session);
switch_channel_set_variable_printf(tech_pvt->channel, "rtp_use_video_ssrc", "%u", tech_pvt->ssrc);
if ((val = switch_channel_get_variable(tech_pvt->channel, "rtcp_audio_interval_msec")) || (val = tech_pvt->profile->rtcp_audio_interval_msec)) {
const char *rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_video_rtcp_port");
switch_port_t remote_port = 0;
if (rport) {
remote_port = atoi(rport);
}
if (!strcasecmp(val, "passthru")) {
switch_rtp_activate_rtcp(tech_pvt->rtp_session, -1, remote_port);
} else {
int interval = atoi(val);
if (interval < 100 || interval > 5000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Invalid rtcp interval spec [%d] must be between 100 and 5000\n", interval);
} else {
switch_rtp_activate_rtcp(tech_pvt->rtp_session, interval, remote_port);
}
}
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err));
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@ -3378,6 +3439,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
} else if (m->m_type == sdp_media_audio && m->m_port && !got_audio) {
sdp_rtpmap_t *map;
for (attr = m->m_attributes; attr; attr = attr->a_next) {
if (!strcasecmp(attr->a_name, "rtcp") && attr->a_value) {
switch_channel_set_variable(tech_pvt->channel, "sip_remote_audio_rtcp_port", attr->a_value);
}
if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
ptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) {
@ -3708,6 +3774,9 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
if (!strcasecmp(attr->a_name, "framerate") && attr->a_value) {
framerate = atoi(attr->a_value);
}
if (!strcasecmp(attr->a_name, "rtcp") && attr->a_value) {
switch_channel_set_variable(tech_pvt->channel, "sip_remote_video_rtcp_port", attr->a_value);
}
}
if (!(rm_encoding = map->rm_encoding)) {
rm_encoding = "";

View File

@ -36,7 +36,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sndfile_shutdown);
SWITCH_MODULE_DEFINITION(mod_sndfile, mod_sndfile_load, mod_sndfile_shutdown, NULL);
static switch_memory_pool_t *module_pool = NULL;
static struct {
switch_hash_t *format_hash;
@ -415,12 +414,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load)
{
switch_file_interface_t *file_interface;
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
return SWITCH_STATUS_TERM;
}
switch_core_hash_init(&globals.format_hash, module_pool);
switch_core_hash_init(&globals.format_hash, pool);
if (setup_formats() != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
@ -447,6 +441,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sndfile_shutdown)
{
switch_core_hash_destroy(&globals.format_hash);
return SWITCH_STATUS_SUCCESS;
}

View File

@ -398,9 +398,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_logfile_shutdown)
if ((profile = (logfile_profile_t *) val)) {
switch_file_close(profile->log_afd);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Closing %s\n", profile->logfile);
switch_safe_free(profile->logfile);
}
}
switch_core_hash_destroy(&profile_hash);
return SWITCH_STATUS_SUCCESS;

View File

@ -791,6 +791,7 @@ int main(int argc, char *argv[])
destroy_status = switch_core_destroy();
switch_file_close(fd);
apr_pool_destroy(pool);
if (unlink(pid_path) != 0) {
fprintf(stderr, "Failed to delete pid file [%s]\n", pid_path);

View File

@ -1867,13 +1867,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
switch_safe_free(SWITCH_GLOBAL_dirs.script_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.htdocs_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.grammar_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.storage_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.recordings_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.sounds_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.run_dir);
switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir);
switch_core_hash_destroy(&runtime.global_vars);
switch_core_hash_destroy(&runtime.mime_types);
if (IP_LIST.hash) {
switch_core_hash_destroy(&IP_LIST.hash);
}
if (IP_LIST.pool) {
switch_core_destroy_memory_pool(&IP_LIST.pool);
}
if (runtime.memory_pool) {
apr_pool_destroy(runtime.memory_pool);
apr_terminate();

View File

@ -127,7 +127,16 @@ void *switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err)
{
void *addr = dlsym(lib, sym);
if (!addr) {
*err = strdup(dlerror());
char *err_str = NULL;
dlerror();
if (!(addr = dlsym(lib, sym))) {
err_str = dlerror();
}
if (err_str) {
*err = strdup(err_str);
}
}
return addr;
}

View File

@ -788,7 +788,7 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
switch_loadable_module_interface_t *module_interface = NULL;
char *derr = NULL;
const char *err = NULL;
switch_memory_pool_t *pool;
switch_memory_pool_t *pool = NULL;
switch_bool_t load_global = global;
switch_assert(path != NULL);
@ -1349,6 +1349,7 @@ SWITCH_DECLARE(void) switch_loadable_module_shutdown(void)
switch_core_hash_destroy(&loadable_modules.management_hash);
switch_core_hash_destroy(&loadable_modules.dialplan_hash);
switch_core_destroy_memory_pool(&loadable_modules.pool);
}
SWITCH_DECLARE(switch_endpoint_interface_t *) switch_loadable_module_get_endpoint_interface(const char *name)

View File

@ -195,6 +195,7 @@ struct switch_rtp {
uint32_t ms_per_packet;
switch_port_t local_port;
switch_port_t remote_port;
switch_port_t remote_rtcp_port;
uint32_t stuncount;
uint32_t funny_stun;
uint32_t default_stuncount;
@ -773,25 +774,31 @@ static switch_status_t enable_remote_rtcp_socket(switch_rtp_t *rtp_session, cons
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) {
rtp_session->rtcp_remote_addr = rtp_session->remote_addr;
if (switch_sockaddr_info_get(&rtp_session->rtcp_remote_addr, rtp_session->remote_host_str, SWITCH_UNSPEC,
rtp_session->remote_port + 1, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !rtp_session->rtcp_remote_addr) {
rtp_session->remote_rtcp_port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !rtp_session->rtcp_remote_addr) {
*err = "RTCP Remote Address Error!";
return SWITCH_STATUS_FALSE;
} else {
const char *host;
char bufa[30];
host = switch_get_addr(bufa, sizeof(bufa), rtp_session->rtcp_remote_addr);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting RTCP remote addr to %s:%d\n", host, rtp_session->remote_rtcp_port);
}
if (rtp_session->rtcp_sock_input && switch_sockaddr_get_family(rtp_session->rtcp_remote_addr) ==
switch_sockaddr_get_family(rtp_session->rtcp_local_addr)) {
rtp_session->rtcp_sock_output = rtp_session->rtcp_sock_input;
} else {
if (rtp_session->rtcp_sock_output && rtp_session->rtcp_sock_output != rtp_session->rtcp_sock_input) {
switch_socket_close(rtp_session->rtcp_sock_output);
}
if ((status = switch_socket_create(&rtp_session->rtcp_sock_output,
switch_sockaddr_get_family(rtp_session->rtcp_remote_addr),
SOCK_DGRAM, 0, rtp_session->pool)) != SWITCH_STATUS_SUCCESS) {
*err = "RTCP Socket Error!";
if (!(rtp_session->rtcp_sock_input && rtp_session->rtcp_sock_output)) {
if (rtp_session->rtcp_sock_input && switch_sockaddr_get_family(rtp_session->rtcp_remote_addr) ==
switch_sockaddr_get_family(rtp_session->rtcp_local_addr)) {
rtp_session->rtcp_sock_output = rtp_session->rtcp_sock_input;
} else {
if (rtp_session->rtcp_sock_output && rtp_session->rtcp_sock_output != rtp_session->rtcp_sock_input) {
switch_socket_close(rtp_session->rtcp_sock_output);
}
if ((status = switch_socket_create(&rtp_session->rtcp_sock_output,
switch_sockaddr_get_family(rtp_session->rtcp_remote_addr),
SOCK_DGRAM, 0, rtp_session->pool)) != SWITCH_STATUS_SUCCESS) {
*err = "RTCP Socket Error!";
}
}
}
} else {
@ -1021,7 +1028,7 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_get_remote_port(switch_rtp_t *rtp_sessi
}
SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port,
SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, switch_port_t remote_rtcp_port,
switch_bool_t change_adv_addr, const char **err)
{
switch_sockaddr_t *remote_addr;
@ -1057,6 +1064,11 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_
}
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) {
if (remote_rtcp_port) {
rtp_session->remote_rtcp_port = remote_rtcp_port;
} else {
rtp_session->remote_rtcp_port = rtp_session->remote_port + 1;
}
status = enable_remote_rtcp_socket(rtp_session, err);
}
@ -1248,6 +1260,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
{
switch_rtp_t *rtp_session = NULL;
switch_core_session_t *session = switch_core_memory_pool_get_data(pool, "__session");
switch_channel_t *channel = NULL;
if (session) channel = switch_core_session_get_channel(session);
*new_rtp_session = NULL;
@ -1303,13 +1318,13 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
rtp_session->payload = payload;
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) {
rtp_session->rtcp_send_msg.header.version = 2;
rtp_session->rtcp_send_msg.header.p = 0;
rtp_session->rtcp_send_msg.header.type = 200;
rtp_session->rtcp_send_msg.header.count = 0;
rtp_session->rtcp_send_msg.header.length = htons(6);
}
rtp_session->rtcp_send_msg.header.version = 2;
rtp_session->rtcp_send_msg.header.p = 0;
rtp_session->rtcp_send_msg.header.type = 200;
rtp_session->rtcp_send_msg.header.count = 0;
rtp_session->rtcp_send_msg.header.length = htons(6);
switch_rtp_set_interval(rtp_session, ms_per_packet, samples_per_interval);
rtp_session->conf_samples_per_interval = samples_per_interval;
@ -1341,12 +1356,13 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
}
switch_channel_set_private(channel, "__rtcp_audio_rtp_session", rtp_session);
#ifdef ENABLE_ZRTP
if (zrtp_on) {
switch_rtp_t *master_rtp_session = NULL;
int initiator = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *zrtp_enabled = switch_channel_get_variable(channel, "zrtp_secure_media");
const char *srtp_enabled = switch_channel_get_variable(channel, "sip_secure_media");
@ -1459,7 +1475,7 @@ SWITCH_DECLARE(switch_rtp_t *) switch_rtp_new(const char *rx_host,
goto end;
}
if (switch_rtp_set_remote_address(rtp_session, tx_host, tx_port, SWITCH_TRUE, err) != SWITCH_STATUS_SUCCESS) {
if (switch_rtp_set_remote_address(rtp_session, tx_host, tx_port, 0, SWITCH_TRUE, err) != SWITCH_STATUS_SUCCESS) {
switch_mutex_unlock(rtp_session->flag_mutex);
rtp_session = NULL;
goto end;
@ -1531,14 +1547,24 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_session, int send_rate)
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_session, int send_rate, switch_port_t remote_port)
{
const char *err = NULL;
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTCP send rate is: %d and packet rate is: %d\n", send_rate, rtp_session->ms_per_packet);
rtp_session->rtcp_interval = send_rate/(rtp_session->ms_per_packet/1000);
if (!(rtp_session->remote_rtcp_port = remote_port)) {
rtp_session->remote_rtcp_port = rtp_session->remote_port + 1;
}
if (send_rate == -1) {
switch_set_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_PASSTHRU);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTCP passthru enabled. Remote Port: %d\n", rtp_session->remote_rtcp_port);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTCP send rate is: %d and packet rate is: %d Remote Port: %d\n",
send_rate, rtp_session->ms_per_packet, rtp_session->remote_rtcp_port);
rtp_session->rtcp_interval = send_rate/(rtp_session->ms_per_packet/1000);
}
return enable_local_rtcp_socket(rtp_session, &err) || enable_remote_rtcp_socket(rtp_session, &err);
@ -2236,6 +2262,68 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
if (rtcp_poll_status == SWITCH_STATUS_SUCCESS) {
rtcp_status = read_rtcp_packet(rtp_session, &rtcp_bytes, flags);
if (rtcp_status == SWITCH_STATUS_SUCCESS && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_PASSTHRU)) {
switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
if (uuid) {
switch_core_session_t *other_session;
switch_rtp_t *other_rtp_session = NULL;
if ((other_session = switch_core_session_locate(uuid))) {
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
if ((other_rtp_session = switch_channel_get_private(other_channel, "__rtcp_audio_rtp_session")) &&
switch_test_flag(other_rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) {
*other_rtp_session->rtcp_send_msg.body = *rtp_session->rtcp_recv_msg.body;
if (switch_test_flag(other_rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) {
int sbytes = (int) rtcp_bytes;
int stat = srtp_protect_rtcp(other_rtp_session->send_ctx, &other_rtp_session->rtcp_send_msg.header, &sbytes);
if (stat) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: SRTP RTCP protection failed with code %d\n", stat);
}
rtcp_bytes = sbytes;
}
#ifdef ENABLE_ZRTP
/* ZRTP Send */
if (1) {
unsigned int sbytes = (int) bytes;
zrtp_status_t stat = zrtp_status_fail;
stat = zrtp_process_rtcp(other_rtp_session->zrtp_stream, (void *) &other_rtp_session->rtcp_send_msg, &sbytes);
switch (stat) {
case zrtp_status_ok:
break;
case zrtp_status_drop:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
ret = (int) bytes;
goto end;
break;
case zrtp_status_fail:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
break;
default:
break;
}
bytes = sbytes;
}
#endif
if (switch_socket_sendto(other_rtp_session->rtcp_sock_output, other_rtp_session->rtcp_remote_addr, 0,
(const char*)&other_rtp_session->rtcp_send_msg, &rtcp_bytes ) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"RTCP packet not written\n");
}
}
}
}
}
}
}
@ -2351,7 +2439,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
switch_channel_set_variable(channel, "rtp_auto_adjust", "true");
}
switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), SWITCH_FALSE, &err);
switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), 0, SWITCH_FALSE, &err);
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}
} else {
@ -3244,7 +3332,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
rtp_session->last_write_ts = this_ts;
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP) &&
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_PASSTHRU) &&
rtp_session->rtcp_interval && (rtp_session->stats.outbound.packet_count % rtp_session->rtcp_interval) == 0) {
struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_send_msg.body;

View File

@ -1064,6 +1064,10 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(softtimer_shutdown)
switch_core_destroy_memory_pool(&TIMEZONES_LIST.pool);
}
if (NODE) {
switch_event_unbind(&NODE);
}
return SWITCH_STATUS_SUCCESS;
}