aboutsummaryrefslogtreecommitdiffstats
path: root/src/mgcp_ss7.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-03-01 13:52:57 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-03-01 13:52:57 +0100
commit672f321eea60bb945b9f5c4a9bc754899baec44e (patch)
treecc5c7a4be9c13efc7b9921f495ded881c68c02af /src/mgcp_ss7.c
parentdcc33127922112211088b4e105c63304678969d6 (diff)
mgcp: Calculate the right Audio Processor resource for high endpoints
With this commit we can have more than 30 endpoints that will work. We ignore the blocked endpoints 0x1 and 0x1f for each trunk and calculate everything from the right start point.
Diffstat (limited to 'src/mgcp_ss7.c')
-rw-r--r--src/mgcp_ss7.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c
index 11c1b63..7d6f209 100644
--- a/src/mgcp_ss7.c
+++ b/src/mgcp_ss7.c
@@ -68,6 +68,25 @@ static void mgcp_ss7_do_exec(struct mgcp_ss7 *mgcp, uint8_t type, struct mgcp_en
/* Contains a mapping from UniPorte to the MGCP side of things */
static struct mgcp_endpoint *s_endpoints[240];
+static int select_voice_port(struct mgcp_endpoint *endp)
+{
+ int mgw_port;
+ int timeslot, multiplex;
+
+ mgcp_endpoint_to_timeslot(ENDPOINT_NUMBER(endp), &multiplex, &timeslot);
+ if (timeslot == 0x0 || timeslot == 0x1F) {
+ LOGP(DMGCP, LOGL_ERROR, "0x0 and 0x1F are reserved for signalling.\n");
+ return -1;
+ }
+
+ mgw_port = endp->tcfg->voice_base + 30 * multiplex;
+
+ mgw_port = mgw_port + timeslot - endp->tcfg->endp_offset;
+ fprintf(stderr, "TEST: Going to use MGW: %d for MUL: %d TS: %d\n",
+ mgw_port, multiplex, timeslot);
+ return mgw_port;
+}
+
static void check_exit(int status)
{
if (exit_on_failure && status == 21) {
@@ -326,13 +345,13 @@ static void update_mute_status(int mgw_port, int conn_mode)
static void allocate_endp(struct mgcp_ss7 *ss7, struct mgcp_endpoint *endp)
{
- int mgw_port, timeslot, multiplex;
+ int mgw_port;
unsigned long mgw_address, loc_address;
- mgcp_endpoint_to_timeslot(ENDPOINT_NUMBER(endp), &multiplex, &timeslot);
- mgw_port = timeslot - endp->tcfg->endp_offset;
- fprintf(stderr, "TEST: Going to use MGW: %d for MUL: %d TS: %d\n",
- mgw_port, multiplex, timeslot);
+ /* now find the voice processor we want to use */
+ mgw_port = select_voice_port(endp);
+ if (mgw_port < 0)
+ return;
endp->audio_port = MtnSaAllocate(mgw_port);
if (endp->audio_port == UINT_MAX) {