PHP Code Snippets
To use the WebDialer SOAP API, you can implement either of the PHP scripts below depending on how many nodes are in your cluster. If you have one node in the cluster, go to Single Cluster. If you have more than one node in your cluster, go to Multiple Cluster. The scripts will allow the end user to dial a number directly from the application.
WebDialer Version tested: 6.0(1)
Platform: Ubuntu 9.04, extra packages: php5, php-soap
The PHP project provides a simple SOAP handling library that makes it fairly easy to interact with web services. The following code takes some hard-coded credentials and profile info and exercises the WebDialer getProfileSoap and makeCallSoap requests.
Note, this example uses standard a standard HTTP (non-secure) session:
Single Cluster
PHP Request:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php $soap = new SoapClient( "https://10.88.131.131:8443/webdialer/services/WebdialerSoapService?wsdl" , array ( "uri" => "urn:WebdialerSoap" , "trace" =>
1, "exceptions"
=> 1));
$rs = $soap ->getProfileSoap( array ( "userID" => 'dstaudt' , "password" => 'password' ), 'dstaudt' );
print_r( $rs ); // Returns the device info list $rs2 = $soap ->makeCallSoap( array ( "userID" => 'dstaudt' , "password" => 'password' ), '1000' , // Destination number to be called array ( 'user' => 'dstaudt' , 'deviceName' => 'SEP00070EB9C4B4' , 'lineNumber' => '0' ,
'supportEM' =>true, 'locale' => 'English' , 'dontAutoClose' =>true, 'dontShowCallConf' =>true ) );
print_r( $rs2 ); ?> |
PHP Response:
1
2
3
|
stdClass Object ( [description] => Success
[deviceInfoList] => Array ( [0] => stdClass Object ( [deviceName] =>
SEP00070EB9C4B4 [lines] => Array ( [0] => 9876 ; no partition [1] =>
6666 ; no partition ) ) ) [responseCode] => 0 ) stdClass Object (
[responseCode] => 0 [responseDescription]
=> Success ) |
Multiple Cluster
PHP Request:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php $soap = new SoapClient( "https://10.88.131.131:8443/webdialer/services/WebdialerSoapService?wsdl" , array ( "uri" => "urn:WebdialerSoap" , "trace" =>
1, "exceptions"
=> 1));
$rs = $soap ->getProfileSoap( array ( "userID" => 'dstaudt' , "password" => 'password' ), 'dstaudt' );
print_r( $rs ); // Returns the device info list $rs2 = $soap ->makeCallSoap( array ( "userID" => 'dstaudt' , "password" => 'password' ), '1000' , // Destination number to be called array ( 'user' => 'dstaudt' , 'deviceName' => 'SEP00070EB9C4B4' , 'lineNumber' => '0' ,
'supportEM' =>true, 'locale' => 'English' , 'dontAutoClose' =>true, 'dontShowCallConf' =>true ) );
print_r( $rs2 ); ?> |
PHP Response:
1
2
3
|
stdClass Object ( [description] => Success
[deviceInfoList] => Array ( [0] => stdClass Object ( [deviceName] =>
SEP00070EB9C4B4 [lines] => Array ( [0] => 9876 ; no partition [1] =>
6666 ; no partition ) ) ) [responseCode] => 0 ) stdClass Object (
[responseCode] => 0 [responseDescription]
=> Success ) |