Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [![Build Status](http://localhost/api/badges/ddaka/smppng/status.svg)](http://localhost/ddaka/smppng)
- # SMPP-NG
- ## A REST gateway for SMPP
- ---
- ## Getting Started
- Its easier than you think
- ### Requirements
- SMPP-NG doesnt have any requirements
- ### Installation
- ```
- git clone http://git.bpb.com/smppng
- cd smppng
- go build
- ```
- ### Configuration
- SMSC configration file format is yaml and should have information for the two smsc connections
- conf.yaml
- ```
- ---
- -
- address: "localhost:2775"
- username: smppclient1
- password: password
- provider: vala
- rate: 5
- burst: 10
- -
- address: "localhost:2777"
- username: smppclient1
- password: password
- provider: ipko
- rate: 5
- burst: 10
- ```
- ### phone number regex used
- also you should configure the nrc.js config file for the phone number regex yo can use standar javascript matching.
- ncr.js
- ```
- if (/^04[39]\d{6}/.test(input)) {
- result = "ipko";
- } else if (/^04[567]\d{6}/.test(input)) {
- result = "zmobile";
- } else if (/^044\d{6}/.test(input)) {
- result = "vala";
- } else if (/^047\d{6}/.test(input)) {
- result = "mts";
- }%
- ```
- ### Running the application
- run ```./smppng```
- ### Get SMS
- ```
- curl -s -XGET localhost:8080/sms | jq .
- {
- "status": true,
- "timestamp": "1556736955437113326",
- "id": "uuidv4",
- "sms": {
- "src": "049111222",
- "dst": "500",
- "text": "balance",
- "seq": "1015"
- },
- "error": ""
- "took": "0"
- }
- ```
- ### Send SMS
- ```
- curl -s -XPOST localhost:8080/sms -d @sms.json | jq .
- {
- "status": true,
- "timestamp": "1556737073915659559",
- "id": "uuidv4",
- "sms": {
- "src": "500",
- "dst": "049111223",
- "text": "bilianci juaj eshte 555 EURO",
- "seq": "1251"
- },
- "error": ""
- "took": "1"
- }
- ```
- where input format is :
- ```
- {
- "src": "500",
- "dst": "049111223",
- "text": "bilianci juaj eshte 555 EURO"
- }
- ```
- ### Send bulk SMS
- #### same text
- ```
- curl -s -XPOST http://localhost:8080/sms/bulk/single -d @x.json | jq .
- {
- "status": true,
- "timestamp": "1558335927601489377",
- "id": "uuidv4",
- "sms": null,
- "count": 4,
- "error": "",
- "took": "32"
- }
- ```
- where input is
- ```
- {
- "src": "50000",
- "dst": [
- "0038349121222",
- "0038346121222",
- "0038345121222",
- "0038343111223"
- ],
- "text": "test message"
- "description": "bulk notification job"
- }
- ```
- #### different text
- ```
- curl -s -XPOST localhost:8080/bulk/multi -d @bulk.json | jq .
- {
- "status": true,
- "timestamp": "1558335927609473821",
- "id": "uuidv4",
- "sms": null,
- "count": 3,
- "error": "",
- "took": "24"
- }
- ```
- where input format is :
- ```
- {
- "description" : "bulk notify example",
- "sms": [
- {
- "dst": "049111223",
- "text": "msg 1"
- },
- {
- "dst": "049111224",
- "text": "msg 2"
- },
- {
- "dst": "046111225",
- "text": "msg 3"
- }
- ]
- }
- ```
- where input is
- ### Get bulk sms status
- GET http://localhost/bulk/{id}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement