calejost / unimrcp

Automatically exported from code.google.com/p/unimrcp
Apache License 2.0
0 stars 0 forks source link

Connector 1.0.0 crashes Asterisk 1.8 and 11 on Ubuntu when used against Lumenvox. #157

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Install Asterisk 11.3.0 from source or 1.8.10.1~dfsg-1ubuntu1 from packages 
on Ubuntu 12.04
2. Install UniMRCP Asterisk connector 1.0.0
3. Invoce SynthAndRecog using SSML TTS and a GRXML inline grammar

Asterisk simply segfaults and shuts down.
I am still leaning on me doing something wrong, but the setup is as simple as 
it gets.

Original issue reported on code.google.com by luca.pra...@gmail.com on 15 Apr 2013 at 2:27

GoogleCodeExporter commented 8 years ago
To elaborate further, the issue is only present when issuing commands over AMI.

The following is the AMI version of a working dialplan example and crashes 
Asterisk:

Action: agi
ActionID: 8461ac3f-e2cb-4fc8-8699-29b8d0e038f9
Channel: SIP/usera-0000000c
Command: EXEC SynthAndRecog "<?xml version=\\\"1.0\\\"?><speak 
version=\\\"1.0\\\" xmlns=\\\"http://www.w3.org/2001/10/synthesis\\\" 
xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" 
xsi:schemaLocation=\\\"http://www.w3.org/2001/10/synthesis 
http://www.w3.org/TR/speech-synthesis/synthesis.xsd\\\" 
xml:lang=\\\"en-GB\\\">Please pick a color: red <break/> green <break/> or blue 
</speak>" "<?xml version=\\\"1.0\\\"?><grammar 
xmlns=\\\"http://www.w3.org/2001/06/grammar\\\" xml:lang=\\\"en-GB\\\" 
version=\\\"1.0\\\" mode=\\\"voice\\\" 
tag-format=\\\"semantics/1.0-literals\\\" root=\\\"color\\\"><rule 
id=\\\"color\\\"><one-of><item>red</item><item>green</item><item>blue</item></on
e-of></rule></grammar>" "t=5000&b=1&ct=0.7&spl=en-GB"
CommandID: 045d84fc-3750-412b-8db0-e3e0093ee706

Original comment by luca.pra...@gmail.com on 15 Apr 2013 at 4:33

GoogleCodeExporter commented 8 years ago
The same command:
EXEC SynthAndRecog "<?xml version=\\\"1.0\\\"?><speak version=\\\"1.0\\\" 
xmlns=\\\"http://www.w3.org/2001/10/synthesis\\\" 
xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" 
xsi:schemaLocation=\\\"http://www.w3.org/2001/10/synthesis 
http://www.w3.org/TR/speech-synthesis/synthesis.xsd\\\" 
xml:lang=\\\"en-GB\\\">Please pick a color: red <break/> green <break/> or blue 
</speak>","<?xml version=\\\"1.0\\\"?><grammar 
xmlns=\\\"http://www.w3.org/2001/06/grammar\\\" xml:lang=\\\"en-GB\\\" 
version=\\\"1.0\\\" mode=\\\"voice\\\" 
tag-format=\\\"semantics/1.0-literals\\\" root=\\\"color\\\"><rule 
id=\\\"color\\\"><one-of><item>red</item><item>green</item><item>blue</item></on
e-of></rule></grammar>","t=5000&b=1&ct=0.7&spl=en-GB"

works over FastAGI without any particular issue.
The commas separating the arguments instead of spaces are a protocol difference 
and intended.

Original comment by luca.pra...@gmail.com on 15 Apr 2013 at 8:08

GoogleCodeExporter commented 8 years ago
The question is how SynthAndRecog eventually is getting executed, or more 
specifically, how input arguments are passed through AMI, AGI to the 
application.

The following AGI EXEC command invoked via an AMI action request does work.

T 127.0.0.1:46187 -> 127.0.0.1:5038 [AP]
  Action: AGI..Command: EXEC SynthAndRecog "<?xml version=\'1.0\'?><speak version=\'1.0\' xmlns=\'http://www.w3.org/2001/10/synthesis\' xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\' xsi:schemaLoc
  ation=\'http://www.w3.org/2001/10/synthesis http://www.w3.org/TR/speech-synthesis/synthesis.xsd\' xml:lang=\'en-US\'>Please pick a color: red <break/> green <break/> or blue </speak>","<?xml version=\'1.
  0\'?><grammar xmlns=\'http://www.w3.org/2001/06/grammar\' xml:lang=\'en-US\' version=\'1.0\' mode=\'voice\' tag-format=\'semantics/1.0-literals\' root=\'color\'><rule id=\'color\'><one-of><item>red</item
  ><item>green</item><item>blue</item></one-of></rule></grammar>","t=5000&b=1&ct=0.7&spl=en-US"..CommandID: Command-2..Channel: SIP/511-00000013..ActionID: testdomain.com-12923-00000003....

Pay attention to the delimiters used in the example above. 

Meantime, I wanted to reproduce the crash but was not able to do so. It should 
be just a matter of arguments passed to the application in an unexpected 
format. If you could attach the corresponding Asterisk debug logs, that would 
help. Thanks.

Original comment by achalo...@gmail.com on 16 Apr 2013 at 1:44

GoogleCodeExporter commented 8 years ago
Hello,
to follow up, changing the escaping on the command and using commas works 
correctly.
The wrong argument separator still segfaults Asterisk but I think this can be 
downgraded to a minor issue.

Original comment by luca.pra...@gmail.com on 16 Apr 2013 at 2:30

GoogleCodeExporter commented 8 years ago
Hello Luca,

FYI, Asterisk didn't segfault on my test machine running CentOS even if the 
wrong separator was used. Though, it could be just by luck since there was a 
NULL pointer reference.

Anyway, in r1960, I enhanced the code to test input arguments more carefully to 
prevent a possible segfault of Asterisk which may caused by a wrong argument 
separator, or a missing argument, etc.

Original comment by achalo...@gmail.com on 18 Apr 2013 at 1:57