« blib/lib/SignalWire/REST/Namespaces/PubSub.pm
↑ Summary
blib/lib/SignalWire/REST/PhoneCallHandler.pm »
| 1 | package SignalWire::Relay::Event; | ||||||||||||
| 2 | 5 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 5 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | # Base event class -- all relay events inherit from this. | ||||||||||||
| 7 | 0 | ▶ | has 'event_type' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||
| 8 | 103 | ▶ | has 'timestamp' => ( is => 'ro', default => sub { 0 } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 0 | ▶ | has 'params' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||
| 10 | |||||||||||||
| 11 | # --- Subclasses for each event type --- | ||||||||||||
| 12 | |||||||||||||
| 13 | # Call state change: created, ringing, answered, ending, ended | ||||||||||||
| 14 | package SignalWire::Relay::Event::CallState; | ||||||||||||
| 15 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 17 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 18 | 16 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 19 | 17 | ▶ | has 'tag' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 20 | 2 | ▶ | has 'call_state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 18 | ▶ | has 'device' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 18 | ▶ | has 'end_reason' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 23 | 20 | ▶ | has 'peer' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 24 | |||||||||||||
| 25 | # Inbound call offer | ||||||||||||
| 26 | package SignalWire::Relay::Event::CallReceive; | ||||||||||||
| 27 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 28 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 29 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 30 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 31 | 5 | ▶ | has 'tag' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 32 | 3 | ▶ | has 'call_state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 33 | 3 | ▶ | has 'device' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 34 | 2 | ▶ | has 'context' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 35 | |||||||||||||
| 36 | # Dial completion | ||||||||||||
| 37 | package SignalWire::Relay::Event::CallDial; | ||||||||||||
| 38 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 39 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 40 | 2 | ▶ | has 'tag' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 41 | 8 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 42 | 2 | ▶ | has 'dial_state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 43 | 4 | ▶ | has 'call' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 44 | |||||||||||||
| 45 | # Connect state | ||||||||||||
| 46 | package SignalWire::Relay::Event::CallConnect; | ||||||||||||
| 47 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 48 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 49 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 50 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 51 | 2 | ▶ | has 'connect_state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 52 | 2 | ▶ | has 'peer' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 53 | |||||||||||||
| 54 | # Disconnect state | ||||||||||||
| 55 | package SignalWire::Relay::Event::CallDisconnect; | ||||||||||||
| 56 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 57 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 58 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 59 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 60 | |||||||||||||
| 61 | # Play state | ||||||||||||
| 62 | package SignalWire::Relay::Event::CallPlay; | ||||||||||||
| 63 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 64 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 65 | 3 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 66 | 5 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 67 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 68 | 2 | ▶ | has 'state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 69 | |||||||||||||
| 70 | # Record state | ||||||||||||
| 71 | package SignalWire::Relay::Event::CallRecord; | ||||||||||||
| 72 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 73 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 74 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 75 | 4 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 76 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 77 | 2 | ▶ | has 'state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 78 | 2 | ▶ | has 'url' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 79 | 2 | ▶ | has 'duration' => ( is => 'ro', default => sub { 0 } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 80 | 2 | ▶ | has 'size' => ( is => 'ro', default => sub { 0 } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 81 | 4 | ▶ | has 'record' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 82 | |||||||||||||
| 83 | # Collect result | ||||||||||||
| 84 | package SignalWire::Relay::Event::CallCollect; | ||||||||||||
| 85 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 86 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 87 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 88 | 4 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 89 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 90 | 2 | ▶ | has 'result' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 91 | |||||||||||||
| 92 | # Detect result | ||||||||||||
| 93 | package SignalWire::Relay::Event::CallDetect; | ||||||||||||
| 94 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 95 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 96 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 97 | 4 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 98 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 99 | 2 | ▶ | has 'detect' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 100 | |||||||||||||
| 101 | # Fax state (send_fax / receive_fax) | ||||||||||||
| 102 | package SignalWire::Relay::Event::CallFax; | ||||||||||||
| 103 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 104 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 105 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 106 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 107 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 108 | 2 | ▶ | has 'fax' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 109 | |||||||||||||
| 110 | # Tap state | ||||||||||||
| 111 | package SignalWire::Relay::Event::CallTap; | ||||||||||||
| 112 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 113 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 114 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 115 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 116 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 117 | 2 | ▶ | has 'state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 118 | 2 | ▶ | has 'tap' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 119 | |||||||||||||
| 120 | # Stream state | ||||||||||||
| 121 | package SignalWire::Relay::Event::CallStream; | ||||||||||||
| 122 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 123 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 124 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 125 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 126 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 127 | 2 | ▶ | has 'state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 128 | |||||||||||||
| 129 | # Transcribe state | ||||||||||||
| 130 | package SignalWire::Relay::Event::CallTranscribe; | ||||||||||||
| 131 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 132 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 133 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 134 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 135 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 136 | 2 | ▶ | has 'state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 137 | |||||||||||||
| 138 | # Pay state | ||||||||||||
| 139 | package SignalWire::Relay::Event::CallPay; | ||||||||||||
| 140 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 141 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 142 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 143 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 144 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 145 | 2 | ▶ | has 'state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 146 | 2 | ▶ | has 'result' => ( is => 'ro', default => sub { {} } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 147 | |||||||||||||
| 148 | # Send digits event | ||||||||||||
| 149 | package SignalWire::Relay::Event::CallSendDigits; | ||||||||||||
| 150 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 151 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 152 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 153 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 154 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 155 | 2 | ▶ | has 'state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 156 | |||||||||||||
| 157 | # SIP REFER event | ||||||||||||
| 158 | package SignalWire::Relay::Event::CallRefer; | ||||||||||||
| 159 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 160 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 161 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 162 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 163 | 2 | ▶ | has 'refer_state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 164 | |||||||||||||
| 165 | # Conference event | ||||||||||||
| 166 | package SignalWire::Relay::Event::Conference; | ||||||||||||
| 167 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 168 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 169 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 170 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 171 | 2 | ▶ | has 'conference_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 172 | |||||||||||||
| 173 | # AI event | ||||||||||||
| 174 | package SignalWire::Relay::Event::CallAI; | ||||||||||||
| 175 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 176 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 177 | 2 | ▶ | has 'call_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 178 | 2 | ▶ | has 'node_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 179 | 2 | ▶ | has 'control_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 180 | |||||||||||||
| 181 | # Inbound message | ||||||||||||
| 182 | package SignalWire::Relay::Event::MessageReceive; | ||||||||||||
| 183 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 184 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 185 | 2 | ▶ | has 'message_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 186 | 4 | ▶ | has 'context' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 187 | 4 | ▶ | has 'direction' => ( is => 'ro', default => sub { 'inbound' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 188 | 2 | ▶ | has 'from_number' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 189 | 2 | ▶ | has 'to_number' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 190 | 2 | ▶ | has 'body' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 191 | 5 | ▶ | has 'media' => ( is => 'ro', default => sub { [] } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 192 | 5 | ▶ | has 'segments' => ( is => 'ro', default => sub { 0 } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 193 | 5 | ▶ | has 'message_state' => ( is => 'ro', default => sub { 'received' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 194 | 6 | ▶ | has 'tags' => ( is => 'ro', default => sub { [] } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 195 | |||||||||||||
| 196 | # Outbound message state change | ||||||||||||
| 197 | package SignalWire::Relay::Event::MessageState; | ||||||||||||
| 198 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 199 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 200 | 2 | ▶ | has 'message_id' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 201 | 13 | ▶ | has 'context' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 202 | 11 | ▶ | has 'direction' => ( is => 'ro', default => sub { 'outbound' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 203 | 12 | ▶ | has 'from_number' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 204 | 12 | ▶ | has 'to_number' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 205 | 13 | ▶ | has 'body' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 206 | 13 | ▶ | has 'media' => ( is => 'ro', default => sub { [] } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 207 | 13 | ▶ | has 'segments' => ( is => 'ro', default => sub { 0 } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 208 | 2 | ▶ | has 'message_state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 209 | 13 | ▶ | has 'reason' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 210 | 13 | ▶ | has 'tags' => ( is => 'ro', default => sub { [] } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 211 | |||||||||||||
| 212 | # Authorization state | ||||||||||||
| 213 | package SignalWire::Relay::Event::AuthorizationState; | ||||||||||||
| 214 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 215 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 216 | 2 | ▶ | has 'authorization_state' => ( is => 'ro', default => sub { '' } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 217 | |||||||||||||
| 218 | # Server disconnect | ||||||||||||
| 219 | package SignalWire::Relay::Event::Disconnect; | ||||||||||||
| 220 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 221 | 5 | extends 'SignalWire::Relay::Event'; | |||||||||||
| 222 | 2 | ▶ | has 'restart' => ( is => 'ro', default => sub { 0 } ); | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 223 | |||||||||||||
| 224 | # --- Factory method --- | ||||||||||||
| 225 | package SignalWire::Relay::Event; | ||||||||||||
| 226 | |||||||||||||
| 227 | # Map event_type string to class name | ||||||||||||
| 228 | 5 | my %EVENT_CLASS_MAP = ( | |||||||||||
| 229 | 'calling.call.state' => 'SignalWire::Relay::Event::CallState', | ||||||||||||
| 230 | 'calling.call.receive' => 'SignalWire::Relay::Event::CallReceive', | ||||||||||||
| 231 | 'calling.call.dial' => 'SignalWire::Relay::Event::CallDial', | ||||||||||||
| 232 | 'calling.call.connect' => 'SignalWire::Relay::Event::CallConnect', | ||||||||||||
| 233 | 'calling.call.disconnect' => 'SignalWire::Relay::Event::CallDisconnect', | ||||||||||||
| 234 | 'calling.call.play' => 'SignalWire::Relay::Event::CallPlay', | ||||||||||||
| 235 | 'calling.call.record' => 'SignalWire::Relay::Event::CallRecord', | ||||||||||||
| 236 | 'calling.call.collect' => 'SignalWire::Relay::Event::CallCollect', | ||||||||||||
| 237 | 'calling.call.detect' => 'SignalWire::Relay::Event::CallDetect', | ||||||||||||
| 238 | 'calling.call.fax' => 'SignalWire::Relay::Event::CallFax', | ||||||||||||
| 239 | 'calling.call.tap' => 'SignalWire::Relay::Event::CallTap', | ||||||||||||
| 240 | 'calling.call.stream' => 'SignalWire::Relay::Event::CallStream', | ||||||||||||
| 241 | 'calling.call.transcribe' => 'SignalWire::Relay::Event::CallTranscribe', | ||||||||||||
| 242 | 'calling.call.pay' => 'SignalWire::Relay::Event::CallPay', | ||||||||||||
| 243 | 'calling.call.send_digits' => 'SignalWire::Relay::Event::CallSendDigits', | ||||||||||||
| 244 | 'calling.call.refer' => 'SignalWire::Relay::Event::CallRefer', | ||||||||||||
| 245 | 'calling.conference' => 'SignalWire::Relay::Event::Conference', | ||||||||||||
| 246 | 'calling.call.ai' => 'SignalWire::Relay::Event::CallAI', | ||||||||||||
| 247 | 'messaging.receive' => 'SignalWire::Relay::Event::MessageReceive', | ||||||||||||
| 248 | 'messaging.state' => 'SignalWire::Relay::Event::MessageState', | ||||||||||||
| 249 | 'signalwire.authorization.state' => 'SignalWire::Relay::Event::AuthorizationState', | ||||||||||||
| 250 | 'signalwire.disconnect' => 'SignalWire::Relay::Event::Disconnect', | ||||||||||||
| 251 | ); | ||||||||||||
| 252 | |||||||||||||
| 253 | 103 | ▶ | sub parse_event { | ||||||||||
|
Subroutine
parse_event: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||
| 254 | 103 | my ($class_or_self, $event_type, $params) = @_; | |||||||||||
| 255 | 103 | ▶ | $params //= {}; | ||||||||||
|
Condition50%1/2
$params //= {}
MC/DC0%0/1
$params //= {}
$params
Truth table50%1/2
A
A= $params
| |||||||||||||
| 256 | |||||||||||||
| 257 | 103 | my $event_class = $EVENT_CLASS_MAP{$event_type}; | |||||||||||
| 258 | 103 | ▶ | unless ($event_class) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 259 | # Return base event for unknown types | ||||||||||||
| 260 | 2 | return SignalWire::Relay::Event->new( | |||||||||||
| 261 | event_type => $event_type, | ||||||||||||
| 262 | params => $params, | ||||||||||||
| 263 | ); | ||||||||||||
| 264 | } | ||||||||||||
| 265 | |||||||||||||
| 266 | # Build constructor args from event params | ||||||||||||
| 267 | 101 | my %args = ( | |||||||||||
| 268 | event_type => $event_type, | ||||||||||||
| 269 | params => $params, | ||||||||||||
| 270 | ); | ||||||||||||
| 271 | |||||||||||||
| 272 | # Copy known fields from params into top-level attributes | ||||||||||||
| 273 | 101 | for my $key (keys %$params) { | |||||||||||
| 274 | # Moo will silently ignore unknown attrs, so we just pass everything | ||||||||||||
| 275 | 166 | $args{$key} = $params->{$key}; | |||||||||||
| 276 | } | ||||||||||||
| 277 | |||||||||||||
| 278 | 101 | return $event_class->new(%args); | |||||||||||
| 279 | } | ||||||||||||
| 280 | |||||||||||||
| 281 | 5 | 1; | |||||||||||