This document was generated from CDN thread Created by: Samat Toibazarov on 08-04-2011 10:37:07 AM Hi, We have Tandberg E20. And we've connected to this device via SSH. So we can make calls by putty terminal. But we want to execute "xcommand dial number
num" command in php application. Our php application has executed commands successfully in other ssh servers, When I connect to tandberg it says that it is logged in successfully, but it doesn't execute the ssh command.the result is: logged in. thats all, and phone doesn't make a callLet me show the php code 1
2<?
3
4$id = $_GET ['id'];
5echo $id;
6$host = "192.168.2.145";
7$user = "admin";
8$pass = "TANDBERG";
9
10function exec_ssh ($command){
11 global $con;
12 if (!$stream = ssh2_exec($con, $command)){
13 die ("fuck");
14 }else{
15 stream_set_blocking($stream, true);
16 $data = "";
17 while($o = fgets($stream)){
18 $data .= $o;
19 }
20 fclose($stream);
21 }
22 return $data;
23 }
24 fclose($stream);
25 }
26 return $data;
27}
28
29if (!function_exists("ssh2_connect"))
30 die("function ssh2_connect doesn't exist");
31
32if(!($con = ssh2_connect($host, 22))){
33 echo "unable to connect\n";
34} else {
35 if(!ssh2_auth_password($con, $user, $pass)) {
36 echo "unable to auth\n";
37 } else {
38 echo "logged in!\n";
39 echo exec_ssh ("help");
40 }
41}
42
43echo $data;
44?>