How to send SMS via MTR-H5 from a 3rd party application

Home Forums General How to send SMS via MTR-H5 from a 3rd party application

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #12554
    Rick Wong
    Participant

    I am trying to configure a Multitech MTR-H5 to be the SMS gateway of a 3rd party application.
    Is it possible to send SMS through MTR-H5 by something like HTML code or command (script)?

    #12557
    Lonny Knudson
    Blocked

    Hi Rick,
    The MTR series has an API that will allow you to exchange SMS via http, here is a link to the API manual:
    http://www.multitech.com/manuals/s000576_1_2_1.pdf
    If you have an existing application that uses 3GPP TS 27.005 AT commands, you can enable telnet access to cellular radio and have your application interact with the radio over a TCP socket. If this method is chosen you will need to dedicate the MTR to the SMS application only.

    #12591
    Rick Wong
    Participant

    Hi Lonny,
    When I refer to the API development guide under SMS section, it seems that the API is only support for SMS settings but not sending SMS message.
    If the API supports SMS message sending, could you please guide me which API object and element I should call?

    #12597
    Jeff Hatch
    Keymaster

    Rick,

    The part of the API that supports sending an SMS message is in the command controller object. The URL for that will be

    https:///api/command/sms_send

    The Json data (post fields) will be of the following format:

    {“recipients”:”“, “message”:”“}

    Hope that helps,

    Jeff

    #12598
    Jeff Hatch
    Keymaster

    Rick,

    In the previous message, the URL got messed up and should be:

    https://[conduit_ip]/api/command/sms_send

    and the Json data:

    {“recipients”: “phone_number”, “message”:”message text”}

    Jeff

    #12622
    Rick Wong
    Participant

    Thanks Jeff. I think that is missed in the development guide. However, the API works well for me if I am using HTTPS.
    Due to the application limitation, I can only use HTTP to call the API but HTTP does not work.

    It throws when I tried to call api/whoami or api/command/sms_send with HTTP:
    {
    “code” : 401,
    “error” : “not logged in”,
    “status” : “fail”
    }

    I could call api/login with HTTP with code 200 and status success.

    #12627
    Brandon Bayer
    Blocked

    Rick, what firmware version do you have? We fixed some things related to http & login in the latest release (3.4.2).

    -Brandon

    #12631
    Rick Wong
    Participant

    Version: MultiConnect® rCell v3.4.2

    Also I already uncheck the “redirect to HTTPS”.

    #12636
    Jeff Hatch
    Keymaster

    Rick,

    I am able to log in to the UI with a browser, so the API should be working through the HTTP port 80. Are you using Curl to make your requests? If so, you may have to use some options to keep track of the authentication token for you after the login request.

    Jeff

    #12665
    Melvin Chow
    Participant

    Hi Rick,

    I think the problem here is not familiar of the JSON data structure and command sequence, and syntax etc….., to use the HTTP to send the SMS, we need to include the Token.

    I would like to list out the Multitech testing example below to help all other customer with similar problem. Honestly said I am not an expect to JSON data, and I have no intention to learn it due to this small project, but we just want to use it as application level and solve the problem.

    I hope the below http/https sms example provided by Multitech could help all other customer in the future, and solve the problem in a short time.

    here is the HTTP send SMS example from Lonny, I changed to Tel number to 12345678

    /////////////////////////////////////////////////
    ###############
    Login
    ###############
    root@multitech-MS-7253:/home/multitech/api# wget ‘http://192.168.2.1/api/login?username=admin&password=admin’–2016-05-24 10:57:48– http://192.168.2.1/api/login?username=admin&password=admin
    Connecting to 192.168.2.1:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: unspecified [application/json]
    Saving to: 鈥榣ogin?username=admin&password=admin鈥?
    [ <=> ] 265 –.-K/s in 0s

    2016-05-24 10:57:48 (16.4 MB/s) – 鈥榣ogin?username=admin&password=admin鈥?saved [265]

    #############
    read token
    #############
    root@multitech-MS-7253:/home/multitech/api# cat login\?username\=admin\&password\=admin
    {
    “code” : 200,
    “result” : {
    “address” : “192.168.2.13”,
    “permission” : “admin”,
    “port” : “50709”,
    “timestamp” : “20:54:11:830”,
    “token” : “A26A8ACCE10AEE088AE96255EC64041”,
    “user” : “admin”
    },
    “status” : “success”
    }

    ################
    get inbox
    ################
    root@multitech-MS-7253:/home/multitech/api# wget ‘http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041&#8217;
    –2016-05-24 10:58:26– http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041
    Connecting to 192.168.2.1:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: unspecified [application/json]
    Saving to: 鈥榠nbox?token=A26A8ACCE10AEE088AE96255EC64041鈥?
    [ <=> ] 63 –.-K/s in 0s

    2016-05-24 10:58:26 (3.86 MB/s) – 鈥榠nbox?token=A26A8ACCE10AEE088AE96255EC64041鈥?saved [63]

    ##################
    read inbox
    note: inbox empty
    ##################
    root@multitech-MS-7253:/home/multitech/api# cat inbox\?token\=A26A8ACCE10AEE088AE96255EC64041
    {
    “code” : 200,
    “result” : [],
    “status” : “success”
    }

    ###################
    send SMS to myself
    ###################
    root@multitech-MS-7253:/home/multitech/api# wget ‘http://192.168.2.1/api/sms/outbox?data={“recipients”: [“12345678”], “message”: “Hello World”}&token=A26A8ACCE10AEE088AE96255EC64041&method=POST’
    –2016-05-24 11:00:10– http://192.168.2.1/api/sms/outbox?data=%7B%22recipients%22:%20%5B%2212345678%22%5D,%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041&method=POST
    Connecting to 192.168.2.1:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: unspecified [application/json]
    Saving to: 鈥榦utbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041&method=POST鈥?
    [ <=> ] 45 –.-K/s in 0s

    2016-05-24 11:00:10 (2.65 MB/s) – 鈥榦utbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041&method=POST鈥?saved [45]

    ############
    get outbox
    ############
    root@multitech-MS-7253:/home/multitech/api# wget ‘http://192.168.2.1/api/sms/outbox?data={“recipients”: [“12345678”], “message”: “Hello World”}&token=A26A8ACCE10AEE088AE96255EC64041’
    –2016-05-24 11:00:53– http://192.168.2.1/api/sms/outbox?data=%7B%22recipients%22:%20%5B%2212345678%22%5D,%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041
    Connecting to 192.168.2.1:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: unspecified [application/json]
    Saving to: 鈥榦utbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041鈥?
    [ <=> ] 291 –.-K/s in 0s

    2016-05-24 11:00:53 (11.9 MB/s) – 鈥榦utbox?data=%7B%22recipients%22:%20[%2212345678%22],%20%22message%22:%20%22Hello%20World%22%7D&token=A26A8ACCE10AEE088AE96255EC64041鈥?saved [291]

    #######################
    read outbox
    note: sms is in outbox
    #######################
    root@multitech-MS-7253:/home/multitech/api# cat outbox\?data\=%7B%22recipients%22\:%20\[%2212345678%22\]\,%20%22message%22\:%20%22Hello%20World%22%7D\&token\=A26A8ACCE10AEE088AE96255EC64041
    {
    “code” : 200,
    “result” : [
    {
    “guid” : “2016052415594100”,
    “message” : “Hello World”,
    “recipient” : “12345678”,
    “retries” : 0,
    “status” : “sent”,
    “timestamp” : “2016/05/24 15:59:41”
    }
    ],
    “status” : “success”
    }

    ###########
    get inbox
    ###########
    root@multitech-MS-7253:/home/multitech/api# wget ‘http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041&#8217;
    –2016-05-24 11:02:30– http://192.168.2.1/api/sms/inbox?token=A26A8ACCE10AEE088AE96255EC64041
    Connecting to 192.168.2.1:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: unspecified [application/json]
    Saving to: 鈥榠nbox?token=A26A8ACCE10AEE088AE96255EC64041.1鈥?
    [ <=> ] 237 –.-K/s in 0s

    2016-05-24 11:02:30 (14.4 MB/s) – 鈥榠nbox?token=A26A8ACCE10AEE088AE96255EC64041.1鈥?saved [237]

    #####################
    read inbox
    note: inbox now has
    received sms
    #####################

    root@multitech-MS-7253:/home/multitech/api# cat inbox\?token\=A26A8ACCE10AEE088AE96255EC64041.1
    {
    “code” : 200,
    “result” : [
    {
    “guid” : “2016052415595400”,
    “message” : “Hello World”,
    “source” : “12345678”,
    “timestamp” : “2016/05/24 15:59:54”
    }
    ],
    “status” : “success”
    }
    root@multitech-MS-7253:/home/multitech/api#

    ///////////////////////////////////////////
    ////////////////////////////////////////////////

    Here is the example to use HTTPS to send and receive SMS from Multitech engineer
    /////////////////////////////////////////////
    If you want to send sms using api, here is the command:

    https://192.168.2.1/api/sms/outbox?data={“recipients”: [“12345678900”], “message”: “Hello World”}&method=POST

    Notes: You can also send multiple phone numbers, just separate it with a comma. For example, “1234567890”,”0987654321″
    Is it possible to retrieve the SMS response for a message which is sent via the API? (OK, ERROR, etc.)
    Answer: https://192.168.2.1/api/sms/outbox
    ////////////////////////////////////////////////////////

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.