adhearsion / ruby_speech

A ruby library for TTS & ASR document preparation
MIT License
101 stars 41 forks source link

SSML draw suddenly escaping & when url is passed in #35

Closed gregory closed 9 years ago

gregory commented 9 years ago

Not sure why, but SSML suddenly started to escape & in the urls :(

RubySpeech::SSML.draw { audio(:src => 'https://www.google.com/?q=foo bar&bar=foo') }

#=>
=> <speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">
  <audio src="https://www.google.com/?q=foo%20bar&amp;bar=foo"/>
</speak>
gregory commented 9 years ago
AHN> [2015-07-29 18:52:37.306] DEBUG Adhearsion::Call: @: Receiving message: #<Punchblock::Event::Offer target_call_id="02a3e6ef-ff6c-432d-8caa-daba118f3a4d", target_mixer_name=nil, component_id=nil, source_uri="xmpp:02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost", domain="localhost", transport="xmpp", timestamp=Wed, 29 Jul 2015 16:52:37 +0000, headers={"from"=>"\"greg\" <sip:123@192.168.99.100>;tag=d65JfOIhAkwznLKhJx6pv9PfMzbzVtaG", "to"=>"<sip:456@192.168.99.100>", "via"=>"SIP/2.0/UDP 192.168.99.1:57288;rport=57288;branch=z9hG4bKPj6w.Pvr-2OPMMrjUgrmxH41yCKgheWLmH"}, to="sip:456@192.168.99.100", from="sip:123@192.168.99.100">
[2015-07-29 18:52:37.311] INFO  Adhearsion::Router: Call 02a3e6ef-ff6c-432d-8caa-daba118f3a4d selected route "stib live info" (VoicemailController)
[2015-07-29 18:52:37.339] DEBUG Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: Executing command #<Punchblock::Command::Accept target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, timestamp=Wed, 29 Jul 2015 18:52:37 +0200, request_id="e6909875-ed3d-466e-81eb-920c3d60680f", headers={}>
[2015-07-29 18:52:37.396] INFO  Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: Executing controller #<VoicemailController call=02a3e6ef-ff6c-432d-8caa-daba118f3a4d, metadata={}>
[2015-07-29 18:52:37.402] DEBUG Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: Receiving message: #<Punchblock::Event::Offer target_call_id="02a3e6ef-ff6c-432d-8caa-daba118f3a4d", target_mixer_name=nil, component_id=nil, source_uri="xmpp:02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost", domain="localhost", transport="xmpp", timestamp=Wed, 29 Jul 2015 16:52:37 +0000, headers={"from"=>"\"greg\" <sip:123@192.168.99.100>;tag=d65JfOIhAkwznLKhJx6pv9PfMzbzVtaG", "to"=>"<sip:456@192.168.99.100>", "via"=>"SIP/2.0/UDP 192.168.99.1:57288;rport=57288;branch=z9hG4bKPj6w.Pvr-2OPMMrjUgrmxH41yCKgheWLmH"}, to="sip:456@192.168.99.100", from="sip:123@192.168.99.100">
[2015-07-29 18:52:39.204] DEBUG Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: Executing command #<Punchblock::Component::Output target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, timestamp=Wed, 29 Jul 2015 18:52:39 +0200, request_id="11c33441-526f-4191-9657-d64f3b21725e", headers={}, voice=nil, interrupt_on=nil, start_offset=nil, start_paused=nil, repeat_interval=nil, repeat_times=nil, max_time=nil, renderer=nil, render_documents=[#<Punchblock::Component::Output::Document target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, timestamp=Wed, 29 Jul 2015 18:52:39 +0200, url=nil, content_type="application/ssml+xml", value=<speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">
  <audio src="shout://translate.google.com/translate_tts?tl=en&amp;q=Hello"/>
</speak>>]>
[2015-07-29 18:53:00.000] DEBUG Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: Receiving message: #<Punchblock::Event::Complete target_call_id="02a3e6ef-ff6c-432d-8caa-daba118f3a4d", target_mixer_name=nil, component_id="output-1", source_uri="xmpp:02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost/output-1", domain="localhost", transport="xmpp", timestamp=Wed, 29 Jul 2015 16:52:59 +0000, reason=#<Punchblock::Event::Complete::Error target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, timestamp=Wed, 29 Jul 2015 18:52:59 +0200, name=:error, details="">, recording=nil, fax=nil, fax_metadata={}>
[2015-07-29 18:53:00.003] DEBUG Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: Finished executing controller #<VoicemailController call=02a3e6ef-ff6c-432d-8caa-daba118f3a4d, metadata={}>
[2015-07-29 18:53:00.002] ERROR Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: <Adhearsion::CallController::Output::PlaybackError> Output failed due to #<Adhearsion::Error: : #<Punchblock::Component::Output target_call_id="02a3e6ef-ff6c-432d-8caa-daba118f3a4d", target_mixer_name=nil, component_id="output-1", source_uri="xmpp:02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost/output-1", domain="localhost", transport=nil, timestamp=Wed, 29 Jul 2015 18:52:39 +0200, request_id="11c33441-526f-4191-9657-d64f3b21725e", headers={}, voice=nil, interrupt_on=nil, start_offset=nil, start_paused=nil, repeat_interval=nil, repeat_times=nil, max_time=nil, renderer=nil, render_documents=[#<Punchblock::Component::Output::Document target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, timestamp=Wed, 29 Jul 2015 18:52:39 +0200, url=nil, content_type="application/ssml+xml", value=<speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">
  <audio src="shout://translate.google.com/translate_tts?tl=en&amp;q=Hello"/>
</speak>>]>>
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller/output/player.rb:23:in `rescue in output'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller/output/player.rb:13:in `output'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller/output/abstract_player.rb:18:in `play_ssml'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller/output.rb:103:in `play'
        /code/app/call_controllers/voicemail_controller.rb:9:in `run'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:119:in `execute!'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:94:in `block in exec'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:93:in `catch'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:93:in `exec'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:110:in `exec_with_callback'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:104:in `block (2 levels) in bg_exec'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/foundation/exception_handler.rb:5:in `catching_standard_errors'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:103:in `block in bg_exec'
        /usr/local/bundle/gems/celluloid-0.15.2/lib/celluloid/thread_handle.rb:13:in `block in initialize'
        /usr/local/bundle/gems/celluloid-0.15.2/lib/celluloid/internal_pool.rb:100:in `call'
        /usr/local/bundle/gems/celluloid-0.15.2/lib/celluloid/internal_pool.rb:100:in `block in create'
        /usr/local/bundle/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `call'
        /usr/local/bundle/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
[2015-07-29 18:53:00.010] INFO  Adhearsion::Router::Route: Call 02a3e6ef-ff6c-432d-8caa-daba118f3a4d routing completed. Hanging up now.
[2015-07-29 18:53:00.013] INFO  Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: Hanging up
[2015-07-29 18:53:00.016] DEBUG Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: Executing command #<Punchblock::Command::Hangup target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, timestamp=Wed, 29 Jul 2015 18:53:00 +0200, request_id="ac695aa5-7a32-4e25-8ad4-896466b396cd", headers={}>
[2015-07-29 18:53:00.047] ERROR Adhearsion::Call: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost: <Adhearsion::CallController::Output::PlaybackError> Output failed due to #<Adhearsion::Error: : #<Punchblock::Component::Output target_call_id="02a3e6ef-ff6c-432d-8caa-daba118f3a4d", target_mixer_name=nil, component_id="output-1", source_uri="xmpp:02a3e6ef-ff6c-432d-8caa-daba118f3a4d@localhost/output-1", domain="localhost", transport=nil, timestamp=Wed, 29 Jul 2015 18:52:39 +0200, request_id="11c33441-526f-4191-9657-d64f3b21725e", headers={}, voice=nil, interrupt_on=nil, start_offset=nil, start_paused=nil, repeat_interval=nil, repeat_times=nil, max_time=nil, renderer=nil, render_documents=[#<Punchblock::Component::Output::Document target_call_id=nil, target_mixer_name=nil, component_id=nil, source_uri=nil, domain=nil, transport=nil, timestamp=Wed, 29 Jul 2015 18:52:39 +0200, url=nil, content_type="application/ssml+xml", value=<speak xmlns="http://www.w3.org/2001/10/synthesis" version="1.0" xml:lang="en-US">
  <audio src="shout://translate.google.com/translate_tts?tl=en&amp;q=Hello"/>
</speak>>]>>
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller/output/player.rb:23:in `rescue in output'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller/output/player.rb:13:in `output'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller/output/abstract_player.rb:18:in `play_ssml'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller/output.rb:103:in `play'
        /code/app/call_controllers/voicemail_controller.rb:9:in `run'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:119:in `execute!'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:94:in `block in exec'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:93:in `catch'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:93:in `exec'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:110:in `exec_with_callback'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:104:in `block (2 levels) in bg_exec'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/foundation/exception_handler.rb:5:in `catching_standard_errors'
        /usr/local/bundle/gems/adhearsion-2.6.0/lib/adhearsion/call_controller.rb:103:in `block in bg_exec'
        /usr/local/bundle/gems/celluloid-0.15.2/lib/celluloid/thread_handle.rb:13:in `block in initialize'
        /usr/local/bundle/gems/celluloid-0.15.2/lib/celluloid/internal_pool.rb:100:in `call'
        /usr/local/bundle/gems/celluloid-0.15.2/lib/celluloid/internal_pool.rb:100:in `block in create'
        /usr/local/bundle/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `call'
        /usr/local/bundle/gems/logging-1.8.2/lib/logging/diagnostic_context.rb:323:in `block in create_with_logging_context'
gregory commented 9 years ago
2015-07-26 16:41:23.722006 [NOTICE] switch_rtp.c:5196 Receiving an RTCP packet[2015-29-06 16:52:58.821927] SSRC[825028309]RTT[0.012589] A[2204815977] - DLSR[89612] - LSR[2204725540]

2015-07-26 16:41:23.722006 [NOTICE] switch_rtp.c:5196 Receiving an RTCP packet[2015-29-06 16:52:58.821927] SSRC[825028309]RTT[0.012589] A[2204815977] - DLSR[89612] - LSR[2204725540]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Type] = [log/data]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Length] = [134]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Level] = [3]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Text-Channel] = [0]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-File] = [mod_shout.c]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Func] = [shout_file_open]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Line] = [697]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [User-Data] = []
[DEBUG] esl.c:1480 esl_recv_event() RECV MESSAGE
Event-Name: SOCKET_DATA
Content-Type: log/data
Content-Length: 134
Log-Level: 3
Text-Channel: 0
Log-File: mod_shout.c
Log-Func: shout_file_open
Log-Line: 697
Content-Length: 134

2015-07-26 16:41:24.860780 [ERR] mod_shout.c:697 Error opening translate.google.com/translate_tts?tl=en&q=Hello (data stream timeout)

2015-07-26 16:41:24.860780 [ERR] mod_shout.c:697 Error opening translate.google.com/translate_tts?tl=en&q=Hello (data stream timeout)
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Type] = [log/data]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Length] = [133]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Level] = [5]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Text-Channel] = [0]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-File] = [switch_ivr.c]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Func] = [switch_ivr_kill_uuid]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Line] = [3725]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [User-Data] = [02a3e6ef-ff6c-432d-8caa-daba118f3a4d]
[DEBUG] esl.c:1480 esl_recv_event() RECV MESSAGE
Event-Name: SOCKET_DATA
Content-Type: log/data
Content-Length: 133
Log-Level: 5
Text-Channel: 0
Log-File: switch_ivr.c
Log-Func: switch_ivr_kill_uuid
Log-Line: 3725
User-Data: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d
Content-Length: 133

2015-07-26 16:41:24.923658 [NOTICE] switch_ivr.c:3725 Hangup sofia/external/123@192.168.99.100 [CS_EXECUTE] [NORMAL_CLEARING]

2015-07-26 16:41:24.923658 [NOTICE] switch_ivr.c:3725 Hangup sofia/external/123@192.168.99.100 [CS_EXECUTE] [NORMAL_CLEARING]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Type] = [log/data]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Length] = [123]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Level] = [5]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Text-Channel] = [3]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-File] = [switch_core_session.c]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Func] = [switch_core_session_thread]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Line] = [1641]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [User-Data] = [02a3e6ef-ff6c-432d-8caa-daba118f3a4d]
[DEBUG] esl.c:1480 esl_recv_event() RECV MESSAGE
Event-Name: SOCKET_DATA
Content-Type: log/data
Content-Length: 123
Log-Level: 5
Text-Channel: 3
Log-File: switch_core_session.c
Log-Func: switch_core_session_thread
Log-Line: 1641
User-Data: 02a3e6ef-ff6c-432d-8caa-daba118f3a4d
Content-Length: 123

2015-07-26 16:41:24.923658 [NOTICE] switch_core_session.c:1641 Session 35 (sofia/external/123@192.168.99.100) Ended
crienzo commented 9 years ago

I'll try to reproduce

gregory commented 9 years ago

awesome, let me know if you need anything else!

gregory commented 9 years ago

@crienzo i figured it out. the escaping in the xml is acutally ok. The error came from the fact google tts is doing a redirection to a page with captcha (i guess they might be under attack or something). i'll close this issue!

Thanks for helping!

benlangfeld commented 9 years ago

Please see https://mojolingo.com/blog/2015/you-have-to-pay-for-it-the-importance-of-vendor-relationships-in-apis/ for a full explanation.

gregory commented 9 years ago

awesome... For the record, that just happened the night before our demo :) thanks for documenting this @benlangfeld !