From 8bb264841a87766064074048fa875be849597502 Mon Sep 17 00:00:00 2001
From: Joshua Colp <jcolp@digium.com>
Date: Mon, 24 Sep 2018 17:43:17 +0000
Subject: [PATCH] res_rtp_asterisk: Raise event when RTP port is allocated

This change raises a testsuite event to provide what port
Asterisk has actually allocated for RTP. This ensures that
testsuite tests can remove any assumption of ports and instead
use the actual port in use.

ASTERISK-28070

Change-Id: I91bd45782e84284e01c89acf4b2da352e14ae044
---
 res/res_rtp_asterisk.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 192840ca38..69151868f1 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -3492,6 +3492,7 @@ static int rtp_allocate_transport(struct ast_rtp_instance *instance, struct ast_
 		if (!ast_bind(rtp->s, &rtp->bind_address)) {
 			ast_debug(1, "Allocated port %d for RTP instance '%p'\n", x, instance);
 			ast_rtp_instance_set_local_address(instance, &rtp->bind_address);
+			ast_test_suite_event_notify("RTP_PORT_ALLOCATED", "Port: %d", x);
 			break;
 		}
 
-- 
GitLab