allocate a token for new subscribers
diff --git a/openbsc/src/gsm_04_11.c b/openbsc/src/gsm_04_11.c
index 05e55d4..1dc68d0 100644
--- a/openbsc/src/gsm_04_11.c
+++ b/openbsc/src/gsm_04_11.c
@@ -954,6 +954,8 @@
 	struct gsm_lchan *lchan;
 	struct gsm_sms *sms;
 
+	u_int32_t token;
+
 	switch (signal) {
 	case S_SUBSCR_ATTACHED:
 		/* A subscriber has attached. Check if there are
@@ -968,6 +970,18 @@
 		/* Establish a SAPI3 RLL connection for SMS */
 		rll_establish(lchan, UM_SAPI_SMS, rll_ind_cb, sms);
 		break;
+	case S_SUBSCR_FIRST_CONTACT:
+		/* A new subscriber has just been created in the DB */
+		subscr = signal_data;
+		if (subscr->net->auth_policy == GSM_AUTH_POLICY_TOKEN) {
+			if (db_subscriber_alloc_token(subscr, &token)) {
+				/* error: probably use already has a token */
+				break;
+			} else {
+				/* FIXME: send sms with token here */
+			}
+		}
+		break;
 	default:
 		break;
 	}