From e1ec4c7047e7c152f31a7ba13a3db5dd5c0df682 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 23 Jan 2012 16:28:16 +0100 Subject: hw: The DSP resource was one based with the SNMP API, subtract it * Change the assigning dsp_resource to start with one and increase after usage and not before usage (so it becomes the next free port). * Subtract one from dsp_port after we have selected the path. In the longer run I should make dsp_resources zero based all the way. --- src/mgcp_hw.c | 4 ++-- src/mgcp_ss7.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mgcp_hw.c b/src/mgcp_hw.c index bcda02e..1fd4d92 100644 --- a/src/mgcp_hw.c +++ b/src/mgcp_hw.c @@ -75,11 +75,11 @@ int mgcp_hw_connect(int port, int trunk, int timeslot) _tx_port = tx_port_get(port); status = PTI_ConnectHSCM(PTI_HSCM_TRUNK + trunk, timeslot - 1, - PTI_HSCM_PTMC, _rx_port, 1, 0); + PTI_HSCM_PTMC, _rx_port - 1, 1, 0); if (status != 0) return -1; - status = PTI_ConnectHSCM(PTI_HSCM_PTMC, _tx_port, + status = PTI_ConnectHSCM(PTI_HSCM_PTMC, _tx_port - 1, PTI_HSCM_TRUNK + trunk, timeslot - 1, 1, 0); if (status != 0) return -1; diff --git a/src/mgcp_ss7.c b/src/mgcp_ss7.c index 345ea68..1b88e57 100644 --- a/src/mgcp_ss7.c +++ b/src/mgcp_ss7.c @@ -704,8 +704,8 @@ static int configure_trunk(struct mgcp_trunk_config *tcfg, int *dsp_resource) if (tcfg->endpoints[i].blocked) continue; - *dsp_resource += 1; tcfg->endpoints[i].hw_dsp_port = *dsp_resource; + *dsp_resource += 1; if (tcfg->cfg->configure_trunks) { int multiplex, timeslot, res; @@ -764,7 +764,7 @@ static struct mgcp_ss7 *mgcp_ss7_init(struct mgcp_config *cfg) } /* Now do the init of the trunks */ - dsp_resource = 0; + dsp_resource = 1; llist_for_each_entry(trunk, &cfg->vtrunks, entry) { if (configure_trunk(trunk, &dsp_resource) != 0) { talloc_free(conf); -- cgit v1.2.3