-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCreateByoPhoneNumberDto.php
More file actions
148 lines (134 loc) · 5.31 KB
/
Copy pathCreateByoPhoneNumberDto.php
File metadata and controls
148 lines (134 loc) · 5.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
namespace Vapi\Types;
use Vapi\Core\Json\JsonSerializableType;
use Vapi\Core\Json\JsonProperty;
use Vapi\Core\Types\ArrayType;
class CreateByoPhoneNumberDto extends JsonSerializableType
{
/**
* This is the fallback destination an inbound call will be transferred to if:
* 1. `assistantId` is not set
* 2. `squadId` is not set
* 3. and, `assistant-request` message to the `serverUrl` fails
*
* If this is not set and above conditions are met, the inbound call is hung up with an error message.
*
* @var ?CreateByoPhoneNumberDtoFallbackDestination $fallbackDestination
*/
#[JsonProperty('fallbackDestination')]
public ?CreateByoPhoneNumberDtoFallbackDestination $fallbackDestination;
/**
* @var ?array<CreateByoPhoneNumberDtoHooksItem> $hooks This is the hooks that will be used for incoming calls to this phone number.
*/
#[JsonProperty('hooks'), ArrayType([CreateByoPhoneNumberDtoHooksItem::class])]
public ?array $hooks;
/**
* This is the flag to toggle the E164 check for the `number` field. This is an advanced property which should be used if you know your use case requires it.
*
* Use cases:
* - `false`: To allow non-E164 numbers like `+001234567890`, `1234`, or `abc`. This is useful for dialing out to non-E164 numbers on your SIP trunks.
* - `true` (default): To allow only E164 numbers like `+14155551234`. This is standard for PSTN calls.
*
* If `false`, the `number` is still required to only contain alphanumeric characters (regex: `/^\+?[a-zA-Z0-9]+$/`).
*
* @default true (E164 check is enabled)
*
* @var ?bool $numberE164CheckEnabled
*/
#[JsonProperty('numberE164CheckEnabled')]
public ?bool $numberE164CheckEnabled;
/**
* @var ?string $number This is the number of the customer.
*/
#[JsonProperty('number')]
public ?string $number;
/**
* This is the credential of your own SIP trunk or Carrier (type `byo-sip-trunk`) which can be used to make calls to this phone number.
*
* You can add the SIP trunk or Carrier credential in the Provider Credentials page on the Dashboard to get the credentialId.
*
* @var ?string $credentialId
*/
#[JsonProperty('credentialId')]
public ?string $credentialId;
/**
* @var ?string $name This is the name of the phone number. This is just for your own reference.
*/
#[JsonProperty('name')]
public ?string $name;
/**
* This is the assistant that will be used for incoming calls to this phone number.
*
* If neither `assistantId`, `squadId` nor `workflowId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
*
* @var ?string $assistantId
*/
#[JsonProperty('assistantId')]
public ?string $assistantId;
/**
* This is the workflow that will be used for incoming calls to this phone number.
*
* If neither `assistantId`, `squadId`, nor `workflowId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
*
* @var ?string $workflowId
*/
#[JsonProperty('workflowId')]
public ?string $workflowId;
/**
* This is the squad that will be used for incoming calls to this phone number.
*
* If neither `assistantId`, `squadId`, nor `workflowId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
*
* @var ?string $squadId
*/
#[JsonProperty('squadId')]
public ?string $squadId;
/**
* This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema.
*
* The order of precedence is:
*
* 1. assistant.server
* 2. phoneNumber.server
* 3. org.server
*
* @var ?Server $server
*/
#[JsonProperty('server')]
public ?Server $server;
/**
* @param array{
* credentialId?: ?string,
* fallbackDestination?: ?CreateByoPhoneNumberDtoFallbackDestination,
* hooks?: ?array<CreateByoPhoneNumberDtoHooksItem>,
* numberE164CheckEnabled?: ?bool,
* number?: ?string,
* name?: ?string,
* assistantId?: ?string,
* workflowId?: ?string,
* squadId?: ?string,
* server?: ?Server,
* } $values
*/
public function __construct(
array $values,
) {
$this->fallbackDestination = $values['fallbackDestination'] ?? null;
$this->hooks = $values['hooks'] ?? null;
$this->numberE164CheckEnabled = $values['numberE164CheckEnabled'] ?? null;
$this->number = $values['number'] ?? null;
$this->credentialId = $values['credentialId'] ?? null;
$this->name = $values['name'] ?? null;
$this->assistantId = $values['assistantId'] ?? null;
$this->workflowId = $values['workflowId'] ?? null;
$this->squadId = $values['squadId'] ?? null;
$this->server = $values['server'] ?? null;
}
/**
* @return string
*/
public function __toString(): string
{
return $this->toJson();
}
}