SDK-Script for testing

voicetodigitalout-test.are
/* DESC: This script can be used to switch a digital out port by phone calls
*
* Voice License needed, prepatation:
* 
* SERVICES->Voice Gateway->Administration: Administrative status = enabled
* SERVICES->Voice Gateway->Administration: Call routing = SDK
* SERVICES->Voice Gateway->Endpoints: Add voice endpoint Voice-over-Mobile / Modem 1
*
* SERVICES->SDK->Administration: Administrative status = enabled
* SERVICES->SDK->Testing: <copy this script into the textbox and run>
*
* Copyright (C) 2024 NetModule AG, Switzerland (rfa)
*
*
* 
*/
TELON = "+49...";  // call from this number switches ON
TELOFF = "+49..";  // call from this number switches OFF
 
printf("ON: %s  OF: %s\n", TELON, TELOFF);
while (true) {
  msg = nb_voice_event(1).call.calling;	// check event with 1sec timeout
  printf(".");
  if (!is_void(msg)) {
    printf("called by %s\n", msg);
    msg = left(msg, strlen(msg) - 5); // trim phone number
    printf("called by %s\n", msg);
    msg = right(msg, strlen(msg) - 6);
    printf("called by %s\n", msg);
	if (msg == TELON) {
		printf("%s -> ON\n", msg);
		nb_dio_set("out1", 1);
	 } else if (msg == TELOFF) {
		printf("%s -> OFF\n", msg);
		nb_dio_set("out1", 0);
	}
  }
}
/* not reached */

SDK-Script

voicetodigitalout.are
/* DESC: This script can be used to switch a digital out port by phone calls
 *
 * Copyright (C) 2024 NetModule AG, Switzerland (rfa)
 */
TELON = "+49...";  // call from this number switches ON
TELOFF = "+49..";  // call from this number switches OFF
 
nb_syslog("Alarm numbers ON: %s  OF: %s", TELON, TELOFF);
while (true) {
  msg = nb_voice_event(1).call.calling;	// check event with 1sec timeout
  if (!is_void(msg)) {
    msg = left(msg, strlen(msg) - 5); // trim phone number
    msg = right(msg, strlen(msg) - 6);
    nb_syslog("called by %s", msg);
    if (msg == TELON) {
	nb_syslog("Alarm ON");
	nb_dio_set("out1", 1);
    } else if (msg == TELOFF) {
	nb_syslog("Alarm OFF");
	nb_dio_set("out1", 0);
    }
  }
}
/* not reached */