|
|
@ -14127,11 +14127,16 @@ static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int acf_audiortpqos_read(struct ast_channel *chan, char *funcname, char *args, char *buf, size_t buflen)
|
|
|
|
static int acf_rtpqos_read(struct ast_channel *chan, char *funcname, char *preparse, char *buf, size_t buflen)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct ast_rtp_quality qos;
|
|
|
|
struct ast_rtp_quality qos;
|
|
|
|
struct sip_pvt *p = chan->tech_pvt;
|
|
|
|
struct sip_pvt *p = chan->tech_pvt;
|
|
|
|
char *all = "";
|
|
|
|
char *all = "", *parse = ast_strdupa(preparse);
|
|
|
|
|
|
|
|
AST_DECLARE_APP_ARGS(args,
|
|
|
|
|
|
|
|
AST_APP_ARG(type);
|
|
|
|
|
|
|
|
AST_APP_ARG(field);
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
AST_STANDARD_APP_ARGS(args, parse);
|
|
|
|
|
|
|
|
|
|
|
|
/* Sanity check */
|
|
|
|
/* Sanity check */
|
|
|
|
if (chan->tech != &sip_tech && chan->tech != &sip_tech_info) {
|
|
|
|
if (chan->tech != &sip_tech && chan->tech != &sip_tech_info) {
|
|
|
@ -14141,34 +14146,34 @@ static int acf_audiortpqos_read(struct ast_channel *chan, char *funcname, char *
|
|
|
|
memset(buf, 0, buflen);
|
|
|
|
memset(buf, 0, buflen);
|
|
|
|
memset(&qos, 0, sizeof(qos));
|
|
|
|
memset(&qos, 0, sizeof(qos));
|
|
|
|
|
|
|
|
|
|
|
|
if (strcmp(funcname, "RTPAUDIOQOS") == 0) {
|
|
|
|
if (strcasecmp(args.type, "AUDIO") == 0) {
|
|
|
|
all = ast_rtp_get_quality(p->rtp, &qos);
|
|
|
|
all = ast_rtp_get_quality(p->rtp, &qos);
|
|
|
|
} else if (strcmp(funcname, "RTPVIDEOQOS") == 0) {
|
|
|
|
} else if (strcmp(args.type, "VIDEO") == 0) {
|
|
|
|
all = ast_rtp_get_quality(p->vrtp, &qos);
|
|
|
|
all = ast_rtp_get_quality(p->vrtp, &qos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (strcasecmp(args, "local_ssrc") == 0)
|
|
|
|
if (strcasecmp(args.field, "local_ssrc") == 0)
|
|
|
|
snprintf(buf, buflen, "%u", qos.local_ssrc);
|
|
|
|
snprintf(buf, buflen, "%u", qos.local_ssrc);
|
|
|
|
else if (strcasecmp(args, "local_lostpackets") == 0)
|
|
|
|
else if (strcasecmp(args.field, "local_lostpackets") == 0)
|
|
|
|
snprintf(buf, buflen, "%u", qos.local_lostpackets);
|
|
|
|
snprintf(buf, buflen, "%u", qos.local_lostpackets);
|
|
|
|
else if (strcasecmp(args, "local_jitter") == 0)
|
|
|
|
else if (strcasecmp(args.field, "local_jitter") == 0)
|
|
|
|
snprintf(buf, buflen, "%.0lf", qos.local_jitter * 1000.0);
|
|
|
|
snprintf(buf, buflen, "%.0lf", qos.local_jitter * 1000.0);
|
|
|
|
else if (strcasecmp(args, "local_count") == 0)
|
|
|
|
else if (strcasecmp(args.field, "local_count") == 0)
|
|
|
|
snprintf(buf, buflen, "%u", qos.local_count);
|
|
|
|
snprintf(buf, buflen, "%u", qos.local_count);
|
|
|
|
else if (strcasecmp(args, "remote_ssrc") == 0)
|
|
|
|
else if (strcasecmp(args.field, "remote_ssrc") == 0)
|
|
|
|
snprintf(buf, buflen, "%u", qos.remote_ssrc);
|
|
|
|
snprintf(buf, buflen, "%u", qos.remote_ssrc);
|
|
|
|
else if (strcasecmp(args, "remote_lostpackets") == 0)
|
|
|
|
else if (strcasecmp(args.field, "remote_lostpackets") == 0)
|
|
|
|
snprintf(buf, buflen, "%u", qos.remote_lostpackets);
|
|
|
|
snprintf(buf, buflen, "%u", qos.remote_lostpackets);
|
|
|
|
else if (strcasecmp(args, "remote_jitter") == 0)
|
|
|
|
else if (strcasecmp(args.field, "remote_jitter") == 0)
|
|
|
|
snprintf(buf, buflen, "%.0lf", qos.remote_jitter * 1000.0);
|
|
|
|
snprintf(buf, buflen, "%.0lf", qos.remote_jitter * 1000.0);
|
|
|
|
else if (strcasecmp(args, "remote_count") == 0)
|
|
|
|
else if (strcasecmp(args.field, "remote_count") == 0)
|
|
|
|
snprintf(buf, buflen, "%u", qos.remote_count);
|
|
|
|
snprintf(buf, buflen, "%u", qos.remote_count);
|
|
|
|
else if (strcasecmp(args, "rtt") == 0)
|
|
|
|
else if (strcasecmp(args.field, "rtt") == 0)
|
|
|
|
snprintf(buf, buflen, "%.0lf", qos.rtt * 1000.0);
|
|
|
|
snprintf(buf, buflen, "%.0lf", qos.rtt * 1000.0);
|
|
|
|
else if (strcasecmp(args, "all") == 0)
|
|
|
|
else if (strcasecmp(args.field, "all") == 0)
|
|
|
|
ast_copy_string(buf, all, buflen);
|
|
|
|
ast_copy_string(buf, all, buflen);
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
ast_log(LOG_WARNING, "Unrecognized argument '%s' to %s\n", args, funcname);
|
|
|
|
ast_log(LOG_WARNING, "Unrecognized argument '%s' to %s\n", preparse, funcname);
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
@ -17368,28 +17373,9 @@ static struct ast_cli_entry cli_sip[] = {
|
|
|
|
sip_reload_usage },
|
|
|
|
sip_reload_usage },
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct ast_custom_function acf_audiortpqos = {
|
|
|
|
struct ast_custom_function acf_rtpqos = {
|
|
|
|
.name = "RTPAUDIOQOS",
|
|
|
|
.name = "RTPQOS",
|
|
|
|
.synopsis = "Retrieve statistics about an RTP audio stream",
|
|
|
|
.synopsis = "Retrieve statistics about an RTP stream",
|
|
|
|
.desc =
|
|
|
|
|
|
|
|
"The following statistics may be retrieved:\n"
|
|
|
|
|
|
|
|
" local_ssrc - Local SSRC (stream ID)\n"
|
|
|
|
|
|
|
|
" local_lostpackets - Local lost packets\n"
|
|
|
|
|
|
|
|
" local_jitter - Local calculated jitter\n"
|
|
|
|
|
|
|
|
" local_count - Number of received packets\n"
|
|
|
|
|
|
|
|
" remote_ssrc - Remote SSRC (stream ID)\n"
|
|
|
|
|
|
|
|
" remote_lostpackets - Remote lost packets\n"
|
|
|
|
|
|
|
|
" remote_jitter - Remote reported jitter\n"
|
|
|
|
|
|
|
|
" remote_count - Number of transmitted packets\n"
|
|
|
|
|
|
|
|
" rtt - Round trip time\n"
|
|
|
|
|
|
|
|
" all - All statistics (in a form suited to logging, but not for parsing)",
|
|
|
|
|
|
|
|
.syntax = "RTPAUDIOQOS(<field>)",
|
|
|
|
|
|
|
|
.read = acf_audiortpqos_read,
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct ast_custom_function acf_videortpqos = {
|
|
|
|
|
|
|
|
.name = "RTPVIDEOQOS",
|
|
|
|
|
|
|
|
.synopsis = "Retrieve statistics about an RTP video stream",
|
|
|
|
|
|
|
|
.desc =
|
|
|
|
.desc =
|
|
|
|
"The following statistics may be retrieved:\n"
|
|
|
|
"The following statistics may be retrieved:\n"
|
|
|
|
" local_ssrc - Local SSRC (stream ID)\n"
|
|
|
|
" local_ssrc - Local SSRC (stream ID)\n"
|
|
|
@ -17401,9 +17387,11 @@ struct ast_custom_function acf_videortpqos = {
|
|
|
|
" remote_jitter - Remote reported jitter\n"
|
|
|
|
" remote_jitter - Remote reported jitter\n"
|
|
|
|
" remote_count - Number of transmitted packets\n"
|
|
|
|
" remote_count - Number of transmitted packets\n"
|
|
|
|
" rtt - Round trip time\n"
|
|
|
|
" rtt - Round trip time\n"
|
|
|
|
" all - All statistics (in a form suited to logging, but not for parsing)",
|
|
|
|
" all - All statistics (in a form suited to logging, but not for parsing)\n"
|
|
|
|
.syntax = "RTPVIDEOQOS(<field>)",
|
|
|
|
"\n"
|
|
|
|
.read = acf_audiortpqos_read,
|
|
|
|
"Type may be specified as \"audio\" or \"video\".\n",
|
|
|
|
|
|
|
|
.syntax = "RTPQOS(<type>|<field>)",
|
|
|
|
|
|
|
|
.read = acf_rtpqos_read,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*! \brief PBX load module - initialization */
|
|
|
|
/*! \brief PBX load module - initialization */
|
|
|
@ -17455,8 +17443,7 @@ static int load_module(void)
|
|
|
|
ast_custom_function_register(&sippeer_function);
|
|
|
|
ast_custom_function_register(&sippeer_function);
|
|
|
|
ast_custom_function_register(&sipchaninfo_function);
|
|
|
|
ast_custom_function_register(&sipchaninfo_function);
|
|
|
|
ast_custom_function_register(&checksipdomain_function);
|
|
|
|
ast_custom_function_register(&checksipdomain_function);
|
|
|
|
ast_custom_function_register(&acf_audiortpqos);
|
|
|
|
ast_custom_function_register(&acf_rtpqos);
|
|
|
|
ast_custom_function_register(&acf_videortpqos);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Register manager commands */
|
|
|
|
/* Register manager commands */
|
|
|
|
ast_manager_register2("SIPpeers", EVENT_FLAG_SYSTEM, manager_sip_show_peers,
|
|
|
|
ast_manager_register2("SIPpeers", EVENT_FLAG_SYSTEM, manager_sip_show_peers,
|
|
|
@ -17486,8 +17473,7 @@ static int unload_module(void)
|
|
|
|
ast_custom_function_unregister(&sippeer_function);
|
|
|
|
ast_custom_function_unregister(&sippeer_function);
|
|
|
|
ast_custom_function_unregister(&sip_header_function);
|
|
|
|
ast_custom_function_unregister(&sip_header_function);
|
|
|
|
ast_custom_function_unregister(&checksipdomain_function);
|
|
|
|
ast_custom_function_unregister(&checksipdomain_function);
|
|
|
|
ast_custom_function_unregister(&acf_audiortpqos);
|
|
|
|
ast_custom_function_unregister(&acf_rtpqos);
|
|
|
|
ast_custom_function_unregister(&acf_videortpqos);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Unregister dial plan applications */
|
|
|
|
/* Unregister dial plan applications */
|
|
|
|
ast_unregister_application(app_dtmfmode);
|
|
|
|
ast_unregister_application(app_dtmfmode);
|
|
|
|