This is an old revision of the document!
<code - voicetodigitalout-test.are >
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);
}
}
} <code>