Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
configuration:telephone-on-serial [2017/10/23 16:02]
fachet
configuration:telephone-on-serial [2017/10/23 16:18]
fachet
Line 106: Line 106:
  
 while (true) { while (true) {
-  msg = nb_voice_event(1).call.calling;​+  msg = nb_voice_event(1).call.calling;​ // check event with 1sec timeout
   if (!is_void(msg)) {   if (!is_void(msg)) {
     msg = left(msg, strlen(msg) - 5); // trim phone number     msg = left(msg, strlen(msg) - 5); // trim phone number
     msg = right(msg, strlen(msg) - 6);     msg = right(msg, strlen(msg) - 6);
     msg = strcat(msg, "​\r\n"​);​     msg = strcat(msg, "​\r\n"​);​
 +    len = strlen(msg);​
  
-    if (write(fd, msg, strlen(msg< 0 ); +    if (write(fd, msg, len!= len{ 
- nb_syslog("​Error on writing to %s\n", DEV);+ nb_syslog("​Error on writing ​%d bytes to %s", len, DEV);
  close(fd);  close(fd);
  exit(5);  exit(5);
Line 123: Line 124:
 The SDK command „nb_voice_event“ makes it possible to query the status of the voice call. For more information about the SDK-API, see please to the Weblink http://​wiki.netmodule.com/​documentation/​start under the item Products under one of the router'​s model you have. The SDK command „nb_voice_event“ makes it possible to query the status of the voice call. For more information about the SDK-API, see please to the Weblink http://​wiki.netmodule.com/​documentation/​start under the item Products under one of the router'​s model you have.
  
-With a loop and the SDK command, you get when a voice call comes in. +You can use the test window to see when a voice call comes in.
- +
-<code - voice_evenet.are > +
- +
- while(true) +
-+
- dump(nb_voice_event(10));​ +
- }+
  
 +<​code>​
 +dump(nb_voice_event(10));​ // wait 10secs for call
 </​code>​ </​code>​
  
Line 137: Line 133:
  
 <​code>​ <​code>​
- 
-void 
- 
 struct(2): { struct(2): {
   .call = struct(4): {   .call = struct(4): {
Line 156: Line 149:
             .state = string[6]: "​hungup"​             .state = string[6]: "​hungup"​
           }           }
-  .type = string[6]: "​hungup"​ 
 } }