parse sapi and cr-bit
[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 INFORMATION = "\x7B";
15
16     /**
17      * Message type, see the class constants
18      * @var integer
19      */
20     public $type;
21
22     /**
23      * Call reference number to distinguish concurrent calls
24      *
25      * @var integer
26      */
27     public $callRef;
28
29     /**
30      * Service AccessPoint Identifier
31      */
32     public $sapi;
33
34     /**
35      * Call/Response bit
36      *
37      * Is 1 when the message contains a command or
38      * the answer to a command.
39      */
40     public $callResponse;
41
42     /**
43      * Terminal Endpoint Identifier (internal Telephone ID)
44      *
45      * @var integer
46      */
47     public $tei;
48
49     /**
50      * Array of EDSS1_Parameter objects
51      *
52      * @var array
53      */
54     public $parameters = array();
55
56
57     public function getTypeName()
58     {
59         $rc = new \ReflectionClass($this);
60         foreach ($rc->getConstants() as $name => $value) {
61             if (ord($value) == $this->type) {
62                 return $name;
63             }
64         }
65         return '';
66     }
67 }
68
69 ?>