|
|
@@ -2,14 +2,15 @@ package api.service.call.impl;
|
|
2
|
2
|
|
|
3
|
3
|
import api.entity.database.call.Ivr;
|
|
4
|
4
|
import api.entity.input.call.*;
|
|
|
5
|
+
|
|
5
|
6
|
import api.mapper.call.IvrMapper;
|
|
6
|
7
|
import api.service.call.IIvrService;
|
|
7
|
8
|
import api.service.BaseServiceImpl;
|
|
8
|
9
|
import api.service.call.IIvrSqlService;
|
|
9
|
10
|
import api.util.enums.IvrType;
|
|
10
|
|
-import api.util.helper.IpHelper;
|
|
11
|
11
|
import api.util.helper.StringHelper;
|
|
12
|
12
|
import api.util.helper.TtsHelper;
|
|
|
13
|
+
|
|
13
|
14
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
14
|
15
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
15
|
16
|
import lombok.var;
|
|
|
@@ -208,8 +209,7 @@ public class IvrServiceImpl extends BaseServiceImpl<IvrMapper, Ivr> implements I
|
|
208
|
209
|
//获取xml
|
|
209
|
210
|
private StringBuilder getXml( List<IvrProperties> nodes , List<IvrEdges> paths,IvrProperties currNode,List<String> ids,StringBuilder menuXml) {
|
|
210
|
211
|
|
|
211
|
|
- String ip= IpHelper.getIp4();
|
|
212
|
|
- String url ="http://" + ip + ":8120";
|
|
|
212
|
+
|
|
213
|
213
|
boolean isexist = ids.contains(currNode.getId());
|
|
214
|
214
|
if (!isexist) {
|
|
215
|
215
|
ids.add(currNode.getId());
|
|
|
@@ -224,46 +224,46 @@ public class IvrServiceImpl extends BaseServiceImpl<IvrMapper, Ivr> implements I
|
|
224
|
224
|
//放音收号节点
|
|
225
|
225
|
if (currNode.getType().equals(IvrType.audiodtmf)) {
|
|
226
|
226
|
|
|
227
|
|
- StringBuilder mxml = new StringBuilder(" <menu name=\"" + currNode.getProperties().getName()+ currNode.getId() + "\" ");
|
|
228
|
|
- if (Objects.equals(data.get("type").toString(), "audio"))
|
|
229
|
|
- {
|
|
230
|
|
- mxml.append("greet-long").append("=\"").append(data.get("file").toString()).append("\" ");
|
|
231
|
|
- mxml.append("greet-short").append("=\"").append(data.get("greetShortUrl").toString()).append("\" ");
|
|
232
|
|
- mxml.append("invalid-sound").append("=\"").append(data.get("invalidSoundUrl").toString()).append("\" ");
|
|
233
|
|
- mxml.append("exit-sound").append("=\"").append(data.get("xitSoundUrl").toString()).append("\" ");
|
|
|
227
|
+ StringBuilder mxml = new StringBuilder(" <menu name=\"" + currNode.getProperties().getName()+ currNode.getId() + "\" ");
|
|
|
228
|
+ if (Objects.equals(data.get("type").toString(), "audio"))
|
|
|
229
|
+ {
|
|
|
230
|
+ mxml.append("greet-long").append("=\"").append(data.get("file").toString()).append("\" ");
|
|
|
231
|
+ mxml.append("greet-short").append("=\"").append(data.get("greetShortUrl").toString()).append("\" ");
|
|
|
232
|
+ mxml.append("invalid-sound").append("=\"").append(data.get("invalidSoundUrl").toString()).append("\" ");
|
|
|
233
|
+ mxml.append("exit-sound").append("=\"").append(data.get("xitSoundUrl").toString()).append("\" ");
|
|
234
|
234
|
|
|
235
|
|
- }
|
|
236
|
|
- else
|
|
237
|
|
- {
|
|
238
|
|
- mxml.append("greet-long").append("=\"").append(url).append(TtsHelper.TextToSpeech(data.get("content").toString())).append("\" ");
|
|
239
|
|
- mxml.append("greet-short").append("=\"").append(url).append(TtsHelper.TextToSpeech(data.get("greetShort").toString())).append("\" ");
|
|
240
|
|
- mxml.append("invalid-sound").append("=\"").append(url).append(TtsHelper.TextToSpeech(data.get("invalidSound").toString())).append("\" ");
|
|
241
|
|
- mxml.append("exit-sound").append("=\"").append(url).append(TtsHelper.TextToSpeech(data.get("xitSound").toString())).append("\" ");
|
|
|
235
|
+ }
|
|
|
236
|
+ else
|
|
|
237
|
+ {
|
|
|
238
|
+ mxml.append("greet-long").append("=\"").append(TtsHelper.TextToSpeech(data.get("content").toString())).append("\" ");
|
|
|
239
|
+ mxml.append("greet-short").append("=\"").append(TtsHelper.TextToSpeech(data.get("greetShort").toString())).append("\" ");
|
|
|
240
|
+ mxml.append("invalid-sound").append("=\"").append(TtsHelper.TextToSpeech(data.get("invalidSound").toString())).append("\" ");
|
|
|
241
|
+ mxml.append("exit-sound").append("=\"").append(TtsHelper.TextToSpeech(data.get("xitSound").toString())).append("\" ");
|
|
242
|
242
|
|
|
|
243
|
+ }
|
|
|
244
|
+ mxml.append("confirm-macro").append("=\"").append("\" ");
|
|
|
245
|
+ mxml.append("confirm-key").append("=\"").append("\" ");
|
|
|
246
|
+ mxml.append("tts-engine").append("=\"").append("\" ");
|
|
|
247
|
+ mxml.append("tts-voice").append("=\"").append("\" ");
|
|
|
248
|
+ mxml.append("confirm-attempts").append("=\"").append("\" ");
|
|
|
249
|
+ mxml.append("timeout").append("=\"").append(data.get("timeout").toString()).append("\" ");
|
|
|
250
|
+ mxml.append("inter-digit-timeout").append("\" ");
|
|
|
251
|
+ mxml.append("max-failures").append("=\"").append(data.get("maxFailures").toString()).append("\" ");
|
|
|
252
|
+ mxml.append("max-timeouts").append("=\"").append(data.get("maxTimeouts").toString()).append("\" ");
|
|
|
253
|
+ mxml.append("digit-len").append("=\"").append("\" ");
|
|
|
254
|
+
|
|
|
255
|
+ mxml.append(">\n");
|
|
|
256
|
+ for (IvrEdges path : nodePaths) {
|
|
|
257
|
+ IvrProperties toNode = nodes.stream().filter(p -> p.getId().equals(path.getTargetNodeId())).findFirst().get();
|
|
|
258
|
+ if (toNode.getType().equals(IvrType.audiodtmf)) {
|
|
|
259
|
+ mxml.append(" <entry action=\"menu-sub\" digits=\"").append(path.getProperties().getOutParams().getExpression()).append("\" param=\"").append(toNode.getProperties().getName()).append( toNode.getId()).append("\"/>\n");
|
|
|
260
|
+ } else {
|
|
|
261
|
+ mxml.append(" <entry action=\"menu-exec-app\" digits=\"").append(path.getProperties().getOutParams().getExpression()).append("\" param=\"transfer ").append(path.getProperties().getOutParams().getExpression()).append(" XML ").append(toNode.getProperties().getName()).append( toNode.getId()).append("\"/>\n");
|
|
243
|
262
|
}
|
|
244
|
|
- mxml.append("confirm-macro").append("=\"").append("\" ");
|
|
245
|
|
- mxml.append("confirm-key").append("=\"").append("\" ");
|
|
246
|
|
- mxml.append("tts-engine").append("=\"").append("\" ");
|
|
247
|
|
- mxml.append("tts-voice").append("=\"").append("\" ");
|
|
248
|
|
- mxml.append("confirm-attempts").append("=\"").append("\" ");
|
|
249
|
|
- mxml.append("timeout").append("=\"").append(data.get("timeout").toString()).append("\" ");
|
|
250
|
|
- mxml.append("inter-digit-timeout").append("\" ");
|
|
251
|
|
- mxml.append("max-failures").append("=\"").append(data.get("maxFailures").toString()).append("\" ");
|
|
252
|
|
- mxml.append("max-timeouts").append("=\"").append(data.get("maxTimeouts").toString()).append("\" ");
|
|
253
|
|
- mxml.append("digit-len").append("=\"").append("\" ");
|
|
254
|
|
-
|
|
255
|
|
- mxml.append(">\n");
|
|
256
|
|
- for (IvrEdges path : nodePaths) {
|
|
257
|
|
- IvrProperties toNode = nodes.stream().filter(p -> p.getId().equals(path.getTargetNodeId())).findFirst().get();
|
|
258
|
|
- if (toNode.getType().equals(IvrType.audiodtmf)) {
|
|
259
|
|
- mxml.append(" <entry action=\"menu-sub\" digits=\"").append(path.getProperties().getOutParams().getExpression()).append("\" param=\"").append(toNode.getProperties().getName()).append( toNode.getId()).append("\"/>\n");
|
|
260
|
|
- } else {
|
|
261
|
|
- mxml.append(" <entry action=\"menu-exec-app\" digits=\"").append(path.getProperties().getOutParams().getExpression()).append("\" param=\"transfer ").append(path.getProperties().getOutParams().getExpression()).append(" XML ").append(toNode.getProperties().getName()).append( toNode.getId()).append("\"/>\n");
|
|
262
|
|
- }
|
|
263
|
|
- nextXml.append(getXml(nodes,paths, toNode, ids, menuXml));
|
|
264
|
|
- }
|
|
265
|
|
- mxml.append(" </menu>\n");
|
|
266
|
|
- menuXml.append(mxml);
|
|
|
263
|
+ nextXml.append(getXml(nodes,paths, toNode, ids, menuXml));
|
|
|
264
|
+ }
|
|
|
265
|
+ mxml.append(" </menu>\n");
|
|
|
266
|
+ menuXml.append(mxml);
|
|
267
|
267
|
|
|
268
|
268
|
|
|
269
|
269
|
}
|
|
|
@@ -370,14 +370,14 @@ public class IvrServiceImpl extends BaseServiceImpl<IvrMapper, Ivr> implements I
|
|
370
|
370
|
}
|
|
371
|
371
|
break;
|
|
372
|
372
|
case audio:
|
|
373
|
|
- if(Objects.equals(data.get("type").toString(), "audio"))
|
|
374
|
|
- {
|
|
375
|
|
- xml.append(" <action application=\"playback\" data=\"").append(data.get("file").toString()).append("\"/>\n");
|
|
376
|
|
- }
|
|
377
|
|
- else
|
|
378
|
|
- {
|
|
379
|
|
- xml.append(" <action application=\"playback\" data=\"").append(url).append(TtsHelper.TextToSpeech(data.get("content").toString())).append("\"/>\n");
|
|
380
|
|
- }
|
|
|
373
|
+ if(Objects.equals(data.get("type").toString(), "audio"))
|
|
|
374
|
+ {
|
|
|
375
|
+ xml.append(" <action application=\"playback\" data=\"").append(data.get("file").toString()).append("\"/>\n");
|
|
|
376
|
+ }
|
|
|
377
|
+ else
|
|
|
378
|
+ {
|
|
|
379
|
+ xml.append(" <action application=\"playback\" data=\"").append(TtsHelper.TextToSpeech(data.get("content").toString())).append("\"/>\n");
|
|
|
380
|
+ }
|
|
381
|
381
|
break;
|
|
382
|
382
|
case queue:
|
|
383
|
383
|
xml.append(" <action application=\"set\" data=\"hangup_after_bridge=true\"/>\n");
|