| 1 | package SignalWire::REST::PhoneCallHandler; | ||
| 2 | 6 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 6 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | # PhoneCallHandler - enum of `call_handler` values accepted by phone_numbers->update. | ||
| 6 | # | ||
| 7 | # Named `PhoneCallHandler` (not `CallHandler`) to stay consistent with the other | ||
| 8 | # SignalWire ports and to avoid colliding with any RELAY client callback type. | ||
| 9 | # | ||
| 10 | # Setting a phone number's `call_handler` + the handler-specific companion | ||
| 11 | # field routes inbound calls and auto-materializes the matching Fabric | ||
| 12 | # resource on the server. See the high-level helpers on | ||
| 13 | # SignalWire::REST::Namespaces::PhoneNumbers. | ||
| 14 | # | ||
| 15 | # Each constant is a plain scalar, so passing the constant directly into | ||
| 16 | # phone_numbers->update(..., call_handler => PhoneCallHandler::RELAY_SCRIPT) | ||
| 17 | # serializes to the wire value without any indirection. | ||
| 18 | # | ||
| 19 | # Constant Wire value Companion field Auto-materializes | ||
| 20 | # -------------------- --------------------- -------------------------- -------------------- | ||
| 21 | # RELAY_SCRIPT relay_script call_relay_script_url swml_webhook | ||
| 22 | # LAML_WEBHOOKS laml_webhooks call_request_url cxml_webhook | ||
| 23 | # LAML_APPLICATION laml_application call_laml_application_id cxml_application | ||
| 24 | # AI_AGENT ai_agent call_ai_agent_id ai_agent | ||
| 25 | # CALL_FLOW call_flow call_flow_id call_flow | ||
| 26 | # RELAY_APPLICATION relay_application call_relay_application relay_application | ||
| 27 | # RELAY_TOPIC relay_topic call_relay_topic (routes via RELAY) | ||
| 28 | # RELAY_CONTEXT relay_context call_relay_context (legacy, prefer topic) | ||
| 29 | # RELAY_CONNECTOR relay_connector (connector config) (internal) | ||
| 30 | # VIDEO_ROOM video_room call_video_room_id (routes to Video API) | ||
| 31 | # DIALOGFLOW dialogflow call_dialogflow_agent_id (none) | ||
| 32 | # | ||
| 33 | # Note: LAML_WEBHOOKS (wire value "laml_webhooks") produces a cXML handler, | ||
| 34 | # not a generic webhook. For SWML, use RELAY_SCRIPT. | ||
| 35 | |||
| 36 | 6 | ▶ | use Exporter 'import'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 37 | |||
| 38 | 6 | ▶ | use constant { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 39 | 6 | RELAY_SCRIPT => 'relay_script', | |
| 40 | LAML_WEBHOOKS => 'laml_webhooks', | ||
| 41 | LAML_APPLICATION => 'laml_application', | ||
| 42 | AI_AGENT => 'ai_agent', | ||
| 43 | CALL_FLOW => 'call_flow', | ||
| 44 | RELAY_APPLICATION => 'relay_application', | ||
| 45 | RELAY_TOPIC => 'relay_topic', | ||
| 46 | RELAY_CONTEXT => 'relay_context', | ||
| 47 | RELAY_CONNECTOR => 'relay_connector', | ||
| 48 | VIDEO_ROOM => 'video_room', | ||
| 49 | DIALOGFLOW => 'dialogflow', | ||
| 50 | 6 | }; | |
| 51 | |||
| 52 | 6 | our @EXPORT_OK = qw( | |
| 53 | RELAY_SCRIPT | ||
| 54 | LAML_WEBHOOKS | ||
| 55 | LAML_APPLICATION | ||
| 56 | AI_AGENT | ||
| 57 | CALL_FLOW | ||
| 58 | RELAY_APPLICATION | ||
| 59 | RELAY_TOPIC | ||
| 60 | RELAY_CONTEXT | ||
| 61 | RELAY_CONNECTOR | ||
| 62 | VIDEO_ROOM | ||
| 63 | DIALOGFLOW | ||
| 64 | ); | ||
| 65 | |||
| 66 | 6 | our %EXPORT_TAGS = ( all => \@EXPORT_OK ); | |
| 67 | |||
| 68 | # values() - return all 11 wire values (authoritative list). | ||
| 69 | 1 | ▶ | sub values { |
|
Subroutine
values: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 70 | return ( | ||
| 71 | 1 | RELAY_SCRIPT, | |
| 72 | LAML_WEBHOOKS, | ||
| 73 | LAML_APPLICATION, | ||
| 74 | AI_AGENT, | ||
| 75 | CALL_FLOW, | ||
| 76 | RELAY_APPLICATION, | ||
| 77 | RELAY_TOPIC, | ||
| 78 | RELAY_CONTEXT, | ||
| 79 | RELAY_CONNECTOR, | ||
| 80 | VIDEO_ROOM, | ||
| 81 | DIALOGFLOW, | ||
| 82 | ); | ||
| 83 | } | ||
| 84 | |||
| 85 | 6 | 1; | |