Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
service.php
1
<?php
9
namespace
Bitrix\Sender\Integration\VoxImplant
;
10
11
use
Bitrix\Main\Loader
;
12
use
Bitrix\Sender\PostingManager
;
13
18
class
Service
19
{
25
public
static
function
canUse
()
26
{
27
if
(!
Loader::includeModule
(
'voximplant'
))
28
{
29
return
false
;
30
}
31
else
32
{
33
return
true
;
34
}
35
}
36
48
public
static
function
send
($outputNumber, $number, $text, $voiceLanguage =
''
, $voiceSpeed =
''
, $voiceVolume =
''
)
49
{
50
if
(!static::canUse())
51
{
52
return
false
;
53
}
54
55
$result = \CVoxImplantOutgoing::StartInfoCallWithText(
56
$outputNumber,
57
$number,
58
$text,
59
$voiceLanguage,
60
$voiceSpeed,
61
$voiceVolume
62
);
63
64
$data = $result->getData();
65
if
(!is_array($data) || !isset($data[
'CALL_ID'
]))
66
{
67
return
null
;
68
}
69
70
return
$data[
'CALL_ID'
];
71
}
72
81
public
static
function
sendFile
($outputNumber, $number, $fileUrl)
82
{
83
if
(!static::canUse())
84
{
85
return
false
;
86
}
87
88
$result = \CVoxImplantOutgoing::StartInfoCallWithSound(
89
$outputNumber,
90
$number,
91
$fileUrl
92
);
93
94
$data = $result->getData();
95
if
(!is_array($data) || !isset($data[
'CALL_ID'
]))
96
{
97
return
null
;
98
}
99
100
return
$data[
'CALL_ID'
];
101
}
102
109
public
static
function
onInfoCallResult
($callId, $callData)
110
{
111
if
(!is_array($callData))
112
{
113
$callData = array();
114
}
115
116
$recipientId = CallLogTable::getRecipientIdByCallId($callId);
117
if
($recipientId && isset($callData[
'RESULT'
]) && $callData[
'RESULT'
])
118
{
119
PostingManager::read($recipientId);
120
}
121
122
CallLogTable::removeByCallId($callId);
123
}
124
125
public
static
function
getFormattedOutputNumber
($value)
126
{
127
static
$lines;
128
if
(
null
=== $lines)
129
{
130
if
(static::canUse())
131
{
132
$lines = \CVoxImplantConfig::GetPortalNumbers(
false
);
133
}
134
else
135
{
136
$lines = [];
137
}
138
}
139
140
return
$lines[$value] ?: $value;
141
}
142
}
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Definition
loader.php:69
Bitrix\Sender\Integration\Bitrix24\Service
Definition
service.php:30
Bitrix\Sender\Integration\VoxImplant\Service\onInfoCallResult
static onInfoCallResult($callId, $callData)
Definition
service.php:109
Bitrix\Sender\Integration\VoxImplant\Service\send
static send($outputNumber, $number, $text, $voiceLanguage='', $voiceSpeed='', $voiceVolume='')
Definition
service.php:48
Bitrix\Sender\Integration\VoxImplant\Service\canUse
static canUse()
Definition
service.php:25
Bitrix\Sender\Integration\VoxImplant\Service\sendFile
static sendFile($outputNumber, $number, $fileUrl)
Definition
service.php:81
Bitrix\Sender\Integration\VoxImplant\Service\getFormattedOutputNumber
static getFormattedOutputNumber($value)
Definition
service.php:125
Bitrix\Sender\PostingManager
Definition
postingmanager.php:28
Bitrix\Sender\Integration\VoxImplant
Definition
audio.php:9
modules
sender
lib
integration
voximplant
service.php
Создано системой
1.10.0