Advertisement
Guest User

xsmpp

a guest
May 20th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. [![Build Status](http://localhost/api/badges/ddaka/smppng/status.svg)](http://localhost/ddaka/smppng)
  2.  
  3. # SMPP-NG
  4.  
  5. ## A REST gateway for SMPP
  6.  
  7. ---
  8.  
  9. ## Getting Started
  10. Its easier than you think
  11. ### Requirements
  12. SMPP-NG doesnt have any requirements
  13. ### Installation
  14.  
  15. ```
  16. git clone http://git.bpb.com/smppng
  17. cd smppng
  18. go build
  19. ```
  20.  
  21. ### Configuration
  22.  
  23. SMSC configration file format is yaml and should have information for the two smsc connections
  24.  
  25. conf.yaml
  26. ```
  27. ---
  28. -
  29. address: "localhost:2775"
  30. username: smppclient1
  31. password: password
  32. provider: vala
  33. rate: 5
  34. burst: 10
  35. -
  36. address: "localhost:2777"
  37. username: smppclient1
  38. password: password
  39. provider: ipko
  40. rate: 5
  41. burst: 10
  42.  
  43. ```
  44.  
  45.  
  46.  
  47. ### phone number regex used
  48.  
  49. also you should configure the nrc.js config file for the phone number regex yo can use standar javascript matching.
  50.  
  51. ncr.js
  52. ```
  53. if (/^04[39]\d{6}/.test(input)) {
  54. result = "ipko";
  55. } else if (/^04[567]\d{6}/.test(input)) {
  56. result = "zmobile";
  57. } else if (/^044\d{6}/.test(input)) {
  58. result = "vala";
  59. } else if (/^047\d{6}/.test(input)) {
  60. result = "mts";
  61. }%
  62. ```
  63.  
  64.  
  65. ### Running the application
  66.  
  67. run ```./smppng```
  68.  
  69.  
  70. ### Get SMS
  71.  
  72.  
  73. ```
  74. curl -s -XGET localhost:8080/sms | jq .
  75. {
  76. "status": true,
  77. "timestamp": "1556736955437113326",
  78. "id": "uuidv4",
  79. "sms": {
  80. "src": "049111222",
  81. "dst": "500",
  82. "text": "balance",
  83. "seq": "1015"
  84. },
  85. "error": ""
  86. "took": "0"
  87. }
  88.  
  89. ```
  90.  
  91. ### Send SMS
  92.  
  93. ```
  94. curl -s -XPOST localhost:8080/sms -d @sms.json | jq .
  95. {
  96. "status": true,
  97. "timestamp": "1556737073915659559",
  98. "id": "uuidv4",
  99. "sms": {
  100. "src": "500",
  101. "dst": "049111223",
  102. "text": "bilianci juaj eshte 555 EURO",
  103. "seq": "1251"
  104. },
  105. "error": ""
  106. "took": "1"
  107. }
  108. ```
  109. where input format is :
  110. ```
  111. {
  112. "src": "500",
  113. "dst": "049111223",
  114. "text": "bilianci juaj eshte 555 EURO"
  115. }
  116.  
  117. ```
  118.  
  119. ### Send bulk SMS
  120.  
  121. #### same text
  122. ```
  123. curl -s -XPOST http://localhost:8080/sms/bulk/single -d @x.json | jq .
  124.  
  125. {
  126. "status": true,
  127. "timestamp": "1558335927601489377",
  128. "id": "uuidv4",
  129. "sms": null,
  130. "count": 4,
  131. "error": "",
  132. "took": "32"
  133. }
  134. ```
  135.  
  136. where input is
  137.  
  138. ```
  139. {
  140. "src": "50000",
  141. "dst": [
  142. "0038349121222",
  143. "0038346121222",
  144. "0038345121222",
  145. "0038343111223"
  146. ],
  147. "text": "test message"
  148. "description": "bulk notification job"
  149. }
  150. ```
  151. #### different text
  152. ```
  153. curl -s -XPOST localhost:8080/bulk/multi -d @bulk.json | jq .
  154.  
  155. {
  156. "status": true,
  157. "timestamp": "1558335927609473821",
  158. "id": "uuidv4",
  159. "sms": null,
  160. "count": 3,
  161. "error": "",
  162. "took": "24"
  163. }
  164. ```
  165. where input format is :
  166. ```
  167. {
  168. "description" : "bulk notify example",
  169. "sms": [
  170. {
  171. "dst": "049111223",
  172. "text": "msg 1"
  173. },
  174. {
  175. "dst": "049111224",
  176. "text": "msg 2"
  177. },
  178. {
  179. "dst": "046111225",
  180. "text": "msg 3"
  181. }
  182. ]
  183. }
  184. ```
  185. where input is
  186.  
  187.  
  188. ### Get bulk sms status
  189.  
  190. GET http://localhost/bulk/{id}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement