This shows you the differences between two versions of the page.
sdk:scripts:send-sms [2015/05/05 15:04] |
sdk:scripts:send-sms [2015/05/05 15:04] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SDK Script send-sms.are ====== | ||
+ | <code c send-sms.are> | ||
+ | /* DESC: This script will send an SMS to the specified phone number. | ||
+ | * Copyright (C) 2012 NetModule AG, Switzerland | ||
+ | */ | ||
+ | |||
+ | void usage() | ||
+ | { | ||
+ | printf("usage: send-sms.are <phone> <msg>\n"); | ||
+ | exit(1); | ||
+ | } | ||
+ | |||
+ | if (argc < 3) { | ||
+ | usage(); | ||
+ | } | ||
+ | |||
+ | phone = argv[1]; | ||
+ | |||
+ | msg = ""; | ||
+ | for (i = 2; i <= argc; i++) { | ||
+ | msg = strcat(msg, " ", argv[i]); | ||
+ | } | ||
+ | |||
+ | id = nb_sms_send(phone, msg); | ||
+ | if (id) { | ||
+ | printf("SMS to %s (ID %s) has been spooled\n", phone, id); | ||
+ | } else { | ||
+ | printf("Unable to send SMS to %s\n", phone); | ||
+ | } | ||
+ | |||
+ | exit(0); | ||
+ | |||
+ | </code> | ||