This shows you the differences between two versions of the page.
| sdk:voicetodigitalout [2024/08/22 10:27] – created fachet | sdk:voicetodigitalout [2024/08/22 10:30] (current) – fachet | ||
|---|---|---|---|
| Line 41: | Line 41: | ||
| } | } | ||
| /* not reached */ | /* not reached */ | ||
| - | < | + | </code> | 
| + | ===== SDK-Script ===== | ||
| + | <code - 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 = " | ||
| + | TELOFF = " | ||
| + | |||
| + | nb_syslog(" | ||
| + | while (true) { | ||
| + | msg = nb_voice_event(1).call.calling; | ||
| + | if (!is_void(msg)) { | ||
| + | msg = left(msg, strlen(msg) - 5); // trim phone number | ||
| + | msg = right(msg, strlen(msg) - 6); | ||
| + | nb_syslog(" | ||
| + | if (msg == TELON) { | ||
| + | nb_syslog(" | ||
| + | nb_dio_set(" | ||
| + | } else if (msg == TELOFF) { | ||
| + | nb_syslog(" | ||
| + | nb_dio_set(" | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | /* not reached */ | ||
| + | </ | ||