osmo-msc/openbsc/src/libmsc
Pablo Neira Ayuso 93ffbd0029 libmsc: send RP-ACK to MS after ESME sends SMPP DELIVER-SM-RESP
Hold on with the GSM 04.11 RP-ACK/RP-ERROR that we send to the MS until
we get a confirmation from the ESME, via SMPP DELIVER-SM-RESP, that we
can route this sms somewhere we can reach indeed.

After this change, the conversation looks like this:

    MS    GSM 03.40      SMSC   SMPP 3.4   ESME
     |                    |                 |
     |   SMS-SUBMIT       |                 |
     |------------------->|                 |
     |                    |    DELIVER-SM   |
     |                    |---------------->|
     |                    |                 |
     |                    | DELIVER-SM-RESP |
     |                    |<----------------|
     |  GSM 04.11 RP-ACK  |                 |
     |<-------------------|                 |
     |                    |                 |

Before this patch, the RP-ACK was sent back straight forward to the MS,
no matter if the sms can be route by the ESME or not. Thus, the user
ends up getting a misleading "message delivered" in their phone screen,
when the message may just be unroutable by the ESME hence silently
dropped.

If we get no reply from the ESME, there is a hardcoded timer that will
expire to send back an RP-ERROR to the MS indicating that network is
out-of-order. Currently this timer is arbitrarily set to 5 seconds. I
found no specific good default value on the SMPP 3.4 specs, section 7.2,
where the response_timer is described. There must be a place that
describes a better default value for this. We could also expose this
timer through VTY for configurability reasons, to be done later.

Given all this needs to happen asyncronously, ie. block the SMSC, this
patch extends the gsm_sms structure with two new fields to annotate
useful information to send the RP-ACK/RP-ERROR back to the MS of origin.
These new fields are:

* the GSM 04.07 transaction id, to look up for the gsm_trans object.

* the GSM 04.11 message reference so the MS of origin can correlate this
  response to its original request.

Tested here using python-libsmpp script that replies with
DELIVER_SM_RESP and status code 0x0b (Invalid Destination). I can see
here on my motorola C155 that message cannot be delivered. I have tested
with the success status code in the SMPP DELIVER_SM_RESP too.

Change-Id: I0d5bd5693fed6d4f4bd2951711c7888712507bfd
2017-05-08 17:15:12 +02:00
..
Makefile.am sms_next_rp_msg_ref(): use direct pointer to next_rp_ref counter 2016-12-02 12:09:15 +00:00
auth.c Print subcriber when skipping auth 2017-01-23 11:56:44 +00:00
ctrl_commands.c ctrl: remove boilerplate code 2017-05-04 13:35:13 +00:00
db.c libmsc/update_db_revision_3(): free memleaking db result 2017-02-28 18:36:35 +00:00
gsm_04_08.c gsm_bts: add version and variant details 2017-04-10 06:58:43 +00:00
gsm_04_11.c libmsc: send RP-ACK to MS after ESME sends SMPP DELIVER-SM-RESP 2017-05-08 17:15:12 +02:00
gsm_04_80.c factor out gen of USSD notify and release complete to libosmocore 2016-12-02 12:09:15 +00:00
gsm_subscriber.c add struct bsc_subscr, separating libbsc from gsm_subscriber 2017-03-08 01:01:43 +01:00
meas_feed.c cosmetic: use osmo_strlcpy() everywhere 2017-01-23 11:59:01 +00:00
meas_feed.h Initial support for export + curses-visualization of measurements 2015-01-01 13:03:03 +01:00
mncc.c mncc.c: Convert mncc_names[] to 'struct value_string' 2015-12-12 21:43:16 +01:00
mncc_builtin.c mncc_builtin: Properly reject DTMF 2016-11-02 09:20:54 +00:00
mncc_sock.c mncc_sock: use osmo_sock_unix_init() from libosmocore 2016-07-23 19:21:17 +00:00
osmo_msc.c various comment / whitespace tweaks (libmsc, gprs, libcommon-cs) 2017-01-26 03:19:35 +01:00
rrlp.c mscsplit: directly access gsm_network backpointer from gsm_subscriber_connection 2016-09-26 02:25:46 +02:00
silent_call.c silent_call: remove unfinished fuzzer interface 2017-02-28 18:28:03 +00:00
smpp_openbsc.c libmsc: send RP-ACK to MS after ESME sends SMPP DELIVER-SM-RESP 2017-05-08 17:15:12 +02:00
smpp_smsc.c libmsc: send RP-ACK to MS after ESME sends SMPP DELIVER-SM-RESP 2017-05-08 17:15:12 +02:00
smpp_smsc.h libmsc: send RP-ACK to MS after ESME sends SMPP DELIVER-SM-RESP 2017-05-08 17:15:12 +02:00
smpp_utils.c smpp: Move the coding/mode detection into a utils file 2013-07-27 20:03:10 +02:00
smpp_vty.c Fix some typos in stdout output 2016-12-20 17:39:55 +01:00
sms_queue.c debug log for sms: fix/add 2016-09-18 23:40:06 +02:00
token_auth.c gsm48_tx_mm_auth_req(): support UMTS AUTN 2017-02-03 05:35:25 +01:00
transaction.c mscsplit: directly access gsm_network backpointer from gsm_subscriber_connection 2016-09-26 02:25:46 +02:00
ussd.c ussd: Add band-aid for interrogationSS 2016-11-18 19:04:37 +00:00
vty_interface_layer3.c LU counters: count completion and failure, not messages sent 2017-03-31 12:05:29 +00:00