bsc: Send a USSD command after we have a LU Accept and a new_subscriber

This commit is contained in:
Holger Hans Peter Freyther
2010-09-26 18:39:13 +08:00
parent 6f926f0197
commit 667cba9d28

View File

@@ -1,6 +1,6 @@
/* GSM 08.08 BSSMAP handling */ /* GSM 08.08 BSSMAP handling */
/* (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> /* (C) 2009-2010 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009 by On-Waves * (C) 2009-2010 by On-Waves
* All Rights Reserved * All Rights Reserved
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -28,6 +28,7 @@
#include <openbsc/signal.h> #include <openbsc/signal.h>
#include <openbsc/paging.h> #include <openbsc/paging.h>
#include <openbsc/chan_alloc.h> #include <openbsc/chan_alloc.h>
#include <openbsc/gsm_04_80.h>
#include <osmocore/gsm0808.h> #include <osmocore/gsm0808.h>
@@ -73,6 +74,19 @@ static int bssmap_paging_cb(unsigned int hooknum, unsigned int event, struct msg
return 0; return 0;
} }
/* Send a USSD message */
static void send_welcome_ussd(struct gsm_lchan *lchan)
{
struct gsm_network *network;
network = lchan->ts->trx->bts->network;
if (!network->ussd_welcome_txt)
return;
gsm0480_send_ussdNotify(lchan, 1, network->ussd_welcome_txt);
gsm0480_send_releaseComplete(lchan);
}
static int bssmap_handle_reset_ack(struct gsm_network *net, struct msgb *msg, unsigned int length) static int bssmap_handle_reset_ack(struct gsm_network *net, struct msgb *msg, unsigned int length)
{ {
LOGP(DMSC, LOGL_NOTICE, "Reset ACK from MSC\n"); LOGP(DMSC, LOGL_NOTICE, "Reset ACK from MSC\n");
@@ -663,6 +677,7 @@ int dtap_rcvmsg(struct gsm_lchan *lchan, struct msgb *msg, unsigned int length)
struct msgb *gsm48; struct msgb *gsm48;
u_int8_t *data; u_int8_t *data;
u_int8_t link_id; u_int8_t link_id;
int is_lu = 0;
if (!lchan) { if (!lchan) {
LOGP(DMSC, LOGL_ERROR, "No lchan available\n"); LOGP(DMSC, LOGL_ERROR, "No lchan available\n");
@@ -712,6 +727,7 @@ int dtap_rcvmsg(struct gsm_lchan *lchan, struct msgb *msg, unsigned int length)
gsm48_generate_lai(lai, net->country_code, gsm48_generate_lai(lai, net->country_code,
net->network_code, net->network_code,
gsm48->trx->bts->location_area_code); gsm48->trx->bts->location_area_code);
is_lu = 1;
} }
} }
} }
@@ -724,6 +740,11 @@ int dtap_rcvmsg(struct gsm_lchan *lchan, struct msgb *msg, unsigned int length)
link_id |= 0x40; link_id |= 0x40;
bts_queue_send(gsm48, link_id); bts_queue_send(gsm48, link_id);
/* Feature to send a welcome USSD for a new subscriber */
if (is_lu && lchan->msc_data->new_subscriber)
send_welcome_ussd(lchan);
return 0; return 0;
} }