SMPP to HTTP (intercept?)

827 views
Skip to first unread message

Alex

unread,
Nov 19, 2015, 3:18:08 AM11/19/15
to Jasmin SMS Gateway
Hello,

I red that SMPP to HTTP is not possible in current Jasmin project. As a solution, I saw "interceptor" which can be linked to a script. This would allow me to handle incoming SMPP messages inside my platform (HTTP call or direct DB insert).
The main question I have is about DLR. Is there a DLR generator (best would be an HTTP DLR API)?

What I want: (my customers) -> SMPP (Jasmin) -> HTTP (my platform)
but this is not possible so I think of:   (my customers) -> SMPP (Jasmin) -> Interceptor (Jasmin) -> Python script -> HTTP(my platform)
This should work for SMS-MT sending but the question is about DLR.
I would like to have (my platform) -> HTTP(Jasmin) -> SMPP (my customers)  to return them DLRs.

Can it be done through current Jasmin?

PS:
- my current country carriers doesn't have SMPP, they use exotic APIs so I absolutely need to go inside my platform
- my customers (some of them) absolutely need SMPP to route traffic to my direct routes
- I'm only talking about MT, MO doesn't exist in my current country (on carrier API side)


Thanks!

zoufou

unread,
Nov 19, 2015, 7:03:34 AM11/19/15
to Jasmin SMS Gateway
The way you want to do it is possible, but some points to take care of:
  • Interception occurs before routing, so if you have multiple http upstreams, you'll need to implement a sort of routing logic inside your interceptor script,
  • Forwarding DLRs is simple, you'll need to inject message in RabbitMQ, Jasmin will take it in charge and push it through smpp to your client,
I think it's simpler you do the following:

Client --------> Jasmin ----------> SMPP Simulator (it can be another Jasmin instance, or even SMPPSim from Logica)
  1. Consume messages going to smpp simulator (through RabbitMQ) and push them through http, your script will be very simple,
  2. Get DLR from your platform and publish it to RabbitMQ

Alex

unread,
Nov 20, 2015, 10:45:36 AM11/20/15
to Jasmin SMS Gateway
Hi zoufou,

Thanks for your answer.

  • ok for interception, if I get user it's enough (routing is done inside my platform)
  • for the DLR part, is there some doc about DLR injection? I noticed that jasmin doc is very light so if you have some extra doc (with samples for ex), it would be a great help :)
Thanks!

Alex

zoufou

unread,
Nov 23, 2015, 4:41:13 AM11/23/15
to Jasmin SMS Gateway
This discussion will help you, it is an example of implementing logics on top of Jasmin's async messaging.

Bagher Fathi

unread,
Dec 6, 2015, 8:43:36 AM12/6/15
to Jasmin SMS Gateway
have you tried to implement through interceptor?

Alex

unread,
Dec 6, 2015, 9:49:46 AM12/6/15
to Jasmin SMS Gateway
well, i'm not familiar with python so I tried to find for some existing scripts ;)
also i'm worried about dlr injection since it seems a bit complex.
if you have some sample scripts i'm interested :)

Alex

unread,
Dec 8, 2015, 2:59:19 AM12/8/15
to Jasmin SMS Gateway
I tried interceptor to handle the first part of my SMPP to HTTP project.

However, interception is not working. I have the following information which should mean it works.

tail /var/log/jasmin/interceptor.log
2015-12-08 12:48:50 INFO     5372 Authenticated Avatar: iadmin
[other tests...]
2015-12-08 16:42:49 INFO     5372 Running with a submit_sm (from:ALEX, to:+81XXXXXXX).

jcli : mtinterceptor -l
#Order Type                 Script                                          Filter(s)                                                       
#0     DefaultInterceptor   <MTIS (pyCode=smpp_status = 0 ..)>    

I've configured it with "python2(..../interceptor.py)".

interceptor.py script :
routable.pdu.params['source_addr'] = 'ALEX'

(I tried several code, for example the one to set logger but none worked so I'm wondering if it is due to CentOS7 or if there is missing settings.)
I'm setting interceptor without filter, is it ok? I wish to intercept ALL MT traffic to my script (to call my URL).


Thank you!




zoufou

unread,
Dec 8, 2015, 3:51:26 AM12/8/15
to Jasmin SMS Gateway
Hi Alex, you can set the logging level to DEBUG in the interceptor and check what's happening.

Alex

unread,
Dec 8, 2015, 10:03:58 PM12/8/15
to Jasmin SMS Gateway
I set to DEBUG and got following log

2015-12-09 11:59:47 DEBUG    15383 Running [smpp_status = 0
]
2015-12-09 11:59:47 DEBUG    15383 ... with routable with pdu: PDU [command: submit_sm, sequence_number: None, command_status: ESME_ROK
service_type: None
source_addr_ton: EnumValue(<jasmin.vendor.enum.Enum object at 0x1b61b50>, 4, 'NATIONAL')
source_addr_npi: EnumValue(<jasmin.vendor.enum.Enum object at 0x1b61250>, 9, 'ISDN')
source_addr: 'TEST'
dest_addr_ton: EnumValue(<jasmin.vendor.enum.Enum object at 0x1b61b50>, 6, 'INTERNATIONAL')
dest_addr_npi: EnumValue(<jasmin.vendor.enum.Enum object at 0x1b61250>, 9, 'ISDN')
destination_addr: '8180XXXXXX'
esm_class: EsmClass[mode: STORE_AND_FORWARD, type: DEFAULT, gsmFeatures: set([])]
protocol_id: None
priority_flag: EnumValue(<jasmin.vendor.enum.Enum object at 0x1b61850>, 0, 'LEVEL_0')
schedule_delivery_time: None
validity_period: None
registered_delivery: RegisteredDelivery[receipt: NO_SMSC_DELIVERY_RECEIPT_REQUESTED, smeOriginatedAcks: set([]), intermediateNotification: False]
replace_if_present_flag: EnumValue(<jasmin.vendor.enum.Enum object at 0x1b61990>, 0, 'DO_NOT_REPLACE')
data_coding: 0
sm_default_msg_id: 0
short_message: 'hello'
]


Where can i see the script error? Or the fact the script has been called?

Thanks!


Alex

unread,
Dec 9, 2015, 3:23:33 AM12/9/15
to Jasmin SMS Gateway
The script works when I try in bash but doesn't seem to be called as there is neither log or error.

interceptor.py

"This is how logging is done inside interception script"

import logging

# Set logger
logger = logging.getLogger('logging-example')
if len(logger.handlers) != 1:
    hdlr = logging.FileHandler('/var/log/jasmin/some_file.log')
    formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
    hdlr.setFormatter(formatter)
    logger.addHandler(hdlr)
    logger.setLevel(logging.DEBUG)

logger.info('TEST')



Reply all
Reply to author
Forward
0 new messages