d49000525e92d3f7dd5ec3d11c0be7bb25573f9f
[auerswald-callnotifier.git] / src / callnotifier / EDSS1 / Message.php
1 <?php
2 namespace callnotifier;
3
4 class EDSS1_Message
5 {
6     const ALERTING = "\x01";
7     const CALL_PROCEEDING = "\x02";
8     const SETUP = "\x05";
9     const CONNECT = "\x07";
10     const SETUP_ACKNOWLEDGE = "\x0D";
11     const DISCONNECT = "\x45";
12     const RELEASE = "\x4D";
13     const RELEASE_COMPLETE = "\x5A";
14     const FACILITY = "\x62";
15     const INFORMATION = "\x7B";
16
17     /**
18      * Message type, see the class constants
19      * @var integer
20      */
21     public $type;
22
23     /**
24      * Call reference number to distinguish concurrent calls
25      *
26      * @var integer
27      */
28     public $callRef;
29
30     /**
31      * Service AccessPoint Identifier
32      *
33      * @var integer
34      */
35     public $sapi;
36
37     /**
38      * Call/Response bit
39      *
40      * Is 1 when the message contains a command to the TE or
41      * the answer to a command from the TE.
42      *
43      * 0 when it it is a request from the TE to the network,
44      * or the answer to a TE request.
45      *
46      * @var integer
47      */
48     public $callResponse;
49
50     /**
51      * Terminal Endpoint Identifier (internal Telephone ID)
52      * TEI=127 means broadcast
53      *
54      * @var integer
55      */
56     public $tei;
57
58     /**
59      * Type of the block
60      * 0 - information block
61      * 1 - control block
62      * @var integer
63      */
64     public $blockType;
65
66     /**
67      * Array of EDSS1_Parameter objects
68      *
69      * @var array
70      */
71     public $parameters = array();
72
73
74     public function getTypeName()
75     {
76         $rc = new \ReflectionClass($this);
77         foreach ($rc->getConstants() as $name => $value) {
78             if (ord($value) == $this->type) {
79                 return $name;
80             }
81         }
82         return '';
83     }
84 }
85
86 ?>