Skip to content

Commit

Permalink
Merge pull request #901 from jookies/0.10
Browse files Browse the repository at this point in the history
0.10.2
  • Loading branch information
farirat committed Oct 11, 2020
2 parents ec0a1ea + 0afc102 commit 3acbea2
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python:
- '3.8'
# - '3.9'
env:
- ROOT_PATH=~/jasmin JASMIN_RELEASE=0.10.1
- ROOT_PATH=~/jasmin JASMIN_RELEASE=0.10.2
# Command to install dependencies
install:
- pip install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion jasmin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

MAJOR = 0
MINOR = 10
PATCH = 1
PATCH = 2
META = ''


Expand Down
1 change: 1 addition & 0 deletions jasmin/bin/dlrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def sighandler_stop(self, signum, frame):
dlr_d = DlrDaemon(options)
# Setup signal handlers
signal.signal(signal.SIGINT, dlr_d.sighandler_stop)
signal.signal(signal.SIGTERM, dlr_d.sighandler_stop)
# Start DlrDaemon
dlr_d.start()

Expand Down
1 change: 1 addition & 0 deletions jasmin/bin/dlrlookupd.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def sighandler_stop(self, signum, frame):
ja_d = DlrlookupDaemon(options)
# Setup signal handlers
signal.signal(signal.SIGINT, ja_d.sighandler_stop)
signal.signal(signal.SIGTERM, ja_d.sighandler_stop)
# Start DlrlookupDaemon
ja_d.start()

Expand Down
1 change: 1 addition & 0 deletions jasmin/bin/interceptord.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def sighandler_stop(self, signum, frame):
in_d = InterceptorDaemon(options)
# Setup signal handlers
signal.signal(signal.SIGINT, in_d.sighandler_stop)
signal.signal(signal.SIGTERM, in_d.sighandler_stop)
# Start InterceptorDaemon
in_d.start()

Expand Down
1 change: 1 addition & 0 deletions jasmin/bin/jasmind.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ def sighandler_stop(self, signum, frame):
ja_d = JasminDaemon(options)
# Setup signal handlers
signal.signal(signal.SIGINT, ja_d.sighandler_stop)
signal.signal(signal.SIGTERM, ja_d.sighandler_stop)
# Start JasminDaemon
ja_d.start()

Expand Down
2 changes: 1 addition & 1 deletion jasmin/managers/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, config_file=None):
'sm-listener', 'submit_max_age_smppc_not_ready', 1200)

self.submit_retrial_delay_smppc_not_ready = self._getint(
'sm-listener', 'submit_retrial_delay_smppc_not_ready', False)
'sm-listener', 'submit_retrial_delay_smppc_not_ready', 30)

self.dlr_lookup_retry_delay = self._getint(
'sm-listener', 'dlr_lookup_retry_delay', 10)
Expand Down
12 changes: 7 additions & 5 deletions jasmin/managers/dlr.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,10 @@ def deliver_sm_dlr_callback(self, message):
raise DLRMapNotFound('Got a DLR for an unknown message id: %s (coded:%s)' % (pdu_dlr_id, msgid))
if len(dlr) > 0 and dlr['sc'] != connector_type:
raise DLRMapError('Found a dlr for msgid:%s with diffrent sc: %s' % (submit_sm_queue_id, dlr['sc']))


success_states = ['ACCEPTD', 'DELIVRD']
final_states = ['DELIVRD', 'EXPIRED', 'DELETED', 'UNDELIV', 'REJECTD']

if connector_type == 'httpapi':
self.log.debug('There is a HTTP DLR request for msgid[%s] ...', msgid)
dlr_url = dlr['url']
Expand Down Expand Up @@ -358,8 +361,9 @@ def deliver_sm_dlr_callback(self, message):
text=pdu_dlr_text,
method=dlr_method))

self.log.debug('Removing HTTP dlr map for msgid[%s]', submit_sm_queue_id)
yield self.redisClient.delete('dlr:%s' % submit_sm_queue_id)
if pdu_dlr_status in final_states:
self.log.debug('Removing HTTP dlr map for msgid[%s]', submit_sm_queue_id)
yield self.redisClient.delete('dlr:%s' % submit_sm_queue_id)
elif connector_type == 'smppsapi':
self.log.debug('There is a SMPPs mapping for msgid[%s] ...', msgid)
system_id = dlr['system_id']
Expand All @@ -378,8 +382,6 @@ def deliver_sm_dlr_callback(self, message):
if isinstance(destination_addr, int):
destination_addr = str(destination_addr)

success_states = ['ACCEPTD', 'DELIVRD']
final_states = ['DELIVRD', 'EXPIRED', 'DELETED', 'UNDELIV', 'REJECTD']
# Do we need to forward the receipt to the original sender ?
if ((pdu_dlr_status in success_states and
registered_delivery_receipt == RegisteredDeliveryReceipt.SMSC_DELIVERY_RECEIPT_REQUESTED) or
Expand Down
1 change: 0 additions & 1 deletion jasmin/managers/listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import pickle
import sys
import logging
import struct
from datetime import datetime, timedelta
from logging.handlers import TimedRotatingFileHandler

Expand Down
3 changes: 1 addition & 2 deletions misc/config/jasmin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,9 @@
#submit_max_age_smppc_not_ready = 1200

# Delay (seconds) when retrying a submit with a not-yet ready SMPPc
# Default is None: no delay when retrying
# Hint: for large scale messaging deployment, it is advised to set this value to few seconds
# in order to keep Jasmin free.
#submit_retrial_delay_smppc_not_ready = None
#submit_retrial_delay_smppc_not_ready = 30

# Specify the server verbosity level.
# This can be one of:
Expand Down
2 changes: 1 addition & 1 deletion misc/doc/sources/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# The short X.Y version.
version = "0.10"
# The full version, including alpha/beta/rc tags.
release = "0.10.1"
release = "0.10.2"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
6 changes: 3 additions & 3 deletions misc/doc/sources/interception/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ a MO message (deliver_sm) interception rule through :doc:`jcli management consol
> type DefaultInterceptor
<class 'jasmin.routing.Interceptors.DefaultInterceptor'> arguments:
script
> script python2(/opt/jasmin-scripts/interception/mo-interceptor.py)
> script python3(/opt/jasmin-scripts/interception/mo-interceptor.py)
> ok
Successfully added MOInterceptor [DefaultInterceptor] with order:0

Expand All @@ -67,14 +67,14 @@ filtered rule instead of a default one::
> type StaticMTInterceptor
<class 'jasmin.routing.Interceptors.DefaultInterceptor'> arguments:
filters, script
> script python2(/opt/jasmin-scripts/interception/mt-interceptor.py)
> script python3(/opt/jasmin-scripts/interception/mt-interceptor.py)
> filters U-foo;DA-33
> order 100
> ok
Successfully added MTInterceptor [StaticMTInterceptor] with order:100

As show in the above examples, the interception rules are straightforward, any matched message will be handed to
the script you set through the **script python2(<path_to_pyfile>)** instruction.
the script you set through the **script python3(<path_to_pyfile>)** instruction.

When your python script is called it will get the following global variables set:

Expand Down
12 changes: 6 additions & 6 deletions misc/doc/sources/management/jcli/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,11 @@ Here's an example of adding a **DefaultInterceptor** to a python script::
> type DefaultInterceptor
<class 'jasmin.routing.Interceptors.DefaultInterceptor'> arguments:
script
> script python2(/opt/jasmin-scripts/interception/mo-interceptor.py)
> script python3(/opt/jasmin-scripts/interception/mo-interceptor.py)
> ok
Successfully added MOInterceptor [DefaultInterceptor] with order:0

.. note:: As of now, only **python2** script is permitted.
.. note:: As of now, only **python3** script is permitted.

.. note:: Pay attention that the given script is copied to Jasmin core, do not expect Jasmin to refresh the script
code when you update it, you'll need to redefine the *mointerceptor* rule again so Jasmin will refresh the script.
Expand All @@ -751,7 +751,7 @@ Here's an example of adding a **StaticMOInterceptor** to a python script::
filters, script
> order 10
> filters filter_1
> script python2(/opt/jasmin-scripts/interception/mo-interceptor.py)
> script python3(/opt/jasmin-scripts/interception/mo-interceptor.py)
> ok
Successfully added MOInterceptor [StaticMOInterceptor] with order:10

Expand Down Expand Up @@ -842,11 +842,11 @@ Here's an example of adding a **DefaultInterceptor** to a python script::
> type DefaultInterceptor
<class 'jasmin.routing.Interceptors.DefaultInterceptor'> arguments:
script
> script python2(/opt/jasmin-scripts/interception/mt-interceptor.py)
> script python3(/opt/jasmin-scripts/interception/mt-interceptor.py)
> ok
Successfully added MTInterceptor [DefaultInterceptor] with order:0

.. note:: As of now, only **python2** script is permitted.
.. note:: As of now, only **python3** script is permitted.

.. note:: Pay attention that the given script is copied to Jasmin core, do not expect Jasmin to refresh the script
code when you update it, you'll need to redefine the *mtinterceptor* rule again so Jasmin will refresh the script.
Expand All @@ -863,7 +863,7 @@ Here's an example of adding a **StaticMTInterceptor** to a python script::
filters, script
> order 10
> filters filter_1
> script python2(/opt/jasmin-scripts/interception/mt-interceptor.py)
> script python3(/opt/jasmin-scripts/interception/mt-interceptor.py)
> ok
Successfully added MTInterceptor [StaticMTInterceptor] with order:10

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tabulate~=0.8.7
txAMQP @ git+https://github.com/jookies/txamqp.git@master
smpp.pdu @ git+https://github.com/jookies/smpp.pdu.git@master
smpp.twisted @ git+https://github.com/jookies/smpp.twisted.git@master
messaging @ git+https://github.com/jookies/python-messaging.git@master
python-messaging @ git+https://github.com/jookies/python-messaging.git@master


# Added in 0.9rc16:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def parse_requirements(filename):

setup(
name="jasmin",
version='0.10.1',
version='0.10.2',
author="Jookies LTD",
author_email="jasmin@jookies.net",
url="http://www.jasminsms.com",
Expand Down
16 changes: 8 additions & 8 deletions tests/managers/test_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,30 +833,30 @@ def test_redelivery_of_rejected_messages_after_restart(self):
msgid = yield self.submit_sm(localConfig.id, submit_sm_pdu, self.SubmitSmBill)
submitCounter += 1

# Wait for 2 seconds before stopping
yield waitFor(2)
# Wait for 5 seconds before stopping
yield waitFor(5)

yield self.stop(localConfig.id)

# Wait for unbound state
yield waitFor(2)
yield waitFor(5)

# Save the count before starting the connector
_submitRecordsCount = len(self.SMSCPort.factory.lastClient.submitRecords)

# Wait for 3 seconds before starting again
yield waitFor(3)
# Wait for 5 seconds before starting again
yield waitFor(5)

# Start the connector again
yield self.start(localConfig.id)

# Wait for 5 seconds before stopping , all the rest of the queue must be sent
yield waitFor(5)
# Wait for 10 seconds before stopping , all the rest of the queue must be sent
yield waitFor(10)

yield self.stop(localConfig.id)

# Wait for unbound state
yield waitFor(2)
yield waitFor(10)

# Update the counter
_submitRecordsCount += len(self.SMSCPort.factory.lastClient.submitRecords)
Expand Down

0 comments on commit 3acbea2

Please sign in to comment.