* add database handling
* fix IMSI handling
diff --git a/src/chan_alloc.c b/src/chan_alloc.c
index 4ef5ff9..3ef8b4d 100644
--- a/src/chan_alloc.c
+++ b/src/chan_alloc.c
@@ -63,7 +63,25 @@
int i, j;
for (i = 0; i < bts->num_trx; i++) {
struct gsm_bts_trx *trx = &bts->trx[i];
- for (j = 0; j < 8; j++) {
+ int from, to;
+
+ /* the following constraints are pure policy,
+ * no requirement to put this restriction in place */
+ switch (pchan) {
+ case GSM_PCHAN_CCCH:
+ case GSM_PCHAN_CCCH_SDCCH4:
+ from = 0; to = 0;
+ break;
+ case GSM_PCHAN_SDCCH8_SACCH8C:
+ from = 1; to = 1;
+ break;
+ case GSM_PCHAN_TCH_F:
+ case GSM_PCHAN_TCH_H:
+ from = 2; to = 7;
+ break;
+ }
+
+ for (j = from; j <= to; j++) {
struct gsm_bts_trx_ts *ts = &trx->ts[j];
if (ts->pchan == GSM_PCHAN_NONE) {
ts->pchan = pchan;