diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-03-01 14:38:47 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-03-01 16:07:19 +0100 |
commit | d384912f76a04beed8a2f63ec24b72506b13f833 (patch) | |
tree | 765dd51bbd79bc275421aa46a87d4cc17727a814 /src/mgcp_ss7.c | |
parent | 672f321eea60bb945b9f5c4a9bc754899baec44e (diff) |
mgcp: Calculate which dsp resource should be used by the trunks
Diffstat (limited to 'src/mgcp_ss7.c')
-rw-r--r-- | src/mgcp_ss7.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c index 7d6f209..2061943 100644 --- a/src/mgcp_ss7.c +++ b/src/mgcp_ss7.c @@ -663,6 +663,9 @@ static int realloc_cb(struct mgcp_trunk_config *tcfg, int endp_no) static struct mgcp_ss7 *mgcp_ss7_init(struct mgcp_config *cfg) { + struct mgcp_trunk_config *trunk; + int dsp_resource, i; + struct mgcp_ss7 *conf = talloc_zero(NULL, struct mgcp_ss7); if (!conf) return NULL; @@ -685,6 +688,28 @@ static struct mgcp_ss7 *mgcp_ss7_init(struct mgcp_config *cfg) } /* Now do the init of the trunks */ + dsp_resource = 0; + for (i = 1; i < cfg->trunk.number_endpoints; ++i) { + int multiplex, timeslot; + mgcp_endpoint_to_timeslot(i, &multiplex, ×lot); + if (timeslot == 0x0 || timeslot == 0x1F) + continue; + + dsp_resource += 1; + } + + llist_for_each_entry(trunk, &cfg->trunks, entry) { + trunk->voice_base = dsp_resource; + + for (i = 1; i < trunk->number_endpoints; ++i) { + int multiplex, timeslot; + mgcp_endpoint_to_timeslot(i, &multiplex, ×lot); + if (timeslot == 0x0 || timeslot == 0x1F) + continue; + + dsp_resource += 1; + } + } conf->cmd_queue = thread_notifier_alloc(); if (!conf->cmd_queue) { |