mgcp_trunk: pick trunk by number and type

The function mgcp_trunk_by_num() is used to directly pick a specific
trunk that is known by its id number (sometimes called "index").
Traditionally the virtual trunk will reside under id number 0 and all
consecutively created E1 trunks will be created under number 1 to 64.
This works fine, but puts a limitation on us should we ever introduce an
aditional trunk type (e.g. T1). Since the numbers must be unique
regardless of the trunk type one could not have an E1 trunk number 1 and
e.g. a T1 trunk number 1 at the same time. So we should pick the trunk
not only by its number, but also by its type to allow different trunk
types to carry the same number. The trunks will still be distinguishable
by its type along with the respective endpoint prefix.

Change-Id: I7af1e9ce601babd4a51e88201a98319e03945f83
Related: OS#2659
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index b0647f4..0e87c15 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -768,7 +768,7 @@
 	int rc;
 
 	cfg = mgcp_config_alloc();
-	trunk = mgcp_trunk_by_num(cfg, MGCP_VIRT_TRUNK_ID);
+	trunk = mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
 
 	trunk->vty_number_endpoints = 64;
         mgcp_trunk_alloc_endpts(trunk);
@@ -910,7 +910,7 @@
 	int rc;
 
 	cfg = mgcp_config_alloc();
-	trunk = mgcp_trunk_by_num(cfg, MGCP_VIRT_TRUNK_ID);
+	trunk = mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
 
 	trunk->vty_number_endpoints = 64;
         mgcp_trunk_alloc_endpts(trunk);
@@ -979,7 +979,7 @@
 	char conn_id[256];
 
 	cfg = mgcp_config_alloc();
-	trunk = mgcp_trunk_by_num(cfg, MGCP_VIRT_TRUNK_ID);
+	trunk = mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
 	cfg->rqnt_cb = rqnt_cb;
 
 	trunk->vty_number_endpoints = 64;
@@ -1393,7 +1393,7 @@
 	printf("Testing multiple payload types\n");
 
 	cfg = mgcp_config_alloc();
-	trunk = mgcp_trunk_by_num(cfg, MGCP_VIRT_TRUNK_ID);
+	trunk = mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
 	trunk->vty_number_endpoints = 64;
         mgcp_trunk_alloc_endpts(trunk);
 	cfg->policy_cb = mgcp_test_policy_cb;
@@ -1539,7 +1539,7 @@
 	printf("Testing no sequence flow on initial packet\n");
 
 	cfg = mgcp_config_alloc();
-	trunk = mgcp_trunk_by_num(cfg, MGCP_VIRT_TRUNK_ID);
+	trunk = mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
 	trunk->vty_number_endpoints = 64;
         mgcp_trunk_alloc_endpts(trunk);
 
@@ -1588,7 +1588,7 @@
 
 	printf("Testing no rtpmap name\n");
 	cfg = mgcp_config_alloc();
-	trunk = mgcp_trunk_by_num(cfg, MGCP_VIRT_TRUNK_ID);
+	trunk = mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
 
 	trunk->vty_number_endpoints = 64;
 	trunk->audio_send_name = 0;