mod_rayo: move alias definition to config file, tweak console command completion to make testing easier
This commit is contained in:
parent
10908a0a8d
commit
4ae41dd1bd
|
@ -47,4 +47,211 @@
|
|||
<dial-gateway uriprefix="sofia" dialprefix="" strip=""/>
|
||||
</dial-gateways>
|
||||
|
||||
<!-- IQ request aliases. Used mainly for testing purposes or for controlling a rayo call via the console -->
|
||||
<aliases>
|
||||
<alias name="ping" target="external"><![CDATA[<iq type="get"><ping xmlns="urn:xmpp:ping"/></iq>]]></alias>
|
||||
<alias name="answer" target="call"><![CDATA[<answer xmlns="urn:xmpp:rayo:1"/>]]></alias>
|
||||
<alias name="hangup" target="call"><![CDATA[<hangup xmlns="urn:xmpp:rayo:1"/>]]></alias>
|
||||
<alias name="join_mixer_duplex" target="call"><![CDATA[<join xmlns="urn:xmpp:rayo:1" mixer-name="test" direction="duplex"/>]]></alias>
|
||||
<alias name="join_mixer_send" target="call"><![CDATA[<join xmlns="urn:xmpp:rayo:1" mixer-name="test" direction="send"/>]]></alias>
|
||||
<alias name="join_mixer_recv" target="call"><![CDATA[<join xmlns="urn:xmpp:rayo:1" mixer-name="test" direction="recv"/>]]></alias>
|
||||
<alias name="unjoin_mixer" target="call"><![CDATA[<unjoin xmlns="urn:xmpp:rayo:1" mixer-name="test"/>]]></alias>
|
||||
<alias name="unjoin" target="call"><![CDATA[<unjoin xmlns="urn:xmpp:rayo:1"/>]]></alias>
|
||||
<alias name="stop" target="component"><![CDATA[<stop xmlns="urn:xmpp:rayo:ext:1"/>]]></alias>
|
||||
<alias name="output_bad" target="call"><![CDATA[<output xmlns="urn:xmpp:rayo:output:1" repeat-time="100"></output>]]></alias>
|
||||
<alias name="pause" target="output"><![CDATA[<pause xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="resume" target="output"><![CDATA[<resume xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="speed-up" target="output"><![CDATA[<speed-up xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="speed-down" target="output"><![CDATA[<speed-down xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="volume-up" target="output"><![CDATA[<volume-up xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="volume-down" target="output"><![CDATA[<volume-down xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="record" target="call"><![CDATA[<record xmlns="urn:xmpp:rayo:record:1"/>]]></alias>
|
||||
<alias name="record_pause" target="record"><![CDATA[<pause xmlns="urn:xmpp:rayo:record:1"/>]]></alias>
|
||||
<alias name="record_resume" target="record"><![CDATA[<resume xmlns="urn:xmpp:rayo:record:1"/>]]></alias>
|
||||
<alias name="prompt_barge" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="5">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_no_barge" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="false">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="5">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_long" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_multi_digit" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><item repeat="1-4"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_terminator" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000" terminator="#">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><item repeat="1-4"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_input_bad" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtf" initial-timeout="5000" inter-digit-timeout="3000" terminator="#">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><item repeat="1-4"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_output_bad" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-time="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000" terminator="#">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><item repeat="1-4"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="input" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="input_voice_yesno_unimrcp" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp">
|
||||
<grammar content-type="application/srgs+xml>
|
||||
<![CDATA[
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
|
||||
xml:lang="en-US" version="1.0">
|
||||
<rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
|
||||
]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="input_voice_yesno_unimrcp_timeout" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp" max-silence="5000" initial-timeout="5000">
|
||||
<grammar content-type="application/srgs+xml>
|
||||
<![CDATA[
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
|
||||
xml:lang="en-US" version="1.0">
|
||||
<rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
|
||||
]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
|
||||
<alias name="input_voice_yesno_pocketsphinx" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="pocketsphinx" max-silence="5000" initial-timeout="5000">
|
||||
<grammar content-type="application/srgs+xml>
|
||||
<![CDATA[
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
|
||||
xml:lang="en-US" version="1.0">
|
||||
<rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
|
||||
]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
|
||||
<alias name="input_voice_yesno_default" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="voice" max-silence="5000" initial-timeout="5000">
|
||||
<grammar content-type="application/srgs+xml>
|
||||
<![CDATA[
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
|
||||
xml:lang="en-US" version="1.0">
|
||||
<rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
|
||||
]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
|
||||
</aliases>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -47,4 +47,211 @@
|
|||
<dial-gateway uriprefix="sofia" dialprefix="" strip=""/>
|
||||
</dial-gateways>
|
||||
|
||||
<!-- IQ request aliases. Used mainly for testing purposes or for controlling a rayo call via the console -->
|
||||
<aliases>
|
||||
<alias name="ping" target="external"><![CDATA[<iq type="get"><ping xmlns="urn:xmpp:ping"/></iq>]]></alias>
|
||||
<alias name="answer" target="call"><![CDATA[<answer xmlns="urn:xmpp:rayo:1"/>]]></alias>
|
||||
<alias name="hangup" target="call"><![CDATA[<hangup xmlns="urn:xmpp:rayo:1"/>]]></alias>
|
||||
<alias name="join_mixer_duplex" target="call"><![CDATA[<join xmlns="urn:xmpp:rayo:1" mixer-name="test" direction="duplex"/>]]></alias>
|
||||
<alias name="join_mixer_send" target="call"><![CDATA[<join xmlns="urn:xmpp:rayo:1" mixer-name="test" direction="send"/>]]></alias>
|
||||
<alias name="join_mixer_recv" target="call"><![CDATA[<join xmlns="urn:xmpp:rayo:1" mixer-name="test" direction="recv"/>]]></alias>
|
||||
<alias name="unjoin_mixer" target="call"><![CDATA[<unjoin xmlns="urn:xmpp:rayo:1" mixer-name="test"/>]]></alias>
|
||||
<alias name="unjoin" target="call"><![CDATA[<unjoin xmlns="urn:xmpp:rayo:1"/>]]></alias>
|
||||
<alias name="stop" target="component"><![CDATA[<stop xmlns="urn:xmpp:rayo:ext:1"/>]]></alias>
|
||||
<alias name="output_bad" target="call"><![CDATA[<output xmlns="urn:xmpp:rayo:output:1" repeat-time="100"></output>]]></alias>
|
||||
<alias name="pause" target="output"><![CDATA[<pause xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="resume" target="output"><![CDATA[<resume xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="speed-up" target="output"><![CDATA[<speed-up xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="speed-down" target="output"><![CDATA[<speed-down xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="volume-up" target="output"><![CDATA[<volume-up xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="volume-down" target="output"><![CDATA[<volume-down xmlns="urn:xmpp:rayo:output:1"/>]]></alias>
|
||||
<alias name="record" target="call"><![CDATA[<record xmlns="urn:xmpp:rayo:record:1"/>]]></alias>
|
||||
<alias name="record_pause" target="record"><![CDATA[<pause xmlns="urn:xmpp:rayo:record:1"/>]]></alias>
|
||||
<alias name="record_resume" target="record"><![CDATA[<resume xmlns="urn:xmpp:rayo:record:1"/>]]></alias>
|
||||
<alias name="prompt_barge" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="5">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_no_barge" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="false">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="5">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_long" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_multi_digit" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><item repeat="1-4"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_terminator" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000" terminator="#">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><item repeat="1-4"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_input_bad" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-times="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtf" initial-timeout="5000" inter-digit-timeout="3000" terminator="#">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><item repeat="1-4"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="prompt_output_bad" target="call">
|
||||
<![CDATA[
|
||||
<prompt xmlns="urn:xmpp:rayo:prompt:1" barge-in="true">
|
||||
<output xmlns="urn:xmpp:rayo:output:1" repeat-time="100">
|
||||
<document content-type="application/ssml+xml">
|
||||
<![CDATA[<speak><p>Please press a digit.</p></speak>]]]]><![CDATA[>
|
||||
</document>
|
||||
</output>
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000" terminator="#">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><item repeat="1-4"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
</prompt>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="input" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="dtmf" initial-timeout="5000" inter-digit-timeout="3000">
|
||||
<grammar content-type="application/srgs+xml">
|
||||
<![CDATA[<grammar mode="dtmf"><rule id="digit" scope="public"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="input_voice_yesno_unimrcp" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp">
|
||||
<grammar content-type="application/srgs+xml>
|
||||
<![CDATA[
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
|
||||
xml:lang="en-US" version="1.0">
|
||||
<rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
|
||||
]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
<alias name="input_voice_yesno_unimrcp_timeout" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="unimrcp" max-silence="5000" initial-timeout="5000">
|
||||
<grammar content-type="application/srgs+xml>
|
||||
<![CDATA[
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
|
||||
xml:lang="en-US" version="1.0">
|
||||
<rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
|
||||
]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
|
||||
<alias name="input_voice_yesno_pocketsphinx" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="voice" recognizer="pocketsphinx" max-silence="5000" initial-timeout="5000">
|
||||
<grammar content-type="application/srgs+xml>
|
||||
<![CDATA[
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
|
||||
xml:lang="en-US" version="1.0">
|
||||
<rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
|
||||
]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
|
||||
<alias name="input_voice_yesno_default" target="call">
|
||||
<![CDATA[
|
||||
<input xmlns="urn:xmpp:rayo:input:1" mode="voice" max-silence="5000" initial-timeout="5000">
|
||||
<grammar content-type="application/srgs+xml>
|
||||
<![CDATA[
|
||||
<grammar xmlns="http://www.w3.org/2001/06/grammar"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd"
|
||||
xml:lang="en-US" version="1.0">
|
||||
<rule id="yesno"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>
|
||||
]]]]><![CDATA[>
|
||||
</grammar>
|
||||
</input>
|
||||
]]>
|
||||
</alias>
|
||||
|
||||
</aliases>
|
||||
|
||||
</configuration>
|
||||
|
|
|
@ -239,6 +239,12 @@ static void rayo_console_client_send(struct rayo_actor *client, struct rayo_mess
|
|||
|
||||
static void on_client_presence(struct rayo_client *rclient, iks *node);
|
||||
|
||||
typedef switch_bool_t (* rayo_actor_match_fn)(struct rayo_actor *);
|
||||
|
||||
static switch_bool_t is_call_actor(struct rayo_actor *actor);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param msg to check
|
||||
* @return true if message was sent by admin client (console)
|
||||
|
@ -827,7 +833,7 @@ int rayo_actor_seq_next(struct rayo_actor *actor)
|
|||
static struct rayo_call *rayo_call_locate(const char *call_uuid, const char *file, int line)
|
||||
{
|
||||
struct rayo_actor *actor = rayo_actor_locate_by_id(call_uuid, file, line);
|
||||
if (actor && !strcmp(RAT_CALL, actor->type)) {
|
||||
if (actor && is_call_actor(actor)) {
|
||||
return RAYO_CALL(actor);
|
||||
} else if (actor) {
|
||||
RAYO_UNLOCK(actor);
|
||||
|
@ -3077,6 +3083,21 @@ static void on_xmpp_stream_destroy(struct xmpp_stream *stream)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an alias to an API command
|
||||
* @param alias_name
|
||||
* @param alias_target
|
||||
* @param alias_cmd
|
||||
*/
|
||||
static void rayo_add_cmd_alias(const char *alias_name, const char *alias_target, const char *alias_cmd)
|
||||
{
|
||||
if (zstr(alias_target)) {
|
||||
alias_target = "all";
|
||||
}
|
||||
switch_console_set_complete(switch_core_sprintf(globals.pool, "add rayo %s ::rayo::list_%s", alias_name, alias_target));
|
||||
switch_core_hash_insert(globals.cmd_aliases, alias_name, alias_cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process module XML configuration
|
||||
* @param pool memory pool to allocate from
|
||||
|
@ -3262,6 +3283,22 @@ static switch_status_t do_config(switch_memory_pool_t *pool, const char *config_
|
|||
}
|
||||
}
|
||||
|
||||
/* get aliases */
|
||||
{
|
||||
switch_xml_t aliases = switch_xml_child(cfg, "aliases");
|
||||
if (aliases) {
|
||||
switch_xml_t alias;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting configured aliases\n");
|
||||
for (alias = switch_xml_child(aliases, "alias"); alias; alias = alias->next) {
|
||||
const char *alias_name = switch_xml_attr_soft(alias, "name");
|
||||
const char *alias_target = switch_xml_attr_soft(alias, "target");
|
||||
if (!zstr(alias_name) && !zstr(alias->txt)) {
|
||||
rayo_add_cmd_alias(alias_name, alias_target, alias->txt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
switch_xml_free(xml);
|
||||
|
||||
|
@ -3360,12 +3397,6 @@ static void send_console_command(struct rayo_client *client, const char *to, con
|
|||
iks *command = NULL;
|
||||
iksparser *p = iks_dom_new(&command);
|
||||
|
||||
/* check if aliased */
|
||||
const char *alias = switch_core_hash_find(globals.cmd_aliases, command_str);
|
||||
if (!zstr(alias)) {
|
||||
command_str = alias;
|
||||
}
|
||||
|
||||
if (iks_parse(p, command_str, 0, 1) == IKS_OK && command) {
|
||||
char *str;
|
||||
iks *iq = NULL;
|
||||
|
@ -3404,14 +3435,15 @@ static void send_console_command(struct rayo_client *client, const char *to, con
|
|||
/**
|
||||
* Send command to rayo actor
|
||||
*/
|
||||
static int command_api(const char *cmd, switch_stream_handle_t *stream)
|
||||
static int command_api(char *cmd, switch_stream_handle_t *stream)
|
||||
{
|
||||
char *cmd_dup = strdup(cmd);
|
||||
char *argv[2] = { 0 };
|
||||
int argc = switch_separate_string(cmd_dup, ' ', argv, sizeof(argv) / sizeof(argv[0]));
|
||||
|
||||
if (argc != 2) {
|
||||
free(cmd_dup);
|
||||
if (!zstr(cmd)) {
|
||||
int argc = switch_separate_string(cmd, ' ', argv, sizeof(argv) / sizeof(argv[0]));
|
||||
if (argc != 2) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3419,7 +3451,22 @@ static int command_api(const char *cmd, switch_stream_handle_t *stream)
|
|||
send_console_command(globals.console, argv[0], argv[1]);
|
||||
stream->write_function(stream, "+OK\n");
|
||||
|
||||
free(cmd_dup);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send command to rayo actor
|
||||
*/
|
||||
static int alias_api(const char *cmd, char *jid, switch_stream_handle_t *stream)
|
||||
{
|
||||
if (zstr(cmd) || zstr(jid)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* send command */
|
||||
send_console_command(globals.console, jid, cmd);
|
||||
stream->write_function(stream, "+OK\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3443,14 +3490,15 @@ static void send_console_message(struct rayo_client *client, const char *to, con
|
|||
/**
|
||||
* Send message to rayo actor
|
||||
*/
|
||||
static int message_api(const char *msg, switch_stream_handle_t *stream)
|
||||
static int message_api(char *cmd, switch_stream_handle_t *stream)
|
||||
{
|
||||
char *msg_dup = strdup(msg);
|
||||
char *argv[2] = { 0 };
|
||||
int argc = switch_separate_string(msg_dup, ' ', argv, sizeof(argv) / sizeof(argv[0]));
|
||||
|
||||
if (argc != 2) {
|
||||
free(msg_dup);
|
||||
if (!zstr(cmd)) {
|
||||
int argc = switch_separate_string(cmd, ' ', argv, sizeof(argv) / sizeof(argv[0]));
|
||||
if (argc != 2) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3458,7 +3506,6 @@ static int message_api(const char *msg, switch_stream_handle_t *stream)
|
|||
send_console_message(globals.console, argv[0], argv[1]);
|
||||
stream->write_function(stream, "+OK\n");
|
||||
|
||||
free(msg_dup);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -3484,151 +3531,238 @@ static void send_console_presence(struct rayo_client *client, const char *to, in
|
|||
/**
|
||||
* Send console presence
|
||||
*/
|
||||
static int presence_api(const char *cmd, switch_stream_handle_t *stream)
|
||||
static int presence_api(char *cmd, switch_stream_handle_t *stream)
|
||||
{
|
||||
char *cmd_dup = strdup(cmd);
|
||||
char *argv[2] = { 0 };
|
||||
int argc = switch_separate_string(cmd_dup, ' ', argv, sizeof(argv) / sizeof(argv[0]));
|
||||
int is_online = 0;
|
||||
|
||||
if (argc != 2) {
|
||||
free(cmd_dup);
|
||||
char *argv[2] = { 0 };
|
||||
if (!zstr(cmd)) {
|
||||
int argc = switch_separate_string(cmd, ' ', argv, sizeof(argv) / sizeof(argv[0]));
|
||||
if (argc != 2) {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp("online", argv[1])) {
|
||||
is_online = 1;
|
||||
} else if (strcmp("offline", argv[1])) {
|
||||
free(cmd_dup);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* send presence */
|
||||
send_console_presence(globals.console, argv[0], is_online);
|
||||
stream->write_function(stream, "+OK\n");
|
||||
free(cmd_dup);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define RAYO_API_SYNTAX "status | (cmd <jid> <command>) | (msg <jid> <message text>) | (presence <jid> <online|offline>)"
|
||||
#define RAYO_API_SYNTAX "status | (<alias> <jid>) | (cmd <jid> <command>) | (msg <jid> <message text>) | (presence <jid> <online|offline>)"
|
||||
SWITCH_STANDARD_API(rayo_api)
|
||||
{
|
||||
const char *alias;
|
||||
char *cmd_dup = strdup(cmd);
|
||||
char *argv[2] = { 0 };
|
||||
int success = 0;
|
||||
if (!strncmp("status", cmd, 6)) {
|
||||
success = dump_api(cmd + 6, stream);
|
||||
} else if (!strncmp("cmd", cmd, 3)) {
|
||||
success = command_api(cmd + 3, stream);
|
||||
} else if (!strncmp("msg", cmd, 3)) {
|
||||
success = message_api(cmd + 3, stream);
|
||||
} else if (!strncmp("presence", cmd, 8)) {
|
||||
success = presence_api(cmd + 8, stream);
|
||||
|
||||
switch_separate_string(cmd_dup, ' ', argv, sizeof(argv) / sizeof(argv[0]));
|
||||
|
||||
/* check if a command alias */
|
||||
alias = switch_core_hash_find(globals.cmd_aliases, argv[0]);
|
||||
|
||||
if (!zstr(alias)) {
|
||||
success = alias_api(alias, argv[1], stream);
|
||||
} else if (!strcmp("cmd", argv[0])) {
|
||||
success = command_api(argv[1], stream);
|
||||
} else if (!strcmp("status", argv[0])) {
|
||||
success = dump_api(argv[1], stream);
|
||||
} else if (!strcmp("msg", argv[0])) {
|
||||
success = message_api(argv[1], stream);
|
||||
} else if (!strcmp("presence", argv[0])) {
|
||||
success = presence_api(argv[1], stream);
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
stream->write_function(stream, "-ERR: USAGE %s\n", RAYO_API_SYNTAX);
|
||||
}
|
||||
|
||||
free(cmd_dup);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for actors given validation function
|
||||
*/
|
||||
static switch_status_t list_actors(const char *line, const char *cursor, switch_console_callback_match_t **matches, rayo_actor_match_fn match)
|
||||
{
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
const void *vvar;
|
||||
switch_console_callback_match_t *my_matches = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
struct rayo_actor *actor;
|
||||
|
||||
switch_mutex_lock(globals.actors_mutex);
|
||||
for (hi = switch_hash_first(NULL, globals.actors); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &vvar, NULL, &val);
|
||||
|
||||
actor = (struct rayo_actor *) val;
|
||||
if (match(actor)) {
|
||||
switch_console_push_match(&my_matches, (const char *) vvar);
|
||||
}
|
||||
}
|
||||
switch_mutex_unlock(globals.actors_mutex);
|
||||
|
||||
if (my_matches) {
|
||||
*matches = my_matches;
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if internal actor
|
||||
*/
|
||||
static switch_bool_t is_internal_actor(struct rayo_actor *actor)
|
||||
{
|
||||
return strcmp(RAT_CLIENT, actor->type) && strcmp(RAT_PEER_SERVER, actor->type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for all internal actors
|
||||
*/
|
||||
switch_status_t list_internal(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
static switch_status_t list_internal(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
{
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
const void *vvar;
|
||||
switch_console_callback_match_t *my_matches = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
struct rayo_actor *actor;
|
||||
return list_actors(line, cursor, matches, is_internal_actor);
|
||||
}
|
||||
|
||||
switch_mutex_lock(globals.actors_mutex);
|
||||
for (hi = switch_hash_first(NULL, globals.actors); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &vvar, NULL, &val);
|
||||
|
||||
actor = (struct rayo_actor *) val;
|
||||
if (strcmp(RAT_CLIENT, actor->type) && strcmp(RAT_PEER_SERVER, actor->type)) {
|
||||
switch_console_push_match(&my_matches, (const char *) vvar);
|
||||
}
|
||||
}
|
||||
switch_mutex_unlock(globals.actors_mutex);
|
||||
|
||||
if (my_matches) {
|
||||
*matches = my_matches;
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return status;
|
||||
/**
|
||||
* @return true if external actor
|
||||
*/
|
||||
static switch_bool_t is_external_actor(struct rayo_actor *actor)
|
||||
{
|
||||
return !strcmp(RAT_CLIENT, actor->type) || !strcmp(RAT_PEER_SERVER, actor->type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for all external actors
|
||||
*/
|
||||
switch_status_t list_external(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
static switch_status_t list_external(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
{
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
const void *vvar;
|
||||
switch_console_callback_match_t *my_matches = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
struct rayo_actor *actor;
|
||||
return list_actors(line, cursor, matches, is_external_actor);
|
||||
}
|
||||
|
||||
switch_mutex_lock(globals.actors_mutex);
|
||||
for (hi = switch_hash_first(NULL, globals.actors); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &vvar, NULL, &val);
|
||||
|
||||
actor = (struct rayo_actor *) val;
|
||||
if (!strcmp(RAT_CLIENT, actor->type) || !strcmp(RAT_PEER_SERVER, actor->type)) {
|
||||
switch_console_push_match(&my_matches, (const char *) vvar);
|
||||
}
|
||||
}
|
||||
switch_mutex_unlock(globals.actors_mutex);
|
||||
|
||||
if (my_matches) {
|
||||
*matches = my_matches;
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return status;
|
||||
/**
|
||||
* @return true
|
||||
*/
|
||||
static switch_bool_t is_any_actor(struct rayo_actor *actor)
|
||||
{
|
||||
return SWITCH_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for all actors
|
||||
*/
|
||||
switch_status_t list_all(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
static switch_status_t list_all(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
{
|
||||
switch_hash_index_t *hi;
|
||||
void *val;
|
||||
const void *vvar;
|
||||
switch_console_callback_match_t *my_matches = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
|
||||
switch_mutex_lock(globals.actors_mutex);
|
||||
for (hi = switch_hash_first(NULL, globals.actors); hi; hi = switch_hash_next(hi)) {
|
||||
switch_hash_this(hi, &vvar, NULL, &val);
|
||||
switch_console_push_match(&my_matches, (const char *) vvar);
|
||||
}
|
||||
switch_mutex_unlock(globals.actors_mutex);
|
||||
|
||||
if (my_matches) {
|
||||
*matches = my_matches;
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return status;
|
||||
return list_actors(line, cursor, matches, is_any_actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an alias to an API command
|
||||
* @param alias_name
|
||||
* @param alias_cmd
|
||||
* @return true if a server
|
||||
*/
|
||||
static void rayo_add_cmd_alias(const char *alias_name, const char *alias_cmd)
|
||||
static switch_bool_t is_server_actor(struct rayo_actor *actor)
|
||||
{
|
||||
char *cmd = switch_core_sprintf(globals.pool, "add rayo cmd ::rayo::list_actors %s", alias_name);
|
||||
switch_console_set_complete(cmd);
|
||||
switch_core_hash_insert(globals.cmd_aliases, alias_name, alias_cmd);
|
||||
return !strcmp(RAT_SERVER, actor->type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for all servers
|
||||
*/
|
||||
static switch_status_t list_server(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
{
|
||||
return list_actors(line, cursor, matches, is_server_actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if a call
|
||||
*/
|
||||
static switch_bool_t is_call_actor(struct rayo_actor *actor)
|
||||
{
|
||||
return !strcmp(RAT_CALL, actor->type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for all calls
|
||||
*/
|
||||
static switch_status_t list_call(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
{
|
||||
return list_actors(line, cursor, matches, is_call_actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if a component
|
||||
*/
|
||||
switch_bool_t is_component_actor(struct rayo_actor *actor)
|
||||
{
|
||||
return !strncmp(RAT_COMPONENT, actor->type, strlen(RAT_COMPONENT));
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for all components
|
||||
*/
|
||||
static switch_status_t list_component(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
{
|
||||
return list_actors(line, cursor, matches, is_component_actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if a record component
|
||||
*/
|
||||
static switch_bool_t is_record_actor(struct rayo_actor *actor)
|
||||
{
|
||||
return is_component_actor(actor) && !strcmp(actor->subtype, "record");
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for all components
|
||||
*/
|
||||
static switch_status_t list_record(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
{
|
||||
return list_actors(line, cursor, matches, is_record_actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if an output component
|
||||
*/
|
||||
static switch_bool_t is_output_actor(struct rayo_actor *actor)
|
||||
{
|
||||
return is_component_actor(actor) && !strcmp(actor->subtype, "output");
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for all components
|
||||
*/
|
||||
static switch_status_t list_output(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
{
|
||||
return list_actors(line, cursor, matches, is_output_actor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if an input component
|
||||
*/
|
||||
static switch_bool_t is_input_actor(struct rayo_actor *actor)
|
||||
{
|
||||
return is_component_actor(actor) && !strcmp(actor->subtype, "input");
|
||||
}
|
||||
|
||||
/**
|
||||
* Console auto-completion for all components
|
||||
*/
|
||||
static switch_status_t list_input(const char *line, const char *cursor, switch_console_callback_match_t **matches)
|
||||
{
|
||||
return list_actors(line, cursor, matches, is_input_actor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3708,134 +3842,20 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_rayo_load)
|
|||
globals.console = rayo_console_client_create();
|
||||
|
||||
switch_console_set_complete("add rayo status");
|
||||
switch_console_set_complete("add rayo cmd ::rayo::list_internal");
|
||||
switch_console_set_complete("add rayo msg ::rayo::list_external");
|
||||
switch_console_set_complete("add rayo presence ::rayo::list_all online");
|
||||
switch_console_set_complete("add rayo presence ::rayo::list_all offline");
|
||||
switch_console_set_complete("add rayo cmd ::rayo::list_all");
|
||||
switch_console_set_complete("add rayo presence ::rayo::list_server online");
|
||||
switch_console_set_complete("add rayo presence ::rayo::list_server offline");
|
||||
switch_console_add_complete_func("::rayo::list_all", list_all);
|
||||
switch_console_add_complete_func("::rayo::list_internal", list_internal);
|
||||
switch_console_add_complete_func("::rayo::list_external", list_external);
|
||||
switch_console_add_complete_func("::rayo::list_all", list_all);
|
||||
switch_console_add_complete_func("::rayo::list_server", list_server);
|
||||
switch_console_add_complete_func("::rayo::list_call", list_call);
|
||||
switch_console_add_complete_func("::rayo::list_component", list_component);
|
||||
switch_console_add_complete_func("::rayo::list_record", list_record);
|
||||
switch_console_add_complete_func("::rayo::list_output", list_output);
|
||||
switch_console_add_complete_func("::rayo::list_input", list_input);
|
||||
|
||||
rayo_add_cmd_alias("ping", "<iq type=\"get\"><ping xmlns=\""IKS_NS_XMPP_PING"\"/></iq>");
|
||||
rayo_add_cmd_alias("answer", "<answer xmlns=\""RAYO_NS"\"/>");
|
||||
rayo_add_cmd_alias("hangup", "<hangup xmlns=\""RAYO_NS"\"/>");
|
||||
rayo_add_cmd_alias("stop", "<stop xmlns=\""RAYO_EXT_NS"\"/>");
|
||||
rayo_add_cmd_alias("pause", "<pause xmlns=\""RAYO_OUTPUT_NS"\"/>");
|
||||
rayo_add_cmd_alias("resume", "<resume xmlns=\""RAYO_OUTPUT_NS"\"/>");
|
||||
rayo_add_cmd_alias("speed-up", "<speed-up xmlns=\""RAYO_OUTPUT_NS"\"/>");
|
||||
rayo_add_cmd_alias("speed-down", "<speed-down xmlns=\""RAYO_OUTPUT_NS"\"/>");
|
||||
rayo_add_cmd_alias("volume-up", "<volume-up xmlns=\""RAYO_OUTPUT_NS"\"/>");
|
||||
rayo_add_cmd_alias("volume-down", "<volume-down xmlns=\""RAYO_OUTPUT_NS"\"/>");
|
||||
rayo_add_cmd_alias("record", "<record xmlns=\""RAYO_RECORD_NS"\"/>");
|
||||
rayo_add_cmd_alias("record_pause", "<pause xmlns=\""RAYO_RECORD_NS"\"/>");
|
||||
rayo_add_cmd_alias("record_resume", "<resume xmlns=\""RAYO_RECORD_NS"\"/>");
|
||||
rayo_add_cmd_alias("prompt_barge", "<prompt xmlns=\""RAYO_PROMPT_NS"\" barge-in=\"true\">"
|
||||
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-times=\"5\"><document content-type=\"application/ssml+xml\"><![CDATA[<speak><p>Please press a digit.</p></speak>]]></document></output>"
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"dtmf\" initial-timeout=\"5000\" inter-digit-timeout=\"3000\">"
|
||||
"<grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digit\" scope=\"public\"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]>"
|
||||
"</grammar></input>"
|
||||
"</prompt>");
|
||||
|
||||
rayo_add_cmd_alias("prompt_barge_mrcp", "<prompt xmlns=\""RAYO_PROMPT_NS"\" barge-in=\"true\">"
|
||||
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-times=\"5\"><document content-type=\"application/ssml+xml\"><![CDATA[<speak><p>Please press a digit.</p></speak>]]></document></output>"
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"any\" initial-timeout=\"5000\" inter-digit-timeout=\"3000\">"
|
||||
"<grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digit\" scope=\"public\"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]>"
|
||||
"</grammar></input>"
|
||||
"</prompt>");
|
||||
|
||||
rayo_add_cmd_alias("prompt_no_barge", "<prompt xmlns=\""RAYO_PROMPT_NS"\" barge-in=\"false\">"
|
||||
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-times=\"2\"><document content-type=\"application/ssml+xml\"><![CDATA[<speak><p>Please press a digit.</p></speak>]]></document></output>"
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"dtmf\" initial-timeout=\"5000\" inter-digit-timeout=\"3000\">"
|
||||
"<grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digit\" scope=\"public\"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]>"
|
||||
"</grammar></input>"
|
||||
"</prompt>");
|
||||
|
||||
rayo_add_cmd_alias("prompt_long", "<prompt xmlns=\""RAYO_PROMPT_NS"\" barge-in=\"true\">"
|
||||
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-times=\"100\"><document content-type=\"application/ssml+xml\"><![CDATA[<speak><audio src=\"http://phono.com/audio/troporocks.mp3\"/></speak>]]></document></output>"
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"dtmf\" initial-timeout=\"5000\" inter-digit-timeout=\"3000\">"
|
||||
"<grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digit\" scope=\"public\"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></rule></grammar>]]>"
|
||||
"</grammar></input>"
|
||||
"</prompt>");
|
||||
|
||||
rayo_add_cmd_alias("prompt_multi_digit", "<prompt xmlns=\""RAYO_PROMPT_NS"\" barge-in=\"true\">"
|
||||
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-times=\"100\"><document content-type=\"application/ssml+xml\"><![CDATA[<speak><audio src=\"http://phono.com/audio/troporocks.mp3\"/></speak>]]></document></output>"
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"dtmf\" initial-timeout=\"5000\" inter-digit-timeout=\"3000\">"
|
||||
"<grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digits\" scope=\"public\"><item repeat=\"1-4\"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]>"
|
||||
"</grammar></input>"
|
||||
"</prompt>");
|
||||
|
||||
rayo_add_cmd_alias("prompt_terminator", "<prompt xmlns=\""RAYO_PROMPT_NS"\" barge-in=\"true\">"
|
||||
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-times=\"100\"><document content-type=\"application/ssml+xml\"><![CDATA[<speak><audio src=\"http://phono.com/audio/troporocks.mp3\"/></speak>]]></document></output>"
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"dtmf\" initial-timeout=\"5000\" inter-digit-timeout=\"3000\" terminator=\"#\">"
|
||||
"<grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digits\" scope=\"public\"><item repeat=\"1-4\"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]>"
|
||||
"</grammar></input>"
|
||||
"</prompt>");
|
||||
|
||||
rayo_add_cmd_alias("prompt_input_bad", "<prompt xmlns=\""RAYO_PROMPT_NS"\" barge-in=\"true\">"
|
||||
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-times=\"100\"><document content-type=\"application/ssml+xml\"><![CDATA[<speak><audio src=\"http://phono.com/audio/troporocks.mp3\"/></speak>]]></document></output>"
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"dtf\" initial-timeout=\"5000\" inter-digit-timeout=\"3000\">"
|
||||
"<grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digits\" scope=\"public\"><item repeat=\"4\"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]>"
|
||||
"</grammar></input>"
|
||||
"</prompt>");
|
||||
|
||||
rayo_add_cmd_alias("prompt_output_bad", "<prompt xmlns=\""RAYO_PROMPT_NS"\" barge-in=\"true\">"
|
||||
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-time=\"100\"><document content-type=\"application/ssml+xml\"><![CDATA[<speak><audio src=\"http://phono.com/audio/troporocks.mp3\"/></speak>]]></document></output>"
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"dtmf\" initial-timeout=\"5000\" inter-digit-timeout=\"3000\">"
|
||||
"<grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digits\" scope=\"public\"><item repeat=\"4\"><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item></one-of></item></rule></grammar>]]>"
|
||||
"</grammar></input>"
|
||||
"</prompt>");
|
||||
rayo_add_cmd_alias("input", "<input xmlns=\""RAYO_INPUT_NS"\" mode=\"dtmf\" initial-timeout=\"5000\" inter-digit-timeout=\"3000\">"
|
||||
"<grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar mode=\"dtmf\"><rule id=\"digits\" scope=\"public\"><item><one-of><item>0</item><item>1</item><item>2</item><item>3</item><item>4</item><item>5</item><item>6</item><item>7</item><item>8</item><item>9</item><item>*</item><item>#</item></one-of></item></rule></grammar>]]>"
|
||||
"</grammar></input>");
|
||||
rayo_add_cmd_alias("output_bad",
|
||||
"<output xmlns=\""RAYO_OUTPUT_NS"\" repeat-time=\"100\"></output>");
|
||||
rayo_add_cmd_alias("join_mixer_duplex",
|
||||
"<join xmlns=\""RAYO_NS"\" mixer-name=\"test\" direction=\"duplex\"/>");
|
||||
rayo_add_cmd_alias("join_mixer_send",
|
||||
"<join xmlns=\""RAYO_NS"\" mixer-name=\"test\" direction=\"send\"/>");
|
||||
rayo_add_cmd_alias("join_mixer_recv",
|
||||
"<join xmlns=\""RAYO_NS"\" mixer-name=\"test\" direction=\"recv\"/>");
|
||||
rayo_add_cmd_alias("unjoin_mixer",
|
||||
"<unjoin xmlns=\""RAYO_NS"\" mixer-name=\"test\"/>");
|
||||
rayo_add_cmd_alias("unjoin",
|
||||
"<unjoin xmlns=\""RAYO_NS"\"/>");
|
||||
rayo_add_cmd_alias("input_voice_yesno_unimrcp",
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"voice\" recognizer=\"unimrcp\"><grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar xmlns=\"http://www.w3.org/2001/06/grammar\" "
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
|
||||
"xsi:schemaLocation=\"http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd\" "
|
||||
"xml:lang=\"en-US\" version=\"1.0\">"
|
||||
"<rule id=\"yesno\"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>]]></grammar></input>");
|
||||
rayo_add_cmd_alias("input_voice_yesno_unimrcp_timeout",
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"voice\" recognizer=\"unimrcp\" max-silence=\"5\" initial-timeout=\"5000\"><grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar xmlns=\"http://www.w3.org/2001/06/grammar\" "
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
|
||||
"xsi:schemaLocation=\"http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd\" "
|
||||
"xml:lang=\"en-US\" version=\"1.0\">"
|
||||
"<rule id=\"yesno\"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>]]></grammar></input>");
|
||||
rayo_add_cmd_alias("input_voice_yesno_pocketsphinx",
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"voice\" recognizer=\"pocketsphinx\" max-silence=\"5000\" initial-timeout=\"5000\"><grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar xmlns=\"http://www.w3.org/2001/06/grammar\" "
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
|
||||
"xsi:schemaLocation=\"http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd\" "
|
||||
"xml:lang=\"en-US\" version=\"1.0\">"
|
||||
"<rule id=\"yesno\"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>]]></grammar></input>");
|
||||
rayo_add_cmd_alias("input_voice_yesno_default",
|
||||
"<input xmlns=\""RAYO_INPUT_NS"\" mode=\"voice\"><grammar content-type=\"application/srgs+xml\">"
|
||||
"<![CDATA[<grammar xmlns=\"http://www.w3.org/2001/06/grammar\" "
|
||||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
|
||||
"xsi:schemaLocation=\"http://www.w3.org/2001/06/grammar http://www.w3.org/TR/speech-grammar/grammar.xsd\" "
|
||||
"xml:lang=\"en-US\" version=\"1.0\">"
|
||||
"<rule id=\"yesno\"><one-of><item>yes</item><item>no</item></one-of></rule></grammar>]]></grammar></input>");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -3844,9 +3864,15 @@ rayo_add_cmd_alias("input_voice_yesno_unimrcp_timeout",
|
|||
*/
|
||||
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_rayo_shutdown)
|
||||
{
|
||||
switch_console_del_complete_func("::rayo::list_all");
|
||||
switch_console_del_complete_func("::rayo::list_internal");
|
||||
switch_console_del_complete_func("::rayo::list_external");
|
||||
switch_console_del_complete_func("::rayo::list_all");
|
||||
switch_console_del_complete_func("::rayo::list_server");
|
||||
switch_console_del_complete_func("::rayo::list_call");
|
||||
switch_console_del_complete_func("::rayo::list_component");
|
||||
switch_console_del_complete_func("::rayo::list_record");
|
||||
switch_console_del_complete_func("::rayo::list_output");
|
||||
switch_console_del_complete_func("::rayo::list_input");
|
||||
switch_console_set_complete("del rayo");
|
||||
|
||||
/* stop XMPP streams */
|
||||
|
|
|
@ -162,6 +162,7 @@ extern const char *rayo_call_get_dcp_jid(struct rayo_call *call);
|
|||
|
||||
#define rayo_component_init(component, pool, type, subtype, id, parent, client_jid) _rayo_component_init(component, pool, type, subtype, id, parent, client_jid, __FILE__, __LINE__)
|
||||
extern struct rayo_component *_rayo_component_init(struct rayo_component *component, switch_memory_pool_t *pool, const char *type, const char *subtype, const char *id, struct rayo_actor *parent, const char *client_jid, const char *file, int line);
|
||||
extern switch_bool_t is_component_actor(struct rayo_actor *);
|
||||
|
||||
typedef iks *(*rayo_actor_xmpp_handler)(struct rayo_actor *, struct rayo_message *, void *);
|
||||
extern void rayo_actor_command_handler_add(const char *type, const char *subtype, const char *name, rayo_actor_xmpp_handler fn);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
struct rayo_component *rayo_component_locate(const char *id, const char *file, int line)
|
||||
{
|
||||
struct rayo_actor *actor = rayo_actor_locate_by_id(id, file, line);
|
||||
if (actor && !strncmp(RAT_COMPONENT, actor->type, strlen(RAT_COMPONENT))) {
|
||||
if (actor && is_component_actor(actor)) {
|
||||
return RAYO_COMPONENT(actor);
|
||||
} else if (actor) {
|
||||
RAYO_UNLOCK(actor);
|
||||
|
|
Loading…
Reference in New Issue