This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
sdk:alarm-via-voice [2016/09/16 15:12] – created juraschek | sdk:alarm-via-voice [2022/01/26 15:57] (current) – schmitt | ||
---|---|---|---|
Line 3: | Line 3: | ||
The Script will try to reach a phonenumber for a certain time, also retries after a specific time and give up after a defined timeout. | The Script will try to reach a phonenumber for a certain time, also retries after a specific time and give up after a defined timeout. | ||
+ | |||
+ | We will see the alarm as received if the Call was picked up. To be sure that a person picked up we only accept calls that last less then 10 seconds. This way we avoid false positives if a answering machine, a voice mail or a pbx will pickup the phone call. | ||
For this example we will work with die DIGITAL INPUT as an alarm. But you can trigger this script on many events. | For this example we will work with die DIGITAL INPUT as an alarm. But you can trigger this script on many events. | ||
===== Requirements ===== | ===== Requirements ===== | ||
- | * NB1600, NB2700, NB3700 with a voice featured modem | + | * NB1601, NB800 (Rev B.), NB1600, NB2700, NB3700 with a voice featured modem |
* Voice-License installed | * Voice-License installed | ||
* A SIM card with phonecalls enabled (some data-SIMs will not work) | * A SIM card with phonecalls enabled (some data-SIMs will not work) | ||
- | | + | |
Line 17: | Line 19: | ||
If there is not availability or a positive licensing status please contact our [[http:// | If there is not availability or a positive licensing status please contact our [[http:// | ||
- | {{ :sdk:screenshot_-_160916_-_16_18_33.png? | + | {{ :sdk:bild2.png? |
Please also make sure your sim card is succefully registered in the mobile network | Please also make sure your sim card is succefully registered in the mobile network | ||
- | {{ :sdk:screenshot_-_160916_-_16_16_15.png? | + | {{ :sdk:alarm_via_voice_wwansignal.png? |
===== Configuration ===== | ===== Configuration ===== | ||
Line 33: | Line 35: | ||
Enable the Administrative Status and set the Call Routing to SDK | Enable the Administrative Status and set the Call Routing to SDK | ||
- | {{ :sdk:screenshot_-_160916_-_16_16_43.png? | + | {{ :sdk:BILD1.png? |
Add two Endpoint Voice-over-Mobile and Nil-Device | Add two Endpoint Voice-over-Mobile and Nil-Device | ||
- | {{ :sdk:screenshot_-_160916_-_16_45_09.png? | + | {{ :sdk:bild3.png? |
- | {{ :sdk:screenshot_-_160916_-_16_44_54.png? | + | {{ :sdk:bild4.png? |
Line 53: | Line 55: | ||
* Job: combine the script phone-alarm and the trigger din1-on to a job. | * Job: combine the script phone-alarm and the trigger din1-on to a job. | ||
- | {{ :sdk:screenshot_-_160916_-_16_34_51.png?nolink |}} | + | |
- | {{ :sdk:screenshot_-_160916_-_16_35_03.png?nolink |}} | + | {{ :sdk:bild5.png?nolink |}} |
- | {{ :sdk:screenshot_-_160916_-_17_11_00.png?nolink |}} | + | |
+ | |||
+ | {{ :sdk:bild8.png?nolink |}} | ||
+ | |||
+ | {{ :sdk:bild9.png?nolink |}} | ||
Line 98: | Line 104: | ||
// How many times should we try to calll; | // How many times should we try to calll; | ||
retries=5;// | retries=5;// | ||
+ | |||
+ | //maximum time in seconds a call can be connected before we assume it's picked up by a machine | ||
+ | maxConnectTime=10; | ||
+ | |||
//Enable Debug Messages; | //Enable Debug Messages; | ||
- | DEBUG=false; | + | DEBUG=true; |
void debug(string msg) { | void debug(string msg) { | ||
if(DEBUG) { | if(DEBUG) { | ||
Line 142: | Line 152: | ||
- | | + | |
callOngoing=true; | callOngoing=true; | ||
while(callOngoing) { | while(callOngoing) { | ||
Line 168: | Line 178: | ||
break; | break; | ||
case " | case " | ||
- | debug(" | + | debug(" |
- | nb_syslog(" | + | nb_syslog(" |
- | | + | |
- | nb_syslog(" | + | |
- | nb_voice_call_hangup(event.call.id); | + | if (connectStart> |
- | exit(0); | + | |
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
break; | break; | ||
case " | case " | ||
+ | if (connectStart!=0) { | ||
+ | if (jiffy()-maxConnectTime< | ||
+ | nb_syslog(" | ||
+ | nb_voice_call_hangup(event.call.id); | ||
+ | connectStart=0; | ||
+ | exit(0); | ||
+ | } | ||
+ | } | ||
break; | break; | ||
default: | default: | ||
Line 200: | Line 222: | ||
nb_syslog(" | nb_syslog(" | ||
exit(0); | exit(0); | ||
- | |||
</ | </ |