Sending an SMS message

You can send an SMS message by writing the send_message command (with the recipientAddress and payload parameters set properly) to the SMS control object. Because this is a server object, to observe the response, you must force the shell to keep the file descriptor open. In the following example, we use the exec command to do this, then direct the response messages to stderr:

# (exec 3<> /pps/services/cellular/sms/control_private && cat >&3
 && sleep 1 && cat <&3)<<END
> msg::send_message
> id::222
> dat:json:{"recipientAddress":"nnnnnnnnnn", "payload":"Test Message",
    "encoding":"gsm0338"}
> END

Here, nnnnnnnnnn is an actual phone number, including the country code and area code.

If the command is successful, the response is:

@control_private
res::send_message
id::222
dat:json:{"messageId":0}
success:b:true
@control_private
msg::message_status
dat:json:{"messageId":0,"status":"SmsStatusSendSuccess"}

The logging information shows the following:

Mar 27 09:58:33.152  qwf_cellular_services.2515004            high_rate   3110  QWF_TR 
              segment_and_send: SMS_Service: Request the SMS transport agent to send the 
 SMS message [ PPS ID=222 ] for SMS Client=@control_private.nnnnnnnnnnnnn

Mar 27 09:58:33.207  qwf_cellular_services.2515004            high_rate   3110  QWF_TR 
              segment_and_send: SMS_Service: SMS message successfully sent

Mar 27 09:58:33.208          qwf_crm_telit.2543682            high_rate   1011         
          SmsPackSubmit: packing TL:11 20 0A 81 19 99 68 80 53 00 00 FF 0C D4 F2 9C 0E 6A
 96 E7 F3 F0 B9 0C  <24 bytes>
Mar 27 09:58:33.208          qwf_crm_telit.2543682            high_rate   1011         
          SmsPackSubmit: total TPDU len is 24

Mar 27 09:58:33.725          qwf_crm_telit.2543682             low_rate*  1011  QWF_TR 
 LP_SMS_SENT_OK

Mar 27 09:58:33.725  qwf_cellular_services.2515004            high_rate   3110         
    process_send_status: SMS_Service: Processing SMS send status notifications for fd=20
 [Client ID=nnnnnnnnnnnnn]

Mar 27 09:58:33.725  qwf_cellular_services.2515004            high_rate   3110          
   send_message_status: SMS_Service: Sending received message status response
 [ Message ID=0, status=SmsStatusSendSuccess / cause=SmsCauseNone ] to SMS Client ID=
nnnnnnnnnnnnn