Use the application MRCPSynth to speech synthesis.
[app-unimrcp-2] exten => s,1,Answer exten => s,2,MRCPSynth(Welcome to Asterisk,l=en-US&p=uni2) |
In the Asterisk dialplan, associate the provided sample to an extension, for example, 802.
exten => 802,1,Goto(app-unimrcp-2,s,1) |
Place a test call and listen to the synthesized message.
I am unable to listen the response output.
================================================\
Extensions.conf file:
[from-internal
exten => 802,1,Goto(app-unimrcp-2,s,1)
[app-unimrcp-2]
exten => s,1,Answer
exten => s,2,MRCPSynth(Welcome to Asterisk,l=en-US&p=uni2)
===========================================================
Asterisk CLI output:
CLI> -- Time to scan old dialplan and merge leftovers back into the new: 0.000050 sec
-- Time to restore hints and swap in new dialplan: 0.000006 sec
-- Time to delete the old dialplan: 0.000011 sec
-- Total time merge_contexts_delete: 0.000067 sec
-- pbx_config successfully loaded 4 contexts (enable debug for details).
== Setting global variable 'SIPDOMAIN' to '192.168.0.109'
-- Executing [802@from-internal:1] Goto("PJSIP/6001-00000001", "app-unimrcp-2,s,1") in new stack
-- Goto (app-unimrcp-2,s,1)
-- Executing [s@app-unimrcp-2:1] Answer("PJSIP/6001-00000001", "") in new stack
> 0x29c8630 -- Strict RTP learning after remote address set to: 192.168.0.104:8000
> 0x29c8630 -- Strict RTP switching to RTP target address 192.168.0.104:8000 as source
-- Executing [s@app-unimrcp-2:2] MRCPSynth("PJSIP/6001-00000001", "Welcome to Asterisk,l=en-US&p=uni2") in new stack
[Apr 29 04:39:08] NOTICE[7425][C-00000002]: app_mrcpsynth.c:514 app_synth_exec: MRCPSynth() prompt: Welcome to Asterisk
[Apr 29 04:39:08] NOTICE[7425][C-00000002]: app_mrcpsynth.c:529 app_synth_exec: MRCPSynth() options: l=en-US&p=uni2
[Apr 29 04:39:08] NOTICE[7425][C-00000002]: src/mrcp_application.c:117 Create MRCP Handle 0x7f84c8016b08 [uni2]
[Apr 29 04:39:08] NOTICE[7425][C-00000002]: src/mrcp_client_session.c:131 Create Channel TTS-0 <new>
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client_session.c:385 Receive App Request TTS-0 <new> [2]
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client.c:697 Add MRCP Handle TTS-0 <new>
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client_session.c:717 Add Control Channel TTS-0 <new@speechsynth>
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client_session.c:409 Send Offer TTS-0 <new> [c:1 a:1 v:0] to 192.168.0.106:8060
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_sofiasip_client_agent.c:357 Local SDP TTS-0 <new>
v=0
o=Asterisk 0 0 IN IP4 192.168.0.109
s=-
c=IN IP4 192.168.0.109
t=0 0
m=application 9 TCP/MRCPv2 1
a=setup:active
a=connection:new
a=resource:speechsynth
a=cmid:1
m=audio 28000 RTP/AVP 0 8 96 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 L16/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=recvonly
a=ptime:20
a=mid:1
[Apr 29 04:39:08] NOTICE[7392]: src/mrcp_sofiasip_client_agent.c:617 Receive SIP Event [nua_i_state] Status 0 INVITE sent [uni2]
[Apr 29 04:39:08] NOTICE[7392]: src/mrcp_sofiasip_client_agent.c:555 SIP Call State TTS-0 [calling]
[Apr 29 04:39:08] NOTICE[7392]: src/mrcp_sofiasip_client_agent.c:617 Receive SIP Event [nua_r_invite] Status 406 Not Acceptable [uni2]
[Apr 29 04:39:08] NOTICE[7392]: src/mrcp_sofiasip_client_agent.c:617 Receive SIP Event [nua_i_state] Status 406 Not Acceptable [uni2]
[Apr 29 04:39:08] NOTICE[7392]: src/mrcp_sofiasip_client_agent.c:555 SIP Call State TTS-0 [terminated]
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client_session.c:149 Receive Answer TTS-0 <new> [c:0 a:0 v:0] Status 406
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client_session.c:453 Raise App Response TTS-0 <new> [2] FAILURE [2]
[Apr 29 04:39:08] ERROR[7387]: app_mrcpsynth.c:208 speech_on_channel_add: (TTS-0) Channel error status=2, response code=406!
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client_session.c:385 Receive App Request TTS-0 <new> [1]
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client_session.c:828 Terminate Session TTS-0 <new>
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client_session.c:207 Session Terminated TTS-0 <new>
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client.c:707 Remove MRCP Handle TTS-0 <new>
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_client_session.c:453 Raise App Response TTS-0 <new> [1] SUCCESS [0]
[Apr 29 04:39:08] NOTICE[7387]: src/mrcp_application.c:211 Destroy MRCP Handle TTS-0
[Apr 29 04:39:08] NOTICE[7425][C-00000002]: app_mrcpsynth.c:479 mrcpsynth_exit: MRCPSynth() exiting status: ERROR on PJSIP/6001-00000001
-- Auto fallthrough, channel 'PJSIP/6001-00000001' status is 'UNKNOWN'
[app-unimrcp-2] exten => s,1,Answer exten => s,2,MRCPSynth(Welcome to Asterisk,l=en-US&p=uni2) |
In the Asterisk dialplan, associate the provided sample to an extension, for example, 802.
exten => 802,1,Goto(app-unimrcp-2,s,1) |