On Tuesday 31 March 2009 04:30:09 Harald Welte wrote:
What's still missing is the code to actually deliver the SMS from the SQL
table to the destination phone. For this, we need to
* decouple paging from voice calls
yeah! I'm still trapped here and some how MIA. What do you think about this
kind of interface? I think the idea is originating from you to put the
requests into the gsm_subscriber struct?
From 5ad8f58c50c5002aac3321dad0c1f47ddfde65df Mon Sep 17 00:00:00 2001
From: Holger Freyther <ich(a)tamarin.(none)>
Date: Tue, 31 Mar 2009 04:35:19 +0200
Subject: [PATCH] Proposal for a "channel request" interface...
Reuqests for a subscriber a stored within the gsm_subscriber
datastructure and it will keep track how many channels are
allocated for this user and of which type to decide on policy...
e.g. attempt to submit SMS during a phone call and not doing
paging but a simple (immediate) assignment of the channel...
---
include/openbsc/gsm_subscriber.h | 6 ++++++
src/gsm_04_08.c | 3 +--
src/gsm_subscriber.c | 10 ++++++++++
tests/db/Makefile.am | 4 ++--
tests/db/db_test.c | 4 ++++
5 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/include/openbsc/gsm_subscriber.h
b/include/openbsc/gsm_subscriber.h
index e0c621b..6940fa7 100644
--- a/include/openbsc/gsm_subscriber.h
+++ b/include/openbsc/gsm_subscriber.h
@@ -23,6 +23,10 @@ struct gsm_subscriber {
/* for internal management */
int use_count;
struct llist_head entry;
+
+ /* pending requests */
+ struct gsm_bts *current_bts;
+ struct llist_head requests;
};
enum gsm_subscriber_field {
@@ -37,6 +41,8 @@ struct gsm_subscriber *subscr_get_by_tmsi(const char *tmsi);
struct gsm_subscriber *subscr_get_by_imsi(const char *imsi);
struct gsm_subscriber *subscr_get_by_extension(const char *ext);
int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts);
+void subscr_get_channel(struct gsm_subscriber *subscr, int type,
+ gsm_cbfn *cbfn, void *data);
/* internal */
struct gsm_subscriber *subscr_alloc(void);
diff --git a/src/gsm_04_08.c b/src/gsm_04_08.c
index deafe7b..e075391 100644
--- a/src/gsm_04_08.c
+++ b/src/gsm_04_08.c
@@ -40,7 +40,6 @@
#include <openbsc/gsm_04_08.h>
#include <openbsc/abis_rsl.h>
#include <openbsc/chan_alloc.h>
-#include <openbsc/paging.h>
#include <openbsc/signal.h>
#include <openbsc/trau_mux.h>
@@ -1096,7 +1095,7 @@ static int gsm48_cc_rx_setup(struct msgb *msg)
call->called_subscr = called_subscr;
/* start paging of the receiving end of the call */
- paging_request(msg->trx->bts, called_subscr, RSL_CHANNEED_TCH_F,
+ subscr_get_channel(called_subscr, RSL_CHANNEED_TCH_F,
setup_trig_pag_evt, call);
/* send a CALL PROCEEDING message to the MO */
diff --git a/src/gsm_subscriber.c b/src/gsm_subscriber.c
index d4dfea4..8f75414 100644
--- a/src/gsm_subscriber.c
+++ b/src/gsm_subscriber.c
@@ -44,6 +44,8 @@ struct gsm_subscriber *subscr_alloc(void)
llist_add_tail(&s->entry, &active_subscribers);
s->use_count = 1;
+ INIT_LLIST_HEAD(&s->requests);
+
return s;
}
@@ -92,6 +94,8 @@ struct gsm_subscriber *subscr_get_by_extension(const char
*ext)
int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts)
{
+ /* FIXME: Migrate pending requests from one BSC to another */
+ s->current_bts = bts;
return db_sync_subscriber(s);
}
@@ -107,3 +111,9 @@ struct gsm_subscriber *subscr_put(struct gsm_subscriber
*subscr)
subscr_free(subscr);
return NULL;
}
+
+void subscr_get_channel(struct gsm_subscriber *subscr, int type,
+ gsm_cbfn *cbfn, void *data)
+{
+ paging_request(subscr->current_bts, subscr, type, cbfn, data);
+}
diff --git a/tests/db/Makefile.am b/tests/db/Makefile.am
index 5c9c784..3d9722c 100644
--- a/tests/db/Makefile.am
+++ b/tests/db/Makefile.am
@@ -3,6 +3,6 @@ AM_CFLAGS=-Wall -ggdb3
noinst_PROGRAMS = db_test
-db_test_SOURCES = db_test.c $(top_srcdir)/src/db.c
$(top_srcdir)/src/gsm_subscriber.c
-db_test_LDADD = -ldl -ldbi
+db_test_SOURCES = db_test.c
+db_test_LDADD = $(top_builddir)/src/libbsc.a -ldl -ldbi
diff --git a/tests/db/db_test.c b/tests/db/db_test.c
index a6632b7..2ccf243 100644
--- a/tests/db/db_test.c
+++ b/tests/db/db_test.c
@@ -100,3 +100,7 @@ int main() {
return 0;
}
+
+/* stubs */
+void input_event(void) {}
+void nm_state_event(void) {}
--
1.6.0.4