Bug #2352


SMSC: implement proper logic for delivery of alert_notification messages

Added by pespin almost 7 years ago. Updated almost 7 years ago.

Target version:
Start date:
Due date:
% Done:


Spec Reference:


While writing osmo-gsm-tester smpp test to check use of Store&Forward mode, I run into the following scenario:

  1. Core network + BTS is turned on, no MS available yet
  2. An esme connects to the SMSC, and sends an SMS ("submit_sm" message with mode="Store&Forward") to an MS which is still not registered into the network.
  3. Power on the MS, it registers with the network
  4. The esme receives an "alert_notification" message stating the MS is now available (ms_availability_status=0).
  5. The MS receives the stored SMS

However, according to SMPP Protocol Reference v3.4 section 4.12:

This message is sent by the SMSC to the ESME, when the SMSC has detected that a particular
mobile subscriber has become available and a delivery pending flag had been set for that
subscriber from a previous data_sm operation.
It may be used for example to trigger a data content ‘Push’ to the subscriber from a WAP Proxy
Note: There is no alert_notification_resp PDU.

So, it states it should be sent if a data_sm was sent before, which is not the case, because a submit_sm was sent instead.

Looking at the code in smpp_openbsc.c, it seems we always send an alert_notification message no matter what:

static void alert_all_esme(struct smsc *smsc, struct gsm_subscriber *subscr,
               uint8_t smpp_avail_status)
    struct osmo_esme *esme;

    llist_for_each_entry(esme, &smsc->esme_list, list) {
        /* we currently send an alert notification to each ESME that is
         * connected, and do not require a (non-existant) delivery
         * pending flag to be set before,  FIXME: make this VTY
         * configurable */
        if (esme->acl && esme->acl->deliver_src_imsi) {
            smpp_tx_alert(esme, TON_Subscriber_Number,
                      subscr->imsi, smpp_avail_status);
        } else {
            smpp_tx_alert(esme, TON_Network_Specific,
                      subscr->extension, smpp_avail_status);

Here's a run log of osmo-gsm-tester with debug level enabled so you can see the steps more in detail:

INFO:smpplib.client:Connecting to
DEBUG:smpplib.client:Receiver mode
DEBUG:smpplib.client:Sending bind_transceiver PDU
DEBUG:smpplib.client:>>b'0000002900000009000000000000000165736d652d31303439300065736d652d707764000034000000' (41 bytes)
DEBUG:smpplib.client:Waiting for PDU...
DEBUG:smpplib.client:<<b'0000001180000009000000000000000100' (17 bytes)
DEBUG:smpplib.client:Read bind_transceiver_resp PDU
12:05:46.710448 tst                       esme-10490: Connected and bound successfully. Starting to listen
12:05:46.762695 run             osmo-nitb_10.42.42.2: Add subscriber {imsi='901700000009031', msisdn='10491'}
12:05:46.800237 bus Ctrl(host='', port=4249): DBG: Connecting
12:05:46.836646 bus Ctrl(host='', port=4249): DBG: Sending {data='SET 0 subscriber-modify-v1 901700000009031,10491,comp128v1,80A37E6FDEA931EAC92FFA
12:05:46.954376 bus            CTRL( DBG: Created subscriber {imsi='901700000009031', msisdn='10491'}
12:05:46.988493 bus Ctrl(host='', port=4249): DBG: Disconnecting
12:05:47.021899 tst sending sms, it will be stored...
12:05:47.258594 tst                       esme-10490: Sending SMS "message nr. 1, smpp send not-yet-registered message, from 10490, to 10491" to 10491
DEBUG:smpplib.client:Sending submit_sm PDU
64206e6f742d7965742d72656769737465726564206d6573736167652c2066726f6d2031303439302c20746f203130343931020400020001' (122 bytes)
12:05:47.295365 tst                       esme-10490: DBG: sent part with seq 2
12:05:47.329170 tst                       esme-10490: DBG: pdus_pending: [2]
DEBUG:smpplib.client:Waiting for PDU...
DEBUG:smpplib.client:<<b'000000278000000400000000000000026d73675f69645f6e6f745f696d706c656d656e74656400' (39 bytes)
DEBUG:smpplib.client:Read submit_sm_resp PDU
12:05:47.366718 tst                       esme-10490: DBG: message sent resp with seq 2 , pdus_pending: [2]
12:05:47.400230 tst MS registers and will receive the SMS...
12:05:47.655170 bus                        /sierra_1: DBG: Powered == False
12:05:47.689027 tst                        /sierra_1: DBG: Powering on
12:05:47.723362 bus                        /sierra_1: Setting Powered True
12:05:47.968111 bus                        /sierra_1: DBG: Powered == True
12:05:48.005419 bus                        /sierra_1: DBG: interface enabled: org.ofono.VoiceCallManager
12:05:48.040209 bus                        /sierra_1: Setting Online True
12:05:48.288543 bus                        /sierra_1: DBG: interface enabled: org.ofono.LocationReporting
12:05:48.325123 bus                        /sierra_1: DBG: interface enabled: org.ofono.SimManager
12:05:48.361229 bus                        /sierra_1: DBG: interface disabled: org.ofono.AllowedAccessPoints
12:05:48.415800 bus                        /sierra_1: DBG: Online == True
12:05:48.451117 bus                        /sierra_1: DBG: has_interface(org.ofono.NetworkRegistration, org.ofono.MessageManager) == False
12:05:49.498257 bus                        /sierra_1: DBG: interface enabled: org.ofono.AllowedAccessPoints
12:05:49.535102 bus                        /sierra_1: DBG: interface enabled: org.ofono.RadioSettings
12:05:49.572440 bus                        /sierra_1: DBG: interface enabled: org.ofono.SupplementaryServices
12:05:49.611563 bus                        /sierra_1: DBG: interface enabled: org.ofono.ConnectionManager
12:05:49.647493 bus                        /sierra_1: DBG: interface enabled: org.ofono.NetworkRegistration
12:05:49.684420 bus                        /sierra_1: DBG: Connecting 1 signals for org.ofono.NetworkRegistration
12:05:49.814244 bus                        /sierra_1: DBG: has_interface(org.ofono.NetworkRegistration, org.ofono.MessageManager) == True
12:05:49.854984 tst                        /sierra_1: DBG: status: searching
12:05:49.891531 tst                        /sierra_1: Connect to ('901', '70')
12:05:49.927902 tst                        /sierra_1: DBG: Scanning for operators...
12:05:49.969719 bus                        /sierra_1: DBG: interface enabled: org.ofono.MessageManager, org.ofono.PushNotification, org.ofono.SmartMessaging
12:05:50.007723 bus                        /sierra_1: DBG: Connecting 1 signals for org.ofono.MessageManager
12:05:50.070386 tst                        /sierra_1: DBG: status: searching
12:05:51.117206 tst                        /sierra_1: DBG: status: searching
12:05:52.161152 tst                        /sierra_1: DBG: status: searching
12:05:53.205005 tst                        /sierra_1: DBG: status: searching
12:05:54.248863 tst                        /sierra_1: DBG: status: searching
12:05:55.292786 tst                        /sierra_1: DBG: status: searching
12:05:56.336661 tst                        /sierra_1: DBG: status: searching
12:05:57.380507 tst                        /sierra_1: DBG: status: searching
12:05:58.424602 tst                        /sierra_1: DBG: status: searching
12:05:59.468626 tst                        /sierra_1: DBG: status: searching
12:06:00.512836 tst                        /sierra_1: DBG: status: searching
12:06:01.555367 tst                        /sierra_1: DBG: status: searching
12:06:02.598081 tst                        /sierra_1: DBG: status: searching
12:06:03.641006 tst                        /sierra_1: DBG: status: searching
12:06:04.688002 tst                        /sierra_1: DBG: scanned operators:  [('/sierra_1/operator/90170', {'MobileCountryCode': '901', 'Technologies': ['g
sm'], 'Status': 'available', 'Name': 'osmo-gsm-tester-nitb', 'MobileNetworkCode': '70'}), ('/sierra_1/operator/26201', {'MobileCountryCode': '262', 'Technolo
gies': ['gsm', 'umts', 'lte'], 'Status': 'forbidden', 'Name': 'TDG', 'MobileNetworkCode': '01'}), ('/sierra_1/operator/26203', {'MobileCountryCode': '262', '
Technologies': ['gsm', 'umts', 'lte'], 'Status': 'forbidden', 'Name': 'E-Plus', 'MobileNetworkCode': '03'}), ('/sierra_1/operator/27408', {'MobileCountryCode
': '274', 'Technologies': ['gsm'], 'Status': 'forbidden', 'Name': 'On-waves', 'MobileNetworkCode': '08'}), ('/sierra_1/operator/26202', {'MobileCountryCode':
 '262', 'Technologies': ['gsm', 'lte'], 'Status': 'forbidden', 'Name': 'Vodafone', 'MobileNetworkCode': '02'})]
12:06:04.727997 tst                        /sierra_1: Registering with operator /sierra_1/operator/90170 ('901', '70')
12:06:04.798789 tst                        /sierra_1: DBG: status: searching
12:06:05.838062 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> Status=unregistered
12:06:05.876761 tst                        /sierra_1: DBG: status: unregistered
12:06:06.920246 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> Technology=gsm
12:06:06.960115 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> Status=registered
12:06:07.001627 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> LocationAreaCode=23
12:06:07.037737 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> CellId=0
12:06:07.072503 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> Name=osmo-gsm-tester-nitb
12:06:07.106629 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> MobileCountryCode=901
12:06:07.141021 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> MobileNetworkCode=70
12:06:07.175419 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> Name=901-70
12:06:07.212345 tst                        /sierra_1: DBG: 'org.ofono.NetworkRegistration'.PropertyChanged() -> Strength=40
12:06:07.252070 tst                        /sierra_1: DBG: status: registered
12:06:07.288875 bus Ctrl(host='', port=4249): DBG: Connecting
12:06:07.325849 bus Ctrl(host='', port=4249): DBG: Sending {data='GET 0 subscriber-list-active-v1'}
12:06:07.367453 bus Ctrl(host='', port=4249): DBG: Disconnecting
12:06:07.401969 run             osmo-nitb_10.42.42.2: DBG: attached: GET_REPLY 0 subscriber-list-active-v1 901700000009031,10491
DEBUG:smpplib.client:Waiting for PDU...
DEBUG:smpplib.client:<<b'000000200000010200000000685834a703013130343931000000000422000100' (32 bytes)
DEBUG:smpplib.client:Read alert_notification PDU
12:06:07.439705 tst                       esme-10490: DBG: message received: {seq=1750611111}
12:06:07.475050 tst                       esme-10490: DBG: message received:  AlertNotification: {ms_availability_status='0'}
12:06:10.518569 tst                        /sierra_1: Incoming SMS: 'message nr. 1, smpp send not-yet-registered message, from 10490, to 10491'
12:06:10.553844 tst                        /sierra_1: DBG: {info={LocalSentTime='2017-07-06T12:06:07+0200', Sender='+10490', SentTime='2017-07-06T10:06:07+00
12:06:10.588117 tst                        /sierra_1: SMS received as expected: 'message nr. 1, smpp send not-yet-registered message, from 10490, to 10491'
12:06:10.622391 tst                        /sierra_1: DBG: {info={LocalSentTime='2017-07-06T12:06:07+0200', Sender='+10490', SentTime='2017-07-06T10:06:07+00

Actions #1

Updated by neels almost 7 years ago

What is a problem to be expected from this? Do we send too many alerts? Is this harmful?

Actions #2

Updated by laforge almost 7 years ago

  • Status changed from New to Rejected

we actually call this a "feature" and some users rely on it. It is an easy way to know about all location updates from an external process.


Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)