Skip to content

Commit 31f9c59

Browse files
committed
updating examples
1 parent af5bb6a commit 31f9c59

File tree

10 files changed

+6
-80
lines changed

10 files changed

+6
-80
lines changed

doc/examples/mock/MyPAGIApplication.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
<?php
2-
require_once 'PAGI/Autoloader/Autoloader.php';
3-
PAGI\Autoloader\Autoloader::register();
4-
require_once __DIR__ . '/../quickstart/MyPAGIApplication.php';
5-
62
$variables = array(
73
'request' => 'request.php',
84
'channel' => 'SIP/blah-00803890',
@@ -27,7 +23,6 @@
2723
);
2824

2925
$mock = new PAGI\Client\Impl\MockedClientImpl(array(
30-
'log4php.properties' => __DIR__ . '/../quickstart/log4php.properties',
3126
'variables' => $variables
3227
));
3328
$mock

doc/examples/mock/mocktest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<?php
2-
date_default_timezone_set('America/Buenos_Aires');
3-
require_once 'PAGI/Autoloader/Autoloader.php';
4-
PAGI\Autoloader\Autoloader::register();
52
$variables = array(
63
'request' => 'request.php',
74
'channel' => 'SIP/blah-00803890',

doc/examples/node/example.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,5 @@ public function shutdown()
6868
{
6969
$this->asteriskLogger->notice('Shutdown');
7070
}
71-
72-
public function setLogger(\Logger $logger)
73-
{
74-
$this->logger = $logger;
75-
}
7671
}
7772

doc/examples/node/run.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,13 @@
33
declare(ticks=1);
44

55
date_default_timezone_set('America/Buenos_Aires');
6-
define('ROOT_PATH', realpath(__DIR__ . '/../../..'));
7-
ini_set('include_path', implode(PATH_SEPARATOR, array(
8-
ROOT_PATH . '/src/mg',
9-
ROOT_PATH . '/vendor/php/log4php',
10-
ini_get('include_path')
11-
)));
12-
require_once ROOT_PATH . '/src/mg/PAGI/Autoloader/Autoloader.php';
13-
PAGI\Autoloader\Autoloader::register();
146

157
require_once __DIR__ . '/example.php';
168

179
use PAGI\Client\Impl\ClientImpl as PagiClient;
1810

1911
// Go, go, gooo!
20-
$pagiClientOptions = array(
21-
'log4php.properties' => ROOT_PATH . '/resources/log4php.properties',
22-
);
12+
$pagiClientOptions = array();
2313
$pagiClient = PagiClient::getInstance($pagiClientOptions);
2414
$pagiAppOptions = array(
2515
'pagiClient' => $pagiClient,

doc/examples/node/test_example.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
<?php
22
date_default_timezone_set('America/Buenos_Aires');
3-
define('ROOT_PATH', realpath(__DIR__ . '/../../..'));
4-
ini_set('include_path', implode(PATH_SEPARATOR, array(
5-
ROOT_PATH . '/src/mg',
6-
ROOT_PATH . '/vendor/php/log4php',
7-
ini_get('include_path')
8-
)));
9-
require_once ROOT_PATH . '/src/mg/PAGI/Autoloader/Autoloader.php';
10-
PAGI\Autoloader\Autoloader::register();
11-
123
require_once __DIR__ . '/example.php';
134

145
use PAGI\Client\Impl\ClientImpl as PagiClient;
156
use PAGI\Node\Node;
167

178
// Go, go, gooo!
18-
$pagiClientOptions = array(
19-
'log4php.properties' => ROOT_PATH . '/resources/log4php.properties',
20-
);
9+
$pagiClientOptions = array();
2110
$pagiClient = new \PAGI\Client\Impl\MockedClientImpl($pagiClientOptions);
2211
$pagiAppOptions = array(
2312
'pagiClient' => $pagiClient,

doc/examples/nodecontroller/example.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,5 @@ public function shutdown()
360360
{
361361
$this->asteriskLogger->notice('Shutdown');
362362
}
363-
364-
public function setLogger(\Logger $logger)
365-
{
366-
$this->logger = $logger;
367-
}
368363
}
369364

doc/examples/nodecontroller/run.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,12 @@
33
declare(ticks=1);
44

55
date_default_timezone_set('America/Buenos_Aires');
6-
define('ROOT_PATH', realpath(__DIR__ . '/../../..'));
7-
ini_set('include_path', implode(PATH_SEPARATOR, array(
8-
ROOT_PATH . '/src/mg',
9-
ROOT_PATH . '/vendor/php/log4php',
10-
ini_get('include_path')
11-
)));
12-
require_once ROOT_PATH . '/src/mg/PAGI/Autoloader/Autoloader.php';
13-
PAGI\Autoloader\Autoloader::register();
14-
156
require_once __DIR__ . '/example.php';
167

178
use PAGI\Client\Impl\ClientImpl as PagiClient;
189

1910
// Go, go, gooo!
20-
$pagiClientOptions = array(
21-
'log4php.properties' => ROOT_PATH . '/resources/log4php.properties',
22-
);
11+
$pagiClientOptions = array();
2312
$pagiClient = PagiClient::getInstance($pagiClientOptions);
2413
$pagiAppOptions = array(
2514
'pagiClient' => $pagiClient,

doc/examples/quickstart/MyPAGIApplication.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
<?php
2-
define('ROOT_PATH', getenv('root')); // Only used inside log4php.properties
3-
42
/**
53
* PAGI basic use example. Please see run.sh in this same directory for an
64
* example of how to actually run this from your dialplan.
75
*
86
* Note: The client accepts an array with options. The available options are
97
*
10-
* log4php.properties => Optional. If set, should contain the absolute
11-
* path to the log4php.properties file.
12-
*
138
* stdin => Optional. If set, should contain an already open stream from
149
* where the client will read data (useful to make it interact with fastagi
1510
* servers or even text files to mock stuff when testing). If not set, stdin
@@ -54,9 +49,6 @@
5449
*
5550
* Note: The client accepts an array with options. The available options are
5651
*
57-
* log4php.properties => Optional. If set, should contain the absolute
58-
* path to the log4php.properties file.
59-
*
6052
* stdin => Optional. If set, should contain an already open stream from
6153
* where the client will read data (useful to make it interact with fastagi
6254
* servers or even text files to mock stuff when testing). If not set, stdin
@@ -95,9 +87,7 @@ public function init()
9587
public function log($msg)
9688
{
9789
$agi = $this->getAgi();
98-
if ($this->logger->isDebugEnabled()) {
99-
$this->logger->debug($msg);
100-
}
90+
$this->logger->debug($msg);
10191
$agi->consoleLog($msg);
10292
}
10393

doc/examples/quickstart/run.sh

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
################################################################################
33
# Sample application to run from your dialplan.
4-
################################################################################
4+
################################################################################
55
# Get our base directory (the one where this script is located)
66
me=$(dirname ${0})
77
root=${me}/../../..
@@ -10,18 +10,12 @@ export root=`cd ${root}; pwd`
1010
# This is the application that will be run.
1111
export PAGIApplication=MyPAGIApplication
1212

13-
# Location for your log4php.properties
14-
export log4php_properties=${root}/resources/log4php.properties
15-
1613
# Make sure this is in the include path.
1714
export PAGIBootstrap=MyPAGIApplication.php
1815

19-
# Your copy of log4php
20-
log4php=${root}/vendor/php/log4php
21-
2216
# PHP to run and options
2317
php=/usr/php/bin/php
24-
phpoptions="-c ${root}/resources/php.ini -d include_path=${root}/src/mg:${log4php}:${root}/docs/examples/quickstart"
18+
phpoptions="-c ${root}/resources/php.ini -d include_path=${root}/src/mg:${root}/docs/examples/quickstart"
2519

2620
# Standard.. the idea is to have a common launcher.
2721
launcher=${root}/src/mg/PAGI/Application/PAGILauncher.php

doc/examples/quickstart/spooling.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@
1919
* limitations under the License.
2020
*
2121
*/
22-
23-
ini_set('include_path', implode(PATH_SEPARATOR, array(
24-
realpath(__DIR__ .'/../../../src/mg'),
25-
ini_get('include_path')
26-
)));
27-
require_once 'PAGI/Autoloader/Autoloader.php'; // Include PAGI autoloader.
28-
\PAGI\Autoloader\Autoloader::register(); // Call autoloader register for PAGI autoloader.
29-
3022
use PAGI\CallSpool\CallFile;
3123
use PAGI\CallSpool\Impl\CallSpoolImpl;
3224
use PAGI\DialDescriptor\SIPDialDescriptor;

0 commit comments

Comments
 (0)