From 99e273db00a09d68adce36709f84cf43e0efb5a7 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 30 Jul 2013 23:39:18 +0800 Subject: SMPP: convert a SMMA to a SMPP ALERT NOTIFICATION --- openbsc/src/libmsc/smpp_openbsc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'openbsc/src/libmsc/smpp_openbsc.c') diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c index eb1ac11b7..0bc85e5ec 100644 --- a/openbsc/src/libmsc/smpp_openbsc.c +++ b/openbsc/src/libmsc/smpp_openbsc.c @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include "smpp_smsc.h" @@ -250,6 +252,9 @@ static int smpp_sms_cb(unsigned int subsys, unsigned int signal, { struct sms_signal_data *sig_sms = signal_data; struct gsm_sms *sms = sig_sms->sms; + struct smsc *smsc = handler_data; + struct osmo_esme *esme; + struct gsm_subscriber *subscr; int rc = 0; if (!sms) @@ -283,6 +288,29 @@ static int smpp_sms_cb(unsigned int subsys, unsigned int signal, ESME_ROK, sms->smpp.msg_id); } break; + case S_SMS_SMMA: + if (!sig_sms->trans || !sig_sms->trans->subscr) { + /* SMMA without a subscriber? strange... */ + LOGP(DLSMS, LOGL_NOTICE, "SMMA without subscriber?\n"); + break; + } + + subscr = sig_sms->trans->subscr; + /* There's no real 1:1 match for SMMA in SMPP. However, + * an ALERT NOTIFICATION seems to be the most logical + * choice */ + llist_for_each_entry(esme, &smsc->esme_list, list) { + if (esme->acl && esme->acl->deliver_src_imsi) { + smpp_tx_alert(esme, TON_Subscriber_Number, + NPI_Land_Mobile_E212, + subscr->imsi, 0); + } else { + smpp_tx_alert(esme, TON_Network_Specific, + NPI_ISDN_E163_E164, + subscr->extension, 0); + } + } + break; } return rc; -- cgit v1.2.3