[Freeswitch-users] Session-wise Language Setting

Tim St. Pierre fs-list at communicatefreely.net
Mon Apr 2 19:49:39 MSD 2012


Hi Sharad,

When you specify a sound file to play like that, it uses a prefix 
defined (usually) in vars.xml, and it doesn't expand to the language.  
The assumption by the designers I assume was that you would change the 
prefix to your language.

For multi-language systems, you should always use phrase macros.

On our system, we made several custom phrase macros that are very 
simple, but will select the correct audio file based on the language.

Any time you would normally specify an audio file, you can instead use 
phrase:my_macro:data

Then, create a phrase macro for each language that will match your data 
and play the appropriate audio file.

It could be something as simple as this:
English:

<macro name="ivr-file">
      <input pattern="^(\w+)$">
        <match>
            <action function="play-file" 
data="$${media_dir}/en/us/callie/ivr/$1wav"/>
        </match>
      </input>
</macro

And then in your Russian phrase macros:

<macro name="ivr-file">
      <input pattern="^(\w+)$">
        <match>
            <action function="play-file" 
data="$${media_dir}/ru/RU/elena/ivr/$1wav"/>
        </match>
      </input>
</macro

Be creative here.  Phrase macros are your friend.  I would limit playing 
audio files to things like sound effects, or other non-verbal recordings.


Sharad Garg wrote:
>
> Hello Mr. MC
>
> Thanks for the link.....seems working.
>
> But observed another point i.e. it works only for the speech phrase 
> macros.
>
> When I write a simple xml dialplan like this -
>
>     <extension name="lang_test">
>          <condition field="destination_number" expression="^(3333)$">
>               <action application="set" data="bypass_media=true"/>
>               <action application="answer"/>
>               <action application="sleep" data="1000"/>
>               <action application="set" data="default_language=ru"/>
>               <action application="playback" data="ivr/test.wav"/>
>          </condition>
>     </extension>
>
> This dialplan still plays the test.wav which is in 
> <base_dir>/sounds/en/us/callie/ivr/8000/test.wav. While it should play 
> the test.wav from <base_dir>/sounds/ru/RU/elena/ivr/8000/test.wav. & 
> at the same time, speech phrase macro use the 'ru' language.
>
> So when I did my googling, I found that the language settings is only 
> for speech phrase macros. It is not implemented in Freeswitch to use 
> the desired languages at all places.
>
> So need to know is there any latest development on this ?
>
> Thanks in advance.
>
> Regards
>
> Sharad
>
>  
>
>     ----- Original Message -----
>     *From:* Michael Collins <mailto:msc at freeswitch.org>
>     *To:* FreeSWITCH Users Help
>     <mailto:freeswitch-users at lists.freeswitch.org>
>     *Sent:* Saturday, March 31, 2012 1:15 AM
>     *Subject:* Re: [Freeswitch-users] Session-wise Language Setting
>
>
>
>     On Fri, Mar 30, 2012 at 5:13 AM, Sharad Garg <sharad at coraltele.com
>     <mailto:sharad at coraltele.com>> wrote:
>
>         Thanks Peter...yes it works.
>
>         Just a last query - Is there any API for setting the same so
>         that it can be
>         used from Javascript.
>
>         Best Regards
>         Sharad
>
>
>     http://wiki.freeswitch.org/wiki/Mod_commands#uuid_setvar
>
> ------------------------------------------------------------------------
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>   




Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list