JSON API for YateSMSC Control

From YateBTS
Jump to: navigation, search

Request: query_stats

Retrieve node statistics for the equipment.
It is mandatory to provide the desired node type.

Request

{ "request":"query_stats", "node":"smsc" }

Example response

{"code":0,
 "stats":{
   "engine":{
     "version":"5.5.1","revision":1830,"nodename":"blanked-as-ordered","plugins":21,"inuse":1,"handlers":190,"hooks":4,
     "messages":0,"maxqueue":10,"messagerate":40,"maxmsgrate":301,"enqueued":3326083,"dequeued":3326083,"dispatched":9613542,
     "supervised":true,"runattempt":3,"lastsignal":17,"threads":44,"workers":13,"mutexes":335,"semaphores":3,"acceptcalls":"accept","congestion":0
   },
   "uptime":{
     "wall":531208,
     "user":29450,
     "kernel":27682
   },
   "smsc_map":{
     "routers":8,
     "errors":67783,
     "recv_mo":118108,
     "sent_map":244937,
     "recv_mt":122198,
     "reports":4354,
     "alerts":626,
     "routing":6
   },
   "smsc_ati":{
     "sent":122198,
     "recv":122198,
     "errs":0,
     "fail":0
   },
   "smsc_gtt":{
     "local":955545,
     "stp":670173,
     "back":0,
     "fail":20,
     "stp_101":"up",
     "stp_102":"up"
   }
 }
}

Request: schedule_sms

Request delivery of text message/partially encoded message/ custom PDU in MT format. If custom TPDU is sent, it must be formatted as a full MT SMS in hex format.
When sending a text message it will be encoded as gsm7bit (default charset/utf8) or ucs2.

You can deliver to single receiver or to multiple receivers (if array or msisdns is given instead of single msisdn).

Format:
{
  "originator": "",       // Sender of the SMS. This is not used in any way, just for informational purpose. The sender should be encoded in the PDU already
  "destination": ["",""] or ""  ,     // REQUIRED. Receiver(s) of the SMS. Must be a valid MSISDN or Array of valid MSISDNs 

  "orignumtype": "international"/"national"/"alphanumeric",  // Optional. Defaults to "international"
  "orignumplan": "isdn"/"national"/"unknown"  //  Optional. Defaults to "isdn" if "orignumtype" is not "alphanumeric", or "unknown" if "orignumtype" is "alphanumeric"
  "destnumtype": "international"/"national", //   Optional. The SMSC tries to guess the destination based of number and my_cc (country code) set in smsc. 

  "scheduled_time": "",  // unix timestamp. Optional. Deliver sms(s) starting from that time

  // Use one of this options:

  // text that the smsc should try to encode
  "text": "",

  // OR already encoded ud in hex format, specify de data coding scheme that should be send
  "encoded_ud":"",
  "dcs": "",
  "udhi": true/false,  // Optional. Default false 

  // OR completely custom tpdu: String representation of a full MT SMS in hex format
  "tpdu": ""
}
Examples:
{"request":"schedule_sms", "node":"smsc", "params":{"originator":"40744334433","destination":"+88250001","text":"sms test enconding"}}
{"request":"schedule_sms", "node":"smsc", "params":{"originator":"monica","orignumtype":"alphanumeric","destination":"+88250001","text":"sms test enconding abc caller 3 "}}
{"request":"schedule_sms", "node":"smsc", "params":{"originator":"40744334444", "orignumtype":"international", "destination":"50001", "destnumtype":"national" ,"text":"sms test enconding"}}
{"request":"schedule_sms", "node":"smsc", "params":{"originator":"+40744334444", "destination":["88350001","40744334411"], "destnumtype":"international","text":"sms test enconding" }}
{"request":"schedule_sms", "node":"smsc", "params":{"originator":"407443344011", "orignumtype":"international", "destination":"88250001", "destnumtype":"international","encoded_ud":"F3F61C442FCFE9A0B27BFC7693D3EE33282C1E83C66136BB2C07CD40", "dcs":"gsm7bit"}}
{"request":"schedule_sms", "node":"smsc", "params":{"originator":"407443344011", "orignumtype":"international", "destination":"88250001", "destnumtype":"international","tpdu":"000ba17044334410f100006111304175838020f3f61c442fcfe9a0b27bfc7693d3ee33282c1e83c66136bb2c07cd40"}}