aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 9878a2c31..c1f438fa5 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -19064,17 +19064,24 @@ static int acf_channel_read(struct ast_channel *chan, const char *funcname, char
if (!strcasecmp(args.param, "rtpdest")) {
struct sockaddr_in sin;
+ struct ast_rtp *stream;
if (ast_strlen_zero(args.type))
args.type = "audio";
- if (!strcasecmp(args.type, "audio"))
- ast_rtp_get_peer(p->rtp, &sin);
- else if (!strcasecmp(args.type, "video"))
- ast_rtp_get_peer(p->vrtp, &sin);
- else if (!strcasecmp(args.type, "text"))
- ast_rtp_get_peer(p->trtp, &sin);
+ if (!strcasecmp(args.type, "audio")) {
+ stream = p->rtp;
+ } else if (!strcasecmp(args.type, "video")) {
+ stream = p->vrtp;
+ } else if (!strcasecmp(args.type, "text")) {
+ stream = p->trtp;
+ }
+
+ if (!stream) {
+ return -1;
+ }
+ ast_rtp_get_peer(stream, &sin);
snprintf(buf, buflen, "%s:%d", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
} else if (!strcasecmp(args.param, "rtpqos")) {
struct ast_rtp_quality qos;