背景
最近使用unimrcp
对接了好几家厂商的asr
和tts
。
虽然unimrcp
内部有umc
和unimrcpclient
客户端来测试,但是asr
测试是要读音频文件,测试不太方便。所以就想到了使用freeswitch
的mrcp
模块对接unimrcp
,使用软电话直接语音测试。
参考文档:play_and_detect_speech
本次测试的freeswitch版本是:
version: FreeSWITCH Version 1.10.2-release+git20230615T110520Z4ce1b74880~64bit
freeswitch 配置修改
编译mrcp模块
编译文件:build/modules.conf.in
, 放开asr_tts/mod_unimrcp
, 编译mod_unimrcp
库。
打包生成freeswitch
容器。
配置mrcp
新建test-mrcp.xml
路径: conf/mrcp_profiles/
, 里面有一些示例, 可以参考nuance-5.0-mrcp-v2.xml
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
|
<include>
<profile name="test-mrcp" version="2">
<!--param name="client-ext-ip" value="auto"-->
<param name="client-ip" value="auto"/>
<param name="client-port" value="5090"/>
<param name="server-ip" value="172.16.7.206"/>
<param name="server-port" value="8060"/>
<!--param name="force-destination" value="1"/-->
<param name="sip-transport" value="udp"/>
<!--param name="ua-name" value="FreeSWITCH"/-->
<!--param name="sdp-origin" value="FreeSWITCH"/-->
<!--param name="rtp-ext-ip" value="auto"/-->
<param name="rtp-ip" value="auto"/>
<param name="rtp-port-min" value="4000"/>
<param name="rtp-port-max" value="5000"/>
<!-- enable/disable rtcp support -->
<param name="rtcp" value="1"/>
<!-- rtcp bye policies (rtcp must be enabled first)
0 - disable rtcp bye
1 - send rtcp bye at the end of session
2 - send rtcp bye also at the end of each talkspurt (input)
-->
<param name="rtcp-bye" value="2"/>
<!-- rtcp transmission interval in msec (set 0 to disable) -->
<param name="rtcp-tx-interval" value="5000"/>
<!-- period (timeout) to check for new rtcp messages in msec (set 0 to disable) -->
<param name="rtcp-rx-resolution" value="1000"/>
<!--param name="playout-delay" value="50"/-->
<!--param name="max-playout-delay" value="200"/-->
<!--param name="ptime" value="20"/-->
<param name="codecs" value="PCMU PCMA L16/96/8000"/>
<!-- Add any default MRCP params for SPEAK requests here -->
<synthparams>
</synthparams>
<!-- Add any default MRCP params for RECOGNIZE requests here -->
<recogparams>
<!--param name="start-input-timers" value="false"/-->
</recogparams>
</profile>
</include>
|
这个配置里需要注意的是:
profile name=
, 这个是后续选择mrcp
时的名称。
server-ip=
和server-port
分别填unimrcp
的ip
和port
,port
默认是8060
.
修改unimrcp.conf.xml
路径: conf/autoload_configs/unimrcp.conf.xml
,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<configuration name="unimrcp.conf" description="UniMRCP Client">
<settings>
<!-- UniMRCP profile to use for TTS -->
<param name="default-tts-profile" value="test-mrcp"/>
<!-- UniMRCP profile to use for ASR -->
<param name="default-asr-profile" value="test-mrcp"/>
<!-- UniMRCP logging level to appear in freeswitch.log. Options are:
EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG -->
<param name="log-level" value="DEBUG"/>
<!-- Enable events for profile creation, open, and close -->
<param name="enable-profile-events" value="false"/>
<param name="max-connection-count" value="100"/>
<param name="offer-new-connection" value="1"/>
<param name="request-timeout" value="3000"/>
</settings>
<profiles>
<X-PRE-PROCESS cmd="include" data="../mrcp_profiles/*.xml"/>
</profiles>
</configuration>
|
default-tts-profile
和default-asr-profile
分别填test-mrcp
,其他的配置走默认即可。
配置拨号策略
路径: conf/dialplans/default.xml
, 配置如下:
1
2
3
4
5
6
7
8
|
<extension name="play_and_detect_speech example">
<condition field="destination_number" expression="^5004$">
<action application="set" data="tts_engine=unimrcp"/>
<action application="set" data="tts_voice=donna"/>
<action application="play_and_detect_speech" data="say:please say yes or no.please say something! detect:unimrcp {start-input-timers=false,no-input-timeout=5000,recognition-timeout=5000}builtin:grammar/boolean?language=en-US;y=1;n=2"/>
<action application="log" data="CRIT ${detect_speech_result}"/>
</condition>
</extension>
|
该配置是freeswitch
的play_and_detect_speech
模块的示例。
测试
使用软电话拨打5004
,如果你的tts
支持英语, 会听到please say yes or no.please say something!
。用户说话也能识别出来.
asr
的相关日志:
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
|
EXECUTE [depth=0] sofia/internal/1007@172.16.4.111 play_and_detect_speech(say:please say yes or no.please say something! detect:unimrcp {start-input-timers=false,no-input-timeout=5000,recognition-timeout=5000}builtin:grammar/boolean?language=en-US;y=1;n=2)
2025-05-29 15:13:50.315891 [INFO] mod_unimrcp.c:3134 asr_handle: name = unimrcp, codec = (null), rate = 8000, grammar = (null), param = (null)
2025-05-29 15:13:50.315891 [INFO] mod_unimrcp.c:3136 codec = L16, rate = 8000, dest = (null)
2025-05-29 15:13:50.315891 [DEBUG] mod_unimrcp.c:690 (ASR-1) audio queue created
2025-05-29 15:13:50.315891 [NOTICE] mrcp_application.c:96 (ASR-1) Create MRCP Handle 0x7f1d68012e30 [test-mrcp]
2025-05-29 15:13:50.315891 [INFO] mrcp_client_session.c:133 (ASR-1) Create Channel ASR-1 <new>
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f1d68008d50;4;0]
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f1d68008d50;4;0]
2025-05-29 15:13:50.315891 [INFO] mrcp_client_session.c:387 (ASR-1) Receive App Request ASR-1 <new> [2]
2025-05-29 15:13:50.315891 [INFO] mrcp_client.c:700 (ASR-1) Add MRCP Handle ASR-1 <new>
2025-05-29 15:13:50.315891 [DEBUG] mrcp_client_session.c:1283 (ASR-1) Dispatch App Request ASR-1 <new> [2]
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:265 () Signal Message to [MRCPv2ConnectionAgent] [0x7f1dc4005000;1;0]
2025-05-29 15:13:50.315891 [NOTICE] mrcp_client_session.c:719 (ASR-1) Add Control Channel ASR-1 <new@speechrecog>
2025-05-29 15:13:50.315891 [DEBUG] mrcp_client_session.c:745 (ASR-1) Add Media Termination ASR-1 <new@media-tm>
2025-05-29 15:13:50.315891 [DEBUG] mrcp_client_session.c:777 (ASR-1) Add Media Termination ASR-1 <new@rtp-tm>
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:265 () Signal Message to [MediaEngine] [0x7f1dc4019c40;1;0]
2025-05-29 15:13:50.315891 [DEBUG] apt_consumer_task.c:141 () Wait for Messages [MRCP Client]
2025-05-29 15:13:50.315891 [DEBUG] apt_poller_task.c:261 () Process Poller Wakeup [MRCPv2ConnectionAgent]
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:337 () Process Message [MRCPv2ConnectionAgent] [0x7f1dc4005000;1;0]
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f1dc0000be0;2;0]
2025-05-29 15:13:50.315891 [DEBUG] apt_poller_task.c:251 () Wait for Messages [MRCPv2ConnectionAgent]
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f1dc0000be0;2;0]
2025-05-29 15:13:50.315891 [DEBUG] mrcp_client_session.c:294 (ASR-1) Control Channel Added ASR-1 <new@speechrecog>
2025-05-29 15:13:50.315891 [DEBUG] apt_consumer_task.c:141 () Wait for Messages [MRCP Client]
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:337 () Process Message [MediaEngine] [0x7f1dc4019c40;1;0]
2025-05-29 15:13:50.315891 [DEBUG] mpf_context.c:182 () Add Media Context ASR-1
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f1d60000b60;3;0]
2025-05-29 15:13:50.315891 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f1d60000b60;3;0]
2025-05-29 15:13:50.315891 [DEBUG] mrcp_client_session.c:944 (ASR-1) Media Termination Added ASR-1 <new@media-tm>
2025-05-29 15:13:50.315891 [DEBUG] mrcp_client_session.c:944 (ASR-1) Media Termination Added ASR-1 <new@rtp-tm>
2025-05-29 15:13:50.315891 [INFO] mrcp_client_session.c:411 (ASR-1) Send Offer ASR-1 <new> [c:1 a:1 v:0] to 172.16.7.206:8060
2025-05-29 15:13:50.315891 [INFO] mrcp_sofiasip_client_agent.c:354 (ASR-1) Local SDP ASR-1 <new>
v=0
o=FreeSWITCH 0 0 IN IP4 172.16.4.111
s=-
c=IN IP4 172.16.4.111
t=0 0
m=application 9 TCP/MRCPv2 1
a=setup:active
a=connection:new
a=resource:speechrecog
a=cmid:1
m=audio 4000 RTP/AVP 0 8 96
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 L16/8000
a=sendonly
a=mid:1
2025-05-29 15:13:50.315891 [DEBUG] apt_consumer_task.c:141 () Wait for Messages [MRCP Client]
2025-05-29 15:13:50.315891 [INFO] mrcp_sofiasip_client_agent.c:609 () Receive SIP Event [nua_i_state] Status 0 INVITE sent [test-mrcp]
2025-05-29 15:13:50.315891 [NOTICE] mrcp_sofiasip_client_agent.c:547 (ASR-1) SIP Call State ASR-1 [calling]
2025-05-29 15:13:50.335890 [INFO] mrcp_sofiasip_client_agent.c:609 () Receive SIP Event [nua_r_invite] Status 200 OK [test-mrcp]
2025-05-29 15:13:50.335890 [INFO] mrcp_sofiasip_client_agent.c:609 () Receive SIP Event [nua_i_state] Status 200 OK [test-mrcp]
2025-05-29 15:13:50.335890 [NOTICE] mrcp_sofiasip_client_agent.c:547 (ASR-1) SIP Call State ASR-1 [ready]
2025-05-29 15:13:50.335890 [INFO] mrcp_sofiasip_client_agent.c:433 (ASR-1) Remote SDP ASR-1 <new>
v=0
o=UniMRCPServer 5306294943051381812 5608901609573390734 IN IP4 172.16.7.206
s=-
c=IN IP4 172.16.7.206
t=0 0
m=application 1544 TCP/MRCPv2 1
a=setup:passive
a=connection:new
a=channel:8fe20c9c3c5c11f0@speechrecog
a=cmid:1
m=audio 5074 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=recvonly
a=mid:1
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f1d980015a0;1;0]
2025-05-29 15:13:50.335890 [INFO] mrcp_sofiasip_client_agent.c:609 () Receive SIP Event [nua_i_active] Status 200 Call active [test-mrcp]
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f1d980015a0;1;0]
2025-05-29 15:13:50.335890 [INFO] mrcp_client_session.c:151 (ASR-1) Receive Answer ASR-1 <new> [c:1 a:1 v:0] Status 200
2025-05-29 15:13:50.335890 [DEBUG] mrcp_client_session.c:1141 (ASR-1) Modify Control Channel ASR-1 <8fe20c9c3c5c11f0>
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:265 () Signal Message to [MRCPv2ConnectionAgent] [0x7f1dc4005000;1;0]
2025-05-29 15:13:50.335890 [DEBUG] mrcp_client_session.c:1180 (ASR-1) Modify Media Termination ASR-1 <8fe20c9c3c5c11f0@rtp-tm>
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:265 () Signal Message to [MediaEngine] [0x7f1dc40198c0;1;0]
2025-05-29 15:13:50.335890 [DEBUG] apt_consumer_task.c:141 () Wait for Messages [MRCP Client]
2025-05-29 15:13:50.335890 [DEBUG] apt_poller_task.c:261 () Process Poller Wakeup [MRCPv2ConnectionAgent]
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:337 () Process Message [MRCPv2ConnectionAgent] [0x7f1dc4005000;1;0]
2025-05-29 15:13:50.335890 [NOTICE] mrcp_client_connection.c:338 () Established TCP/MRCPv2 Connection 172.16.4.111:63555 <-> 172.16.7.206:1544
2025-05-29 15:13:50.335890 [INFO] mrcp_client_connection.c:435 (ASR-1) Add Control Channel <8fe20c9c3c5c11f0@speechrecog> 172.16.4.111:63555 <-> 172.16.7.206:1544 [1]
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f1dc0000b80;2;1]
2025-05-29 15:13:50.335890 [DEBUG] apt_poller_task.c:251 () Wait for Messages [MRCPv2ConnectionAgent]
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f1dc0000b80;2;1]
2025-05-29 15:13:50.335890 [DEBUG] mrcp_client_session.c:311 (ASR-1) Control Channel Modified ASR-1 <8fe20c9c3c5c11f0@speechrecog>
2025-05-29 15:13:50.335890 [DEBUG] apt_consumer_task.c:141 () Wait for Messages [MRCP Client]
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:337 () Process Message [MediaEngine] [0x7f1dc40198c0;1;0]
2025-05-29 15:13:50.335890 [INFO] mpf_rtp_stream.c:331 () Enable RTP Session 172.16.4.111:4000
2025-05-29 15:13:50.335890 [DEBUG] mpf_bridge.c:129 () Create Linear Audio Bridge ASR-1
2025-05-29 15:13:50.335890 [INFO] mpf_rtp_stream.c:921 () Open RTP Transmitter 172.16.4.111:4000 -> 172.16.7.206:5074
2025-05-29 15:13:50.335890 [INFO] mpf_bridge.c:93 () Media Path ASR-1 Source->[LPCM/8000/1]->Bridge->[LPCM/8000/1]->Encoder->[PCMU/8000/1]->Sink
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f1d60000ad0;3;0]
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f1d60000ad0;3;0]
2025-05-29 15:13:50.335890 [DEBUG] mrcp_client_session.c:985 (ASR-1) Media Termination Modified ASR-1 <8fe20c9c3c5c11f0@rtp-tm>
2025-05-29 15:13:50.335890 [INFO] mrcp_client_session.c:455 (ASR-1) Raise App Response ASR-1 <8fe20c9c3c5c11f0> [2] SUCCESS [0]
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:1900 (ASR-1) RECOGNIZER channel is ready, codec = LPCM, sample rate = 8000
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:1584 (ASR-1) CLOSED ==> READY
2025-05-29 15:13:50.335890 [DEBUG] apt_consumer_task.c:141 () Wait for Messages [MRCP Client]
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:1062 (ASR-1) channel is ready
2025-05-29 15:13:50.335890 [DEBUG] sofia.c:7301 Channel sofia/internal/1007@172.16.4.111 entering state [early][183]
2025-05-29 15:13:50.335890 [DEBUG] switch_core_media_bug.c:970 Attaching BUG to sofia/internal/1007@172.16.4.111
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:1465 (ASR-1) param = start-input-timers, val = false
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:1465 (ASR-1) param = no-input-timeout, val = 5000
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:1465 (ASR-1) param = recognition-timeout, val = 5000
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:3201 (ASR-1) grammar = builtin:grammar/boolean?language=en-US;y=1;n=2, name =
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:3218 (ASR-1) Grammar is URI
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:3290 (ASR-1) grammar is text/uri-list
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:2361 (ASR-1) Loading grammar 611352e4-73b3-4a1b-a17e-b5a9a4416440, data = builtin:grammar/boolean?language=en-US;y=1;n=2
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:2526 (ASR-1) Disabling all grammars
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:2485 (ASR-1) Enabling grammar 611352e4-73b3-4a1b-a17e-b5a9a4416440
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:2848 (ASR-1) "recognition-timeout": "5000"
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:2848 (ASR-1) "start-input-timers": "false"
2025-05-29 15:13:50.335890 [DEBUG] mod_unimrcp.c:2848 (ASR-1) "no-input-timeout": "5000"
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f1d6801f470;4;0]
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f1d6801f470;4;0]
2025-05-29 15:13:50.335890 [INFO] mrcp_client_session.c:392 (ASR-1) Receive App MRCP Request ASR-1 <8fe20c9c3c5c11f0>
2025-05-29 15:13:50.335890 [INFO] mrcp_client_session.c:622 (ASR-1) Send MRCP Request ASR-1 <8fe20c9c3c5c11f0@speechrecog> [1]
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:265 () Signal Message to [MRCPv2ConnectionAgent] [0x7f1dc4005000;1;0]
2025-05-29 15:13:50.335890 [DEBUG] apt_consumer_task.c:141 () Wait for Messages [MRCP Client]
2025-05-29 15:13:50.335890 [DEBUG] apt_poller_task.c:261 () Process Poller Wakeup [MRCPv2ConnectionAgent]
2025-05-29 15:13:50.335890 [DEBUG] apt_task.c:337 () Process Message [MRCPv2ConnectionAgent] [0x7f1dc4005000;1;0]
2025-05-29 15:13:50.335890 [INFO] mrcp_client_connection.c:530 (ASR-1) Send MRCPv2 Data 172.16.4.111:63555 <-> 172.16.7.206:1544 [275 bytes]
MRCP/2.0 275 RECOGNIZE 1
Channel-Identifier: 8fe20c9c3c5c11f0@speechrecog
Content-Type: text/uri-list
Cancel-If-Queue: false
Recognition-Timeout: 5000
Start-Input-Timers: false
No-Input-Timeout: 5000
Content-Length: 46
builtin:grammar/boolean?language=en-US;y=1;n=2
2025-05-29 15:13:50.335890 [DEBUG] apt_poller_task.c:246 () Wait for Messages [MRCPv2ConnectionAgent] timeout [3000]
2025-05-29 15:13:50.495892 [DEBUG] apt_poller_task.c:269 () Process Signalled Descriptor [MRCPv2ConnectionAgent]
2025-05-29 15:13:50.495892 [INFO] mrcp_client_connection.c:635 () Receive MRCPv2 Data 172.16.4.111:63555 <-> 172.16.7.206:1544 [83 bytes]
MRCP/2.0 83 1 200 IN-PROGRESS
Channel-Identifier: 8fe20c9c3c5c11f0@speechrecog
2025-05-29 15:13:50.495892 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f1dc0000a80;2;3]
2025-05-29 15:13:50.495892 [DEBUG] apt_poller_task.c:251 () Wait for Messages [MRCPv2ConnectionAgent]
2025-05-29 15:13:50.495892 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f1dc0000a80;2;3]
2025-05-29 15:13:50.495892 [INFO] mrcp_client_session.c:500 (ASR-1) Raise App MRCP Response ASR-1 <8fe20c9c3c5c11f0>
2025-05-29 15:13:50.495892 [DEBUG] mod_unimrcp.c:3610 (ASR-1) RECOGNIZE IN PROGRESS
|
如果识别成功,会产生DETECTED SPEECH
, 业务需要监听这个事件, 然后解析识别出的结果。
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
|
2025-05-29 15:13:56.695885 [DEBUG] mod_unimrcp.c:2545 (ASR-1) SUCCESS, have result
2025-05-29 15:13:56.695885 [DEBUG] mod_unimrcp.c:2786 (ASR-1) result:
<?xml version="1.0" encoding="UTF-8"?>
<result grammar="builtin:grammar/boolean?language=en-US;y=1;n=2">
<interpretation grammar="builtin:grammar/boolean?language=en-US;y=1;n=2" confidence="0.97">
<input mode="speech"> Hello hello.</input>
<instance> Hello hello.</instance>
</interpretation>
</result>
2025-05-29 15:13:56.695885 [INFO] mpf_rtp_stream.c:1199 () Generate RTCP SR [ssrc:169295438 s:310 o:49600 ts:51040]
2025-05-29 15:13:56.695885 [INFO] mpf_rtp_stream.c:1386 () Send Compound RTCP Packet [BYE] [76 bytes] 172.16.4.111:4001 -> 172.16.7.206:5075
2025-05-29 15:13:56.715889 [INFO] switch_ivr_async.c:4501 (sofia/internal/1007@172.16.4.111) DETECTED SPEECH
EXECUTE [depth=0] sofia/internal/1007@172.16.4.111 log(CRIT <?xml version="1.0" encoding="UTF-8"?>
<result grammar="builtin:grammar/boolean?language=en-US;y=1;n=2">
<interpretation grammar="builtin:grammar/boolean?language=en-US;y=1;n=2" confidence="0.97">
<input mode="speech"> Hello hello.</input>
<instance> Hello hello.</instance>
</interpretation>
</result>
)
2025-05-29 15:13:56.715889 [CRIT] mod_dptools.c:1866 <?xml version="1.0" encoding="UTF-8"?>
<result grammar="builtin:grammar/boolean?language=en-US;y=1;n=2">
<interpretation grammar="builtin:grammar/boolean?language=en-US;y=1;n=2" confidence="0.97">
<input mode="speech"> Hello hello.</input>
<instance> Hello hello.</instance>
</interpretation>
</result>
|
问题
Failed to Create Session ASR-1
日志:
1
2
3
4
5
6
7
8
|
2025-05-29 15:24:04.446106 [NOTICE] mrcp_application.c:96 (ASR-1) Create MRCP Handle 0x7f22d800f740 [test-mrcp]
2025-05-29 15:24:04.446106 [INFO] mrcp_client_session.c:133 (ASR-1) Create Channel ASR-1 <new>
2025-05-29 15:24:04.446106 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f22d8008bc0;4;0]
2025-05-29 15:24:04.446106 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f22d8008bc0;4;0]
2025-05-29 15:24:04.446106 [INFO] mrcp_client_session.c:387 (ASR-1) Receive App Request ASR-1 <new> [2]
2025-05-29 15:24:04.446106 [WARNING] mrcp_client_session.c:1269 (ASR-1) Failed to Create Session ASR-1 <new> [2]
2025-05-29 15:24:04.446106 [INFO] mrcp_client_session.c:533 (ASR-1) Raise App Response ASR-1 <new> [2] FAILURE [1]
2025-05-29 15:24:04.446106 [ERR] mod_unimrcp.c:1920 (ASR-1) RECOGNIZER channel error!
|
如果unimrcp
服务ok,但是使用freeswitch
连接就是不行, freeswitch
使用的是容器
部署。
- 检查一下
test-mrcp.xml
里是不是没有配置client-ip
和client-port
。
- 查看一下
play_and_detect_speech
的用法是否正确。
Receive SIP Event [nua_r_invite] Status 503 Service Unavailable [test-mrcp]
日志:
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
|
025-05-30 09:26:25.837024 [INFO] mrcp_client_session.c:411 (ASR-0) Send Offer ASR-0 <new> [c:1 a:1 v:0] to 172.16.7.206:8060
2025-05-30 09:26:25.837024 [INFO] mrcp_sofiasip_client_agent.c:354 (ASR-0) Local SDP ASR-0 <new>
v=0
o=FreeSWITCH 0 0 IN IP4 172.16.4.111
s=-
c=IN IP4 172.16.4.111
t=0 0
m=application 9 TCP/MRCPv2 1
a=setup:active
a=connection:new
a=resource:speechrecog
a=cmid:1
m=audio 4000 RTP/AVP 0 8 96
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 L16/8000
a=sendonly
a=mid:1
2025-05-30 09:26:25.837024 [DEBUG] apt_consumer_task.c:141 () Wait for Messages [MRCP Client]
2025-05-30 09:26:25.837024 [INFO] mrcp_sofiasip_client_agent.c:609 () Receive SIP Event [nua_i_state] Status 0 INVITE sent [test-mrcp]
2025-05-30 09:26:25.837024 [NOTICE] mrcp_sofiasip_client_agent.c:547 (ASR-0) SIP Call State ASR-0 [calling]
2025-05-30 09:26:25.837024 [INFO] mrcp_sofiasip_client_agent.c:609 () Receive SIP Event [nua_r_invite] Status 503 Service Unavailable [test-mrcp]
2025-05-30 09:26:25.837024 [INFO] mrcp_sofiasip_client_agent.c:609 () Receive SIP Event [nua_i_state] Status 503 Service Unavailable [test-mrcp]
2025-05-30 09:26:25.837024 [NOTICE] mrcp_sofiasip_client_agent.c:547 (ASR-0) SIP Call State ASR-0 [terminated]
2025-05-30 09:26:25.837024 [DEBUG] apt_task.c:265 () Signal Message to [MRCP Client] [0x7f286c001fa0;1;0]
2025-05-30 09:26:25.837024 [DEBUG] apt_task.c:337 () Process Message [MRCP Client] [0x7f286c001fa0;1;0]
2025-05-30 09:26:25.837024 [INFO] mrcp_client_session.c:151 (ASR-0) Receive Answer ASR-0 <new> [c:0 a:0 v:0] Status 503
2025-05-30 09:26:25.837024 [INFO] mrcp_client_session.c:455 (ASR-0) Raise App Response ASR-0 <new> [2] FAILURE [2]
2025-05-30 09:26:25.837024 [ERR] mod_unimrcp.c:1920 (ASR-0) RECOGNIZER channel error!
|
unimrcp
服务正常,端口也能通。但是使用freeswitch
连接不通,报错503 Service Unavailable
,
此时检查test-mrcp.xml
里是不是没有配置client-ip
,容器内这个参数一定要配,要么是auto
,要么是具体的ip
。