Package: jasmin-mongo-configuration
Jasmin Mongo ConfigurationLinksJasmin SMS Gateway's configuration to MongoDB cluster'sChange Stream(can be a one-node cluster). This package is using MongoDB cluster'sChange Streamwhich allow applications to access realtime data changes.Table of ContentsInstallation InstructionsPYPIFrom SourceDockerSetup MongoDB CLusterUsage InstructionsData StructureStart the ServiceInstallation InstructionsPYPI:pip3 install -U jasmin-mongo-configurationFrom Source:git clone https://github.com/BlackOrder/jasmin_mongo_configuration.git
cd jasmin_mongo_configuration
pip3 install .Docker:docker compose -f ./docker/docker-compose.yml up -dBe sure to change theJASMIN_HOSTandMONGO_HOSTin thedocker-compose.ymlfile to your desired values. and also finish the setup of the MongoDB cluster and import all of your configurations into a MongoDB database before running the docker-compose file.Setup MongoDB CLusterTo setup a MongoDB cluster with Docker, You can use this open sourceDocker Custom MongoDB ImageUsage Instructions:Jasmin Mongo Configurationsync all configurations [Smppccm,Httpccm,Group,User,Filter,MoRouter,MtRouter,MoInterceptor, andMtInterceptor] from a MongoDB cluster to ajasmininstance. All settings can be read from OS ENV when run from console or passed as arguments. if you want to import it in you code, you can supply the settings on initialization.Data StructureThe Database supplied should have a collection for each module:smppccm
group
user
filter
httpccm
morouter
mointerceptor
mtrouter
mtinterceptorEach collection should contains your desiredjasmin's settings in a key value format. and should have a valid format for Jasmin. for example theusercollection should have documents in this format:{
    '_id': '$UID',
    'gid': '$GID',
    'mt_messaging_cred authorization dlr_level': 'True',
    'mt_messaging_cred authorization hex_content': 'True',
    'mt_messaging_cred authorization http_balance': 'True',
    'mt_messaging_cred authorization http_bulk': 'True',
    'mt_messaging_cred authorization http_dlr_method': 'True',
    'mt_messaging_cred authorization http_long_content': 'True',
    'mt_messaging_cred authorization http_rate': 'True',
    'mt_messaging_cred authorization http_send': 'True',
    'mt_messaging_cred authorization priority': 'True',
    'mt_messaging_cred authorization schedule_delivery_time': 'True',
    'mt_messaging_cred authorization smpps_send': 'True',
    'mt_messaging_cred authorization src_addr': 'True',
    'mt_messaging_cred authorization validity_period': 'True',
    'mt_messaging_cred defaultvalue src_addr': 'None',
    'mt_messaging_cred quota balance': 4000,
    'mt_messaging_cred quota early_percent': 'ND',
    'mt_messaging_cred quota http_throughput': 'ND',
    'mt_messaging_cred quota smpps_throughput': 'ND',
    'mt_messaging_cred quota sms_count': 'ND',
    'mt_messaging_cred valuefilter content': '.*',
    'mt_messaging_cred valuefilter dst_addr': '.*',
    'mt_messaging_cred valuefilter priority': '^[0-3]$',
    'mt_messaging_cred valuefilter src_addr': '^()$',
    'mt_messaging_cred valuefilter validity_period': '^d+$',
    'password': '$PASSWORD',
    'smpps_cred authorization bind': 'True',
    'smpps_cred quota max_bindings': '1',
    'status': true,
    'uid': '$UID',
    'username': '$USERNAME'
}Keep in mind, to not includemt_messaging_cred quota balance, andmt_messaging_cred quota sms_countkeys in yourusercollection if you havejasmininternal billing enabled.
Also notice there is an extra keystatus. This key is a specialboolfield. You have to include it in alluser,group, andsmppccmdocuments. The package will use the value of this key toEnableifTrue,DisableifFalsetheuser, andgroup. In case ofsmppccmthe package willstartthesmppccmifTrueandstopit ifFalse.Also keep in mind the package will not copy any files to thejasmininstance. all communications are done throughTelnet. So, in case ofMoInterceptor, andMtInterceptor. You will have to make the script accessible to thejasminserver. Example of aMtInterceptordocument:{
    _id: '$ORDER',
    filters: 'premium_numbers',
    order: '$ORDER',
    script: 'python3(/tmp/premium.py)',
    type: 'StaticMTInterceptor'
}You will have to make the surejasminhave access to/tmp/premium.pybefore adding the document to MongoDB cluster.Start the serviceThere is multiple ways to setup the package from CLI.By exporting ENV variables
you can export the fallowing variables before executionJASMIN_CLI_HOST                         =       **REQUIRED:NoDefault**
JASMIN_CLI_PORT                         =               8990
JASMIN_CLI_TIMEOUT                      =                30
JASMIN_CLI_AUTH                         =                yes
JASMIN_CLI_USERNAME                     =             jcliadmin
JASMIN_CLI_PASSWORD                     =              jclipwd
JASMIN_CLI_STANDARD_PROMPT              =             "jcli : "
JASMIN_CLI_INTERACTIVE_PROMPT           =               "> "
MONGO_CONNECTION_STRING                 =       **REQUIRED:NoDefault**
MONGO_CONFIGURATION_DATABASE            =       **REQUIRED:NoDefault**
SYNC_CURRENT_FIRST                      =                yes
JASMIN_MONGO_CONFIGURATION_LOG_PATH     =          /var/log/jasmin/Then execute:jasminmongoconfdyou can pass arguments to the package on execution. executejasminmongoconfd -hto see all possible arguments. Then execute:jasminmongoconfd --cli-host $JASMIN_CLI_HOST --connection-string $MONGO_CONNECTION_STRING --configuration-database $MONGO_CONFIGURATION_DATABASEMix the previous two methods. you can set the ENV variables and pass some arguments. for example:JASMIN_CLI_HOST=127.0.0.1 jasminmongoconfd --connection-string $MONGO_CONNECTION_STRING --configuration-database $MONGO_CONFIGURATION_DATABASE