generalize function for calculation of the paging group
diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c
index 371a7a6..55d1a85 100644
--- a/openbsc/src/libbsc/paging.c
+++ b/openbsc/src/libbsc/paging.c
@@ -54,19 +54,20 @@
 
 #define PAGING_TIMER 0, 500000
 
-static unsigned int calculate_group(struct gsm_bts *bts, struct gsm_subscriber *subscr)
+static unsigned int
+gsm0502_calc_paging_group(struct gsm48_control_channel_descr *chan_desc, uint64_t imsi)
 {
 	int ccch_conf;
 	int bs_cc_chans;
 	int blocks;
 	unsigned int group;
 	
-	ccch_conf = bts->si_common.chan_desc.ccch_conf;
+	ccch_conf = chan_desc->ccch_conf;
 	bs_cc_chans = rsl_ccch_conf_to_bs_cc_chans(ccch_conf);
 	/* code word + 2, as 2 channels equals 0x0 */
-	blocks = gsm48_number_of_paging_subchannels(&bts->si_common.chan_desc);
-	group = gsm0502_get_paging_group(str_to_imsi(subscr->imsi),
-					 bs_cc_chans, blocks);
+	blocks = gsm48_number_of_paging_subchannels(chan_desc);
+	group = gsm0502_get_paging_group(imsi, bs_cc_chans, blocks);
+
 	return group;
 }
 
@@ -87,6 +88,7 @@
 	uint8_t mi[128];
 	unsigned int mi_len;
 	unsigned int page_group;
+	struct gsm_bts *bts = request->bts;
 
 	LOGP(DPAG, LOGL_INFO, "Going to send paging commands: imsi: '%s' tmsi: '0x%x'\n",
 		request->subscr->imsi, request->subscr->tmsi);
@@ -96,8 +98,9 @@
 	else
 		mi_len = gsm48_generate_mid_from_tmsi(mi, request->subscr->tmsi);
 
-	page_group = calculate_group(request->bts, request->subscr);
-	gsm0808_page(request->bts, page_group, mi_len, mi, request->chan_type);
+	page_group = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
+						str_to_imsi(request->subscr->imsi));
+	gsm0808_page(bts, page_group, mi_len, mi, request->chan_type);
 }
 
 static void paging_schedule_if_needed(struct gsm_bts_paging_state *paging_bts)