RTP stats were not being logged. There is no JIRA on this sigh
This commit is contained in:
parent
442a53ae3c
commit
7a42ec06df
|
@ -251,6 +251,7 @@ SWITCH_DECLARE(void) switch_core_session_set_ice(switch_core_session_t *session)
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_core_media_init(void);
|
SWITCH_DECLARE(void) switch_core_media_init(void);
|
||||||
SWITCH_DECLARE(void) switch_core_media_deinit(void);
|
SWITCH_DECLARE(void) switch_core_media_deinit(void);
|
||||||
|
SWITCH_DECLARE(void) switch_core_media_set_stats(switch_core_session_t *session);
|
||||||
|
|
||||||
SWITCH_END_EXTERN_C
|
SWITCH_END_EXTERN_C
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -632,9 +632,6 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||||
*tech_pvt->sofia_private->uuid = '\0';
|
*tech_pvt->sofia_private->uuid = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sofia_glue_set_rtp_stats(tech_pvt);
|
|
||||||
|
|
||||||
switch_mutex_unlock(tech_pvt->sofia_mutex);
|
switch_mutex_unlock(tech_pvt->sofia_mutex);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
|
@ -1065,7 +1065,6 @@ switch_status_t list_profiles_full(const char *line, const char *cursor, switch_
|
||||||
switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches);
|
switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches);
|
||||||
|
|
||||||
sofia_cid_type_t sofia_cid_name2type(const char *name);
|
sofia_cid_type_t sofia_cid_name2type(const char *name);
|
||||||
void sofia_glue_set_rtp_stats(private_object_t *tech_pvt);
|
|
||||||
void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port);
|
void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port);
|
||||||
sofia_destination_t *sofia_glue_get_destination(char *data);
|
sofia_destination_t *sofia_glue_get_destination(char *data);
|
||||||
void sofia_glue_free_destination(sofia_destination_t *dst);
|
void sofia_glue_free_destination(sofia_destination_t *dst);
|
||||||
|
|
|
@ -1339,52 +1339,6 @@ void sofia_glue_do_xfer_invite(switch_core_session_t *session)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define add_stat(_i, _s) \
|
|
||||||
switch_snprintf(var_name, sizeof(var_name), "rtp_%s_%s", switch_str_nil(prefix), _s) ; \
|
|
||||||
switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_SIZE_T_FMT, _i); \
|
|
||||||
switch_channel_set_variable(channel, var_name, var_val)
|
|
||||||
|
|
||||||
static void set_stats(switch_core_session_t *session, switch_media_type_t type, const char *prefix)
|
|
||||||
{
|
|
||||||
switch_rtp_stats_t *stats = switch_core_media_get_stats(session, type, NULL);
|
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
|
||||||
|
|
||||||
char var_name[256] = "", var_val[35] = "";
|
|
||||||
|
|
||||||
if (stats) {
|
|
||||||
|
|
||||||
add_stat(stats->inbound.raw_bytes, "in_raw_bytes");
|
|
||||||
add_stat(stats->inbound.media_bytes, "in_media_bytes");
|
|
||||||
add_stat(stats->inbound.packet_count, "in_packet_count");
|
|
||||||
add_stat(stats->inbound.media_packet_count, "in_media_packet_count");
|
|
||||||
add_stat(stats->inbound.skip_packet_count, "in_skip_packet_count");
|
|
||||||
add_stat(stats->inbound.jb_packet_count, "in_jb_packet_count");
|
|
||||||
add_stat(stats->inbound.dtmf_packet_count, "in_dtmf_packet_count");
|
|
||||||
add_stat(stats->inbound.cng_packet_count, "in_cng_packet_count");
|
|
||||||
add_stat(stats->inbound.flush_packet_count, "in_flush_packet_count");
|
|
||||||
add_stat(stats->inbound.largest_jb_size, "in_largest_jb_size");
|
|
||||||
|
|
||||||
add_stat(stats->outbound.raw_bytes, "out_raw_bytes");
|
|
||||||
add_stat(stats->outbound.media_bytes, "out_media_bytes");
|
|
||||||
add_stat(stats->outbound.packet_count, "out_packet_count");
|
|
||||||
add_stat(stats->outbound.media_packet_count, "out_media_packet_count");
|
|
||||||
add_stat(stats->outbound.skip_packet_count, "out_skip_packet_count");
|
|
||||||
add_stat(stats->outbound.dtmf_packet_count, "out_dtmf_packet_count");
|
|
||||||
add_stat(stats->outbound.cng_packet_count, "out_cng_packet_count");
|
|
||||||
|
|
||||||
add_stat(stats->rtcp.packet_count, "rtcp_packet_count");
|
|
||||||
add_stat(stats->rtcp.octet_count, "rtcp_octet_count");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void sofia_glue_set_rtp_stats(private_object_t *tech_pvt)
|
|
||||||
{
|
|
||||||
set_stats(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, "audio");
|
|
||||||
set_stats(tech_pvt->session, SWITCH_MEDIA_TYPE_VIDEO, "video");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* map sip responses to QSIG cause codes ala RFC4497 section 8.4.4 */
|
/* map sip responses to QSIG cause codes ala RFC4497 section 8.4.4 */
|
||||||
switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status)
|
switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status)
|
||||||
{
|
{
|
||||||
|
|
|
@ -884,6 +884,58 @@ SWITCH_DECLARE(void) switch_core_session_check_outgoing_crypto(switch_core_sessi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define add_stat(_i, _s) \
|
||||||
|
switch_snprintf(var_name, sizeof(var_name), "rtp_%s_%s", switch_str_nil(prefix), _s) ; \
|
||||||
|
switch_snprintf(var_val, sizeof(var_val), "%" SWITCH_SIZE_T_FMT, _i); \
|
||||||
|
switch_channel_set_variable(channel, var_name, var_val)
|
||||||
|
|
||||||
|
static void set_stats(switch_core_session_t *session, switch_media_type_t type, const char *prefix)
|
||||||
|
{
|
||||||
|
switch_rtp_stats_t *stats = switch_core_media_get_stats(session, type, NULL);
|
||||||
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
|
||||||
|
char var_name[256] = "", var_val[35] = "";
|
||||||
|
|
||||||
|
if (stats) {
|
||||||
|
|
||||||
|
add_stat(stats->inbound.raw_bytes, "in_raw_bytes");
|
||||||
|
add_stat(stats->inbound.media_bytes, "in_media_bytes");
|
||||||
|
add_stat(stats->inbound.packet_count, "in_packet_count");
|
||||||
|
add_stat(stats->inbound.media_packet_count, "in_media_packet_count");
|
||||||
|
add_stat(stats->inbound.skip_packet_count, "in_skip_packet_count");
|
||||||
|
add_stat(stats->inbound.jb_packet_count, "in_jb_packet_count");
|
||||||
|
add_stat(stats->inbound.dtmf_packet_count, "in_dtmf_packet_count");
|
||||||
|
add_stat(stats->inbound.cng_packet_count, "in_cng_packet_count");
|
||||||
|
add_stat(stats->inbound.flush_packet_count, "in_flush_packet_count");
|
||||||
|
add_stat(stats->inbound.largest_jb_size, "in_largest_jb_size");
|
||||||
|
|
||||||
|
add_stat(stats->outbound.raw_bytes, "out_raw_bytes");
|
||||||
|
add_stat(stats->outbound.media_bytes, "out_media_bytes");
|
||||||
|
add_stat(stats->outbound.packet_count, "out_packet_count");
|
||||||
|
add_stat(stats->outbound.media_packet_count, "out_media_packet_count");
|
||||||
|
add_stat(stats->outbound.skip_packet_count, "out_skip_packet_count");
|
||||||
|
add_stat(stats->outbound.dtmf_packet_count, "out_dtmf_packet_count");
|
||||||
|
add_stat(stats->outbound.cng_packet_count, "out_cng_packet_count");
|
||||||
|
|
||||||
|
add_stat(stats->rtcp.packet_count, "rtcp_packet_count");
|
||||||
|
add_stat(stats->rtcp.octet_count, "rtcp_octet_count");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(void) switch_core_media_set_stats(switch_core_session_t *session)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!session->media_handle) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_stats(session, SWITCH_MEDIA_TYPE_AUDIO, "audio");
|
||||||
|
set_stats(session, SWITCH_MEDIA_TYPE_VIDEO, "video");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_media_handle_destroy(switch_core_session_t *session)
|
SWITCH_DECLARE(void) switch_media_handle_destroy(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
switch_media_handle_t *smh;
|
switch_media_handle_t *smh;
|
||||||
|
@ -894,7 +946,7 @@ SWITCH_DECLARE(void) switch_media_handle_destroy(switch_core_session_t *session)
|
||||||
if (!(smh = session->media_handle)) {
|
if (!(smh = session->media_handle)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
|
a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO];
|
||||||
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
|
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
|
||||||
|
|
||||||
|
@ -917,10 +969,10 @@ SWITCH_DECLARE(void) switch_media_handle_destroy(switch_core_session_t *session)
|
||||||
|
|
||||||
switch_core_session_unset_read_codec(session);
|
switch_core_session_unset_read_codec(session);
|
||||||
switch_core_session_unset_write_codec(session);
|
switch_core_session_unset_write_codec(session);
|
||||||
|
|
||||||
switch_core_media_deactivate_rtp(session);
|
switch_core_media_deactivate_rtp(session);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3442,10 +3494,6 @@ SWITCH_DECLARE(void) switch_core_media_deactivate_rtp(switch_core_session_t *ses
|
||||||
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
|
v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO];
|
||||||
|
|
||||||
|
|
||||||
if (switch_rtp_ready(a_engine->rtp_session)) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v_engine->rtp_session) {
|
if (v_engine->rtp_session) {
|
||||||
switch_rtp_destroy(&v_engine->rtp_session);
|
switch_rtp_destroy(&v_engine->rtp_session);
|
||||||
} else if (v_engine->codec_params.local_sdp_port) {
|
} else if (v_engine->codec_params.local_sdp_port) {
|
||||||
|
@ -6617,7 +6665,7 @@ SWITCH_DECLARE(switch_rtp_stats_t *) switch_core_media_get_stats(switch_core_ses
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_rtp_ready(smh->engines[type].rtp_session)) {
|
if (smh->engines[type].rtp_session) {
|
||||||
return switch_rtp_get_stats(smh->engines[type].rtp_session, pool);
|
return switch_rtp_get_stats(smh->engines[type].rtp_session, pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -675,6 +675,8 @@ SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *ses
|
||||||
|
|
||||||
STATE_MACRO(hangup, "HANGUP");
|
STATE_MACRO(hangup, "HANGUP");
|
||||||
|
|
||||||
|
switch_core_media_set_stats(session);
|
||||||
|
|
||||||
if ((hook_var = switch_channel_get_variable(session->channel, SWITCH_API_HANGUP_HOOK_VARIABLE))) {
|
if ((hook_var = switch_channel_get_variable(session->channel, SWITCH_API_HANGUP_HOOK_VARIABLE))) {
|
||||||
|
|
||||||
if (switch_true(switch_channel_get_variable(session->channel, SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE))) {
|
if (switch_true(switch_channel_get_variable(session->channel, SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE))) {
|
||||||
|
|
|
@ -5748,6 +5748,11 @@ SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_sess
|
||||||
{
|
{
|
||||||
switch_rtp_stats_t *s;
|
switch_rtp_stats_t *s;
|
||||||
|
|
||||||
|
if (!rtp_session) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_mutex_lock(rtp_session->flag_mutex);
|
||||||
if (pool) {
|
if (pool) {
|
||||||
s = switch_core_alloc(pool, sizeof(*s));
|
s = switch_core_alloc(pool, sizeof(*s));
|
||||||
*s = rtp_session->stats;
|
*s = rtp_session->stats;
|
||||||
|
@ -5758,6 +5763,7 @@ SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_sess
|
||||||
if (rtp_session->jb) {
|
if (rtp_session->jb) {
|
||||||
s->inbound.largest_jb_size = stfu_n_get_most_qlen(rtp_session->jb);
|
s->inbound.largest_jb_size = stfu_n_get_most_qlen(rtp_session->jb);
|
||||||
}
|
}
|
||||||
|
switch_mutex_unlock(rtp_session->flag_mutex);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue