Merge branch 'master' into v1.4.beta

This commit is contained in:
Ken Rice
2013-06-28 14:39:09 -05:00
8 changed files with 132 additions and 41 deletions
+16 -2
View File
@@ -700,6 +700,14 @@ Requires: %{name} = %{version}-%{release}
%description codec-isac
iSAC Codec support for FreeSWITCH open source telephony platform
%package codec-vp8
Summary: vp8 Codec support for FreeSWITCH open source telephony platform
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
%description codec-vp8
iSAC Codec support for FreeSWITCH open source telephony platform
%package codec-mp4v
Summary: MP4V Video Codec support for FreeSWITCH open source telephony platform
Group: System/Libraries
@@ -1329,7 +1337,7 @@ ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_comm
######################################################################################################################
CODECS_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_bv codecs/mod_celt codecs/mod_codec2 codecs/mod_g723_1 \
codecs/mod_g729 codecs/mod_h26x codecs/mod_ilbc codecs/mod_isac codecs/mod_mp4v codecs/mod_opus codecs/mod_silk \
codecs/mod_siren codecs/mod_speex codecs/mod_theora "
codecs/mod_siren codecs/mod_speex codecs/mod_theora mod_vp8"
#
%if %{build_sng_tc}
CODECS_MODULES+="codecs/mod_sangoma_codec"
@@ -2040,6 +2048,10 @@ fi
%defattr(-,freeswitch,daemon)
%{MODINSTDIR}/mod_mp4v.so*
%files codec-mp4v
%defattr(-,freeswitch,daemon)
%{MODINSTDIR}/mod_vp8.so*
%files codec-opus
%defattr(-,freeswitch,daemon)
%{MODINSTDIR}/mod_opus.so*
@@ -2374,7 +2386,9 @@ fi
#
######################################################################################################################
%changelog
* Thu June 19 2013 - krice@freeswitch.org
* Thu Jun 28 2013 - krice@freeswitch.org
- Add module for VP8
* Thu Jun 19 2013 - krice@freeswitch.org
- tweak files included for vanilla configs
* Thu Sep 19 2012 - krice@freeswitch.org
- Add support for Spanish and Portugese say language modules
+1 -1
View File
@@ -1 +1 @@
Thu Jun 27 14:04:11 CDT 2013
Fri Jun 28 10:39:50 CDT 2013
+25 -20
View File
@@ -152,9 +152,7 @@ struct nta_agent_s
nta_error_magic_t *sa_error_magic;
nta_error_tport_f *sa_error_tport;
su_time_t sa_now; /**< Timestamp in microsecond resolution. */
uint32_t sa_next; /**< Timestamp for next agent_timer. */
uint32_t sa_millisec; /**< Timestamp in milliseconds. */
msg_mclass_t const *sa_mclass;
uint32_t sa_flags; /**< SIP message flags */
@@ -1242,15 +1240,12 @@ void agent_timer(su_root_magic_t *rm, su_timer_t *timer, nta_agent_t *agent)
agent->sa_next = 0;
agent->sa_now = stamp;
agent->sa_millisec = now;
agent->sa_in_timer = 1;
_nta_outgoing_timer(agent);
_nta_incoming_timer(agent);
/* agent->sa_now is used only if sa_millisec != 0 */
agent->sa_millisec = 0;
agent->sa_in_timer = 0;
/* Calculate next timeout */
@@ -1335,12 +1330,12 @@ uint32_t set_timeout(nta_agent_t *agent, uint32_t offset)
if (offset == 0)
return 0;
if (agent->sa_millisec) /* Avoid expensive call to su_now() */
now = agent->sa_now, ms = agent->sa_millisec;
else
now = su_now(), ms = su_time_ms(now);
now = su_now();
ms = su_time_ms(now);
next = ms + offset; if (next == 0) next = 1;
next = ms + offset;
if (next == 0) next = 1;
if (agent->sa_in_timer) /* Currently executing timer */
return next;
@@ -1365,9 +1360,6 @@ uint32_t set_timeout(nta_agent_t *agent, uint32_t offset)
static
su_time_t agent_now(nta_agent_t const *agent)
{
if (agent && agent->sa_millisec != 0)
return agent->sa_now;
else
return su_now();
}
@@ -2784,8 +2776,6 @@ void agent_recv_message(nta_agent_t *agent,
{
sip_t *sip = sip_object(msg);
agent->sa_millisec = su_time_ms(agent->sa_now = now);
if (sip && sip->sip_request) {
agent_recv_request(agent, msg, sip, tport);
}
@@ -2795,8 +2785,6 @@ void agent_recv_message(nta_agent_t *agent,
else {
agent_recv_garbage(agent, msg, tport);
}
agent->sa_millisec = 0;
}
/** @internal Handle incoming requests. */
@@ -6869,7 +6857,7 @@ enum {
static void
_nta_incoming_timer(nta_agent_t *sa)
{
uint32_t now = sa->sa_millisec;
uint32_t now = su_time_ms(su_now());
nta_incoming_t *irq, *irq_next;
size_t retransmitted = 0, timeout = 0, terminated = 0, destroyed = 0;
size_t unconfirmed =
@@ -6886,6 +6874,9 @@ _nta_incoming_timer(nta_agent_t *sa)
/* Handle retry queue */
while ((irq = sa->sa_in.re_list)) {
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_retry - now) > 0)
break;
if (retransmitted >= timer_max_retransmit)
@@ -6943,6 +6934,8 @@ _nta_incoming_timer(nta_agent_t *sa)
}
while ((irq = sa->sa_in.final_failed->q_head)) {
incoming_remove(irq);
irq->irq_final_failed = 0;
@@ -6974,6 +6967,8 @@ _nta_incoming_timer(nta_agent_t *sa)
assert(irq->irq_status < 200);
assert(irq->irq_timeout);
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_timeout - now) > 0)
break;
if (timeout >= timer_max_timeout)
@@ -6994,6 +6989,8 @@ _nta_incoming_timer(nta_agent_t *sa)
assert(irq->irq_timeout);
assert(irq->irq_method == sip_method_invite);
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_timeout - now) > 0 ||
timeout >= timer_max_timeout ||
terminated >= timer_max_terminate)
@@ -7022,6 +7019,8 @@ _nta_incoming_timer(nta_agent_t *sa)
assert(irq->irq_status >= 200);
assert(irq->irq_method == sip_method_invite);
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_timeout - now) > 0 ||
terminated >= timer_max_terminate)
break;
@@ -7044,6 +7043,8 @@ _nta_incoming_timer(nta_agent_t *sa)
assert(irq->irq_timeout);
assert(irq->irq_method != sip_method_invite);
now = su_time_ms(su_now());
if ((int32_t)(irq->irq_timeout - now) > 0 ||
terminated >= timer_max_terminate)
break;
@@ -7063,6 +7064,7 @@ _nta_incoming_timer(nta_agent_t *sa)
}
for (irq = sa->sa_in.terminated->q_head; irq; irq = irq_next) {
irq_next = irq->irq_next;
if (irq->irq_destroyed)
incoming_free_queue(rq, irq);
@@ -8727,7 +8729,7 @@ void outgoing_destroy(nta_outgoing_t *orq)
static void
_nta_outgoing_timer(nta_agent_t *sa)
{
uint32_t now = sa->sa_millisec;
uint32_t now = su_time_ms(su_now());
nta_outgoing_t *orq;
outgoing_queue_t rq[1];
size_t retransmitted = 0, terminated = 0, timeout = 0, destroyed;
@@ -8741,6 +8743,9 @@ _nta_outgoing_timer(nta_agent_t *sa)
outgoing_queue_init(sa->sa_out.free = rq, 0);
while ((orq = sa->sa_out.re_list)) {
now = su_time_ms(su_now());
if ((int32_t)(orq->orq_retry - now) > 0)
break;
if (retransmitted >= timer_max_retransmit)
@@ -85,6 +85,11 @@ typedef uint64_t su_nanotime_t;
#define SU_E9 (1000000000U)
typedef void (*su_time_func_t)(su_time_t *tv);
SOFIAPUBFUN void su_set_time_func(su_time_func_t func);
SOFIAPUBFUN su_nanotime_t su_nanotime(su_nanotime_t *return_time);
SOFIAPUBFUN su_nanotime_t su_monotime(su_nanotime_t *return_time);
@@ -138,7 +143,7 @@ su_inline uint32_t su_ntp_fraq(su_time_t t)
/** Time as milliseconds. */
su_inline uint32_t su_time_ms(su_time_t t)
{
return t.tv_sec * 1000 + (t.tv_usec + 500) / 1000;
return (t.tv_sec * 1000) + ((t.tv_usec + 500) / 1000);
}
#endif
+20 -4
View File
@@ -69,6 +69,13 @@
void (*_su_time)(su_time_t *tv);
uint64_t (*_su_nanotime)(uint64_t *);
static su_time_func_t custom_time_func = NULL;
void su_set_time_func(su_time_func_t func) {
custom_time_func = func;
}
/** Get current time.
*
* The function @c su_time() fills its argument with the current NTP
@@ -78,7 +85,20 @@ uint64_t (*_su_nanotime)(uint64_t *);
*/
void su_time(su_time_t *tv)
{
#if HAVE_FILETIME
union {
FILETIME ft[1];
ULARGE_INTEGER ull[1];
} date;
#endif
su_time_t ltv = {0,0};
if (custom_time_func) {
custom_time_func(&ltv);
if (tv) *tv = ltv;
return;
}
#if HAVE_CLOCK_GETTIME
struct timespec ctv = {0};
if (clock_gettime(CLOCK_REALTIME, &ctv) == 0) {
@@ -91,10 +111,6 @@ void su_time(su_time_t *tv)
ltv.tv_sec += NTP_EPOCH;
#elif HAVE_FILETIME
union {
FILETIME ft[1];
ULARGE_INTEGER ull[1];
} date;
GetSystemTimeAsFileTime(date.ft);
+25
View File
@@ -214,6 +214,28 @@ SWITCH_STANDARD_API(skel_function)
return SWITCH_STATUS_SUCCESS;
}
static void mycb(switch_core_session_t *session, switch_channel_callstate_t callstate, switch_device_record_t *drec)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT,
"%s device: %s\nState: %s Dev State: %s/%s Total:%u Offhook:%u Active:%u Held:%u Hungup:%u Dur: %u %s\n",
switch_channel_get_name(channel),
drec->device_id,
switch_channel_callstate2str(callstate),
switch_channel_device_state2str(drec->last_state),
switch_channel_device_state2str(drec->state),
drec->stats.total,
drec->stats.offhook,
drec->stats.active,
drec->stats.held,
drec->stats.hup,
drec->active_stop ? (uint32_t)(drec->active_stop - drec->active_start) / 1000 : 0,
switch_channel_test_flag(channel, CF_FINAL_DEVICE_LEG) ? "FINAL LEG" : "");
}
/* Macro expands to: switch_status_t mod_skel_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load)
{
@@ -227,6 +249,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load)
SWITCH_ADD_API(api_interface, "skel", "Skel API", skel_function, "syntax");
switch_channel_bind_device_state_handler(mycb, NULL);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
@@ -237,6 +261,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load)
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skel_shutdown)
{
/* Cleanup dynamically allocated config settings */
switch_channel_unbind_device_state_handler(mycb);
switch_xml_config_cleanup(instructions);
return SWITCH_STATUS_SUCCESS;
}
+19
View File
@@ -3488,6 +3488,21 @@ static void config_sofia_profile_urls(sofia_profile_t * profile)
}
}
#ifdef SOFIA_CUSTOM_TIME
/* appears to not be granular enough */
static void sofia_time(su_time_t *tv)
{
switch_time_t now;
if (tv) {
now = switch_micro_time_now();
tv->tv_sec = ((uint32_t) (now / 1000000)) + 2208988800UL;
tv->tv_usec = (uint32_t) (now % 1000000);
}
}
#endif
switch_status_t sofia_init(void)
{
su_init();
@@ -3496,6 +3511,10 @@ switch_status_t sofia_init(void)
return SWITCH_STATUS_GENERR;
}
#ifdef SOFIA_TIME
su_set_time_func(sofia_time);
#endif
/* Redirect loggers in sofia */
su_log_redirect(su_log_default, logger, NULL);
su_log_redirect(tport_log, logger, NULL);
+20 -13
View File
@@ -4701,31 +4701,36 @@ SWITCH_DECLARE(void) switch_channel_clear_device_record(switch_channel_t *channe
static void process_device_hup(switch_channel_t *channel)
{
switch_hold_record_t *hr, *newhr, *last = NULL;
switch_device_record_t *drec = NULL;
switch_device_node_t *node;
if (!channel->device_node) {
return;
}
switch_mutex_lock(globals.device_mutex);
channel->device_node->hup_profile = switch_caller_profile_dup(channel->device_node->parent->pool, channel->caller_profile);
fetch_device_stats(channel->device_node->parent);
node = channel->device_node;
drec = channel->device_node->parent;
switch_ivr_generate_xml_cdr(channel->session, &channel->device_node->xml_cdr);
if (switch_event_create(&channel->device_node->event, SWITCH_EVENT_CALL_DETAIL) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_extended_data(channel, channel->device_node->event);
node->hup_profile = switch_caller_profile_dup(drec->pool, channel->caller_profile);
fetch_device_stats(drec);
switch_ivr_generate_xml_cdr(channel->session, &node->xml_cdr);
if (switch_event_create(&node->event, SWITCH_EVENT_CALL_DETAIL) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_extended_data(channel, node->event);
}
for (hr = channel->hold_record; hr; hr = hr->next) {
newhr = switch_core_alloc(channel->device_node->parent->pool, sizeof(*newhr));
newhr = switch_core_alloc(drec->pool, sizeof(*newhr));
newhr->on = hr->on;
newhr->off = hr->off;
if (hr->uuid) {
newhr->uuid = switch_core_strdup(channel->device_node->parent->pool, hr->uuid);
newhr->uuid = switch_core_strdup(drec->pool, hr->uuid);
}
if (!channel->device_node->hold_record) {
channel->device_node->hold_record = newhr;
if (!node->hold_record) {
node->hold_record = newhr;
} else {
last->next = newhr;
}
@@ -4733,15 +4738,17 @@ static void process_device_hup(switch_channel_t *channel)
last = newhr;
}
if (!channel->device_node->parent->stats.offhook) { /* this is final call */
if (!drec->stats.offhook) { /* this is final call */
switch_core_hash_delete(globals.device_hash, channel->device_node->parent->device_id);
switch_core_hash_delete(globals.device_hash, drec->device_id);
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Processing last call from device [%s]\n",
channel->device_node->parent->device_id);
drec->device_id);
switch_channel_set_flag(channel, CF_FINAL_DEVICE_LEG);
} else {
channel->device_node = NULL;
}
channel->device_node->parent->refs--;
drec->refs--;
switch_mutex_unlock(globals.device_mutex);