Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
service.php
1<?php
10
13
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}
static includeModule($moduleName)
Definition loader.php:69
static onInfoCallResult($callId, $callData)
Definition service.php:109
static send($outputNumber, $number, $text, $voiceLanguage='', $voiceSpeed='', $voiceVolume='')
Definition service.php:48
static sendFile($outputNumber, $number, $fileUrl)
Definition service.php:81