;INFOS ;$execstring = "http://192.168.178.29/index.htm?number=01771654117" ;parameter = number ip_of_phone user pass ;ip of phone optional ;user and pass optional ; if number = 'auflegen' ; active call (@ip of phone) will be hangup $execstring_noauth = "http://--phone--/index.htm?number=--number--" $execstring_auth = "http://--user--:--pass--@--phone--/index.htm?number=--number--" $execstring_auflegen = "http://--phone--/adr.htm?hangup=auflegen" $execstring_auflegen_auth = "http://--user--:--pass--@--phone--/adr.htm?hangup=auflegen" ; user and pass in phones.txt ;192.168.178.29---user---123 ;192.168.178.29 ;phoneip---user---pass $user = "" $pass = "" $number = "" $auth = False If ($cmdline[0] = 0) Then $ret = InputBox("give phonedata", "number* ip_of_phone user pass (oder 'auflegen'* ip_of_phone user pass)"); If (StringLen($ret) >= 2) Then $exec = @ScriptFullPath & " " & $ret debug($exec) Run($exec); Else $exec = @ScriptFullPath & " auflegen" debug($exec) Run($exec); EndIf Exit $user = "user" $pass = "123" $number = "01771654117" ;testmode Else $phonefound = False; $defaultphone = true $number = $cmdline[1]; if($cmdline[0] > 1) Then ; GET CMDLINE for $x = 2 to $cmdline[0] $thiscmdline = $cmdline[$x] if($thiscmdline = "phone") Then debug("phone parameter") $phone = $cmdline[$x +1] debug($phone) $phonefound = True; $defaultphone = false; if($cmdline[0] >= $x + 3) then $user = $cmdline[$x +2] $pass = $cmdline[$x + 3] $auth = True endif ExitLoop Else $number = $number & $thiscmdline endif Next endif EndIf if(stringleft($number,2) == "49") Then $number = "00" & $number endif If ($defaultphone = True) Then ;debug("use default phone") $phonefile = @scriptdir & "\phones.txt" If (FileExists($phonefile)) Then ;debug("phonefile presend"); $content = FileRead($phonefile) $content = StringReplace($content, @CR, ""); $split = StringSplit($content, @LF) For $x = 1 To $split[0] $line = $split[$x] $subsplit = StringSplit($line,"---",1) if($subsplit[0] > 1) then ;debug("phoneline with ---") $thisphone = $subsplit[1] if($auth = false) Then $user = $subsplit[2] $pass = $subsplit[3] $auth = true; endif Else ;~ debug("phoneline ohne ---") $thisphone = $line; $user = "" $pass = "" $auth = false endif $f = $thisphone; ;~ debug($thisphone); If (Ping($f) > 0) Then $phone = $f $phonefound = True; ExitLoop EndIf Next Else MsgBox(0, 0, "no phonefile found!") ; no phonefile found, no phone given ; failing Exit EndIf EndIf ;~ debug($number) ;~ debug($phone) ;~ debug($user) ;~ debug($pass) If ($phonefound = False) Then MsgBox(0, 0, "no phone found!") Exit Else If ($defaultphone = False) Then If (Ping($phone) <= 0) Then MsgBox(0, 0, "Given phone is offline"); Exit; EndIf EndIf EndIf if($number == 'auflegen') Then Else ; REPLACE $number = StringReplace($number,"callto://","") ; FF callto link $number = StringReplace($number,"callto:","") ; FF callto link $number = StringReplace($number,@cr,"") $number = StringReplace($number,@lf,"") $number = StringReplace($number,@crlf,"") $number = StringReplace($number,"+","00") $number = StringReplace($number,"/","") $number = StringReplace($number,"\","") $number = StringReplace($number,"(0)","") $number = StringReplace($number,"(","") $number = StringReplace($number,")","") $number = StringReplace($number," ","") $number = StringReplace($number,"-","") $number = StringReplace($number,"%20","") ; FF callto link $test = $number $test1 = StringReplace($test,"0","") $test2 = int($test1) if($test1 <> $test2) Then msgbox(0,0,"Die nummer ist nicht numerisch (inkl. + / \ - SPACE) - " & $number) exit endif if(stringlen($number) > 30) Then msgbox(0,0,"Die nummer ist größer als 30 zeichen - " & $number) exit endif endif debug($phone) If ($auth == True) Then $execstring = $execstring_auth; if($number == 'auflegen') then debug("auflegen mit auth"); $execstring = $execstring_auflegen_auth; endif Else $execstring = $execstring_noauth; if($number == 'auflegen') then $execstring = $execstring_auflegen; endif EndIf ; replaces vars $execstring = StringReplace($execstring, "--user--", $user) $execstring = StringReplace($execstring, "--pass--", $pass) $execstring = StringReplace($execstring, "--phone--", $phone) $execstring = StringReplace($execstring, "--number--", $number) debug($execstring) $ret = msgbox(1,"Wirklich wählen?","Dial " & $number & " on " & $phone & "?") if($ret = 1) then $ret = InetGetSize($execstring) if($ret == 0) Then msgbox(0,0,'Error: opened url is 0 byte, may auth wrong?') endif endif Func debug($text) ;MsgBox(0, 0, $text); EndFunc