Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Einfache Script-Fähigkeit per CLI (Read 3426 times)
Phoner Admin
YaBB Administrator
*****
Offline



Posts: 11389
Location: Germany
Joined: 12. Oct 2003
Gender: Male
Einfache Script-Fähigkeit per CLI
21. Mar 2022 at 11:34
Print Post  
Seit der Version 3.1beta beinhaltet PhonerLite eine einfache Möglichkeit der Steuerung per CLI (Command Line Interface).
Dieses muss man jedoch im Optionen-Menü erst aktivieren. Danach kann man mit einem Telnet-Client sich zu PhonerLite verbinden (Port 50600):
Code
Select All
telnet localhost 50600 




Ein Beispielscript um die Rufnummer 0123456780 anzurufen und wenn die Gegenstelle angenommen hat eine Wave-Datei (Beispiel: announcement.wav) abzuspielen:
Code
Select All
If HasCall
  Print Stop script due existing other call
  Stop
EndIf
SetNumber 01234567890
HookOff
Wait 5,HasCall
If !HasCall
  Print Stop script due no call could be created
  HookOn
  Stop
EndIf
Print Waiting for call is beeing answered within 30 seconds
Wait 30,!HasCall,StateIsActive
if !StateIsActive
  Print Call not answered within 30 seconds
  HookOn
  Stop
EndIf
Print Waiting 2 seconds before playing wave file
Wait 2
Wave announcement.wav
Print Waiting for wave file is being played
Wait !StateIsActive,WavePlayed
Wait 1
HookOn 


Dies kann man jedoch nicht per Copy&Paste einfügen, da bei aktivem"Wait"-Kommando keine Eingabe möglich ist. Deshalb kann man ein Script in eine Datei speichern (Beispiel: script.txt") und dieses per
Code
Select All
load script.txt 

laden und ausführen.
Alternativ kann man das alles auch in eine Zeile schreiben, dann geht das auch per Copy&Paste, aber es sieht nicht mehr einfach lesbar aus:
Code
Select All
If HasCall & Print Stop script due existing other call & Stop & EndIf & SetNumber 0123456789 & HookOff & Wait 5,HasCall & If !HasCall & Print Stop script due no call could be created & HookOn & Stop & EndIf & Print Waiting for call is beeing answered within 30 seconds & Wait 30,!HasCall,StateIsActive & if !StateIsActive & Print Call not answered within 30 seconds & HookOn & Stop & EndIf & Print Waiting 2 seconds before playing wave file & Wait 2 & Wave announcement.wav & Print Waiting for wave file is being played & Wait !StateIsActive,WavePlayed & Wait 1 & HookOn 

  
Back to top
WWW  
IP Logged
 
koyaanisqatsi
YaBB Newbies
*
Offline


Phoner is great!

Posts: 11
Joined: 10. Aug 2019
Re: Einfache Script-Fähigkeit per CLI
Reply #1 - 12. Apr 2022 at 22:30
Print Post  
Moinsen


Da ich selbst gern skripte...
Super!  - Dankeschön!
Aber Eines interessiert mich noch, HasCall wird oben benutzt und kann erweitert werden mit !HasCall,StateIsActive ( Not HasCall,StateIsActive ).
OK, aber schön wäre eine komplette Dokumentation.
Vielleicht gibt es ja auch IsRegistered.
...nur weiss ich davon nichts  Wink
  
Back to top
 
IP Logged
 
Phoner Admin
YaBB Administrator
*****
Offline



Posts: 11389
Location: Germany
Joined: 12. Oct 2003
Gender: Male
Re: Einfache Script-Fähigkeit per CLI
Reply #2 - 13. Apr 2022 at 10:10
Print Post  
Ich entwickle PhonerLite für meinen persönlichen Bedarf aus Spaß am Programmieren. Eine Dokumentation zu erstellen ist nicht so mein Ding  Wink
In der aktuellen Beta-Version kann man nun auch "Help Wait" eingeben und es kommt etwas dazu:
Code
Select All
  Wait condition   wait for condition(s)

  condition = 1*(seconds / call / state / direction / wave / digit / ",")
  num       = ("1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" / "0")
  seconds   = 1*num
  call      = [!]"HasCall"
  state     = ([!]"StateIsConn" / "State=Conn" / "State!=Conn" /
               [!]"StateIsRing" / "State=Ring" / "State!=Ring" /
               [!]"StateIsActive" / "State=Active" / "State!=Active" /
               [!]"StateIsDisc" / "State=Disc" / "State!=Disc")
  direction = ([!]"IsIncoming" / [!]"IsOutgoing")
  wave      = "WavePlayed"
  digit     = ("DigitIs"num / "Digit="num)

Example - Wait until a call is available, but not longer than 30 seconds:
Wait 30,HasCall 

  
Back to top
WWW  
IP Logged
 
Phoner Admin
YaBB Administrator
*****
Offline



Posts: 11389
Location: Germany
Joined: 12. Oct 2003
Gender: Male
Re: Einfache Script-Fähigkeit per CLI
Reply #3 - 11. May 2022 at 11:00
Print Post  
In der Version 3.04Beta ist nun Text-To-Speach (TTS) hinzugekommen. Es gibt 2 neue Kommandos: TTS und Say.
Man kann per "Wait wavePlayed" auf das Ende der Wiedergabe des Say-Kommandos warten.
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint