diff options
author | Harald Welte <laforge@gnumonks.org> | 2012-11-23 23:35:01 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2012-11-24 11:09:21 +0100 |
commit | c0de14da8f868de3a68b485ec382d8aa7dabbec9 (patch) | |
tree | 396eba9b382b7b3c88f3c1b3b6c52e472bfe647e /openbsc/src/libmsc/smpp_openbsc.c | |
parent | e07b6a77e51f19b45d3ca0a7b3b4014ffeb40859 (diff) |
SMPP: add small utility program 'smpp_mirror'
This program binds as ESME transceiver to a SMSC and simply mirrors back
all SMS that it receives.
Diffstat (limited to 'openbsc/src/libmsc/smpp_openbsc.c')
-rw-r--r-- | openbsc/src/libmsc/smpp_openbsc.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c index b3b8d3697..378cbf63e 100644 --- a/openbsc/src/libmsc/smpp_openbsc.c +++ b/openbsc/src/libmsc/smpp_openbsc.c @@ -118,9 +118,18 @@ static int submit_to_sms(struct gsm_sms **psms, struct gsm_network *net, sms = sms_alloc(); sms->source = SMS_SOURCE_SMPP; sms->smpp.sequence_nr = submit->sequence_number; + + /* fill in the destination address */ sms->receiver = dest; - strncpy(sms->dest_addr, dest->extension, sizeof(sms->dest_addr)-1); + sms->dst.ton = submit->dest_addr_ton; + sms->dst.npi = submit->dest_addr_npi; + strncpy(sms->dst.addr, dest->extension, sizeof(sms->dst.addr)-1); + + /* fill in the source address */ sms->sender = subscr_get_by_id(net, 1); + sms->src.ton = submit->source_addr_ton; + sms->src.npi = submit->source_addr_npi; + strncpy(sms->src.addr, (char *)submit->source_addr, sizeof(sms->src.addr)-1); if (submit->esm_class & 0x40) sms->ud_hdr_ind = 1; @@ -312,9 +321,9 @@ static int deliver_to_esme(struct osmo_esme *esme, struct gsm_sms *sms) sms->sender->extension); } - deliver.dest_addr_ton = sms->destination.ton; - deliver.dest_addr_npi = sms->destination.npi; - memcpy(deliver.destination_addr, sms->destination.addr, + deliver.dest_addr_ton = sms->dst.ton; + deliver.dest_addr_npi = sms->dst.npi; + memcpy(deliver.destination_addr, sms->dst.addr, sizeof(deliver.destination_addr)); deliver.esm_class = 1; /* datagram mode */ @@ -368,9 +377,9 @@ int smpp_try_deliver(struct gsm_sms *sms) struct osmo_smpp_addr dst; memset(&dst, 0, sizeof(dst)); - dst.ton = sms->destination.ton; - dst.npi = sms->destination.npi; - memcpy(dst.addr, sms->destination.addr, sizeof(dst.addr)); + dst.ton = sms->dst.ton; + dst.npi = sms->dst.npi; + memcpy(dst.addr, sms->dst.addr, sizeof(dst.addr)); esme = smpp_route(g_smsc, &dst); if (!esme) |