[Freeswitch-users] Playing on hold music for certain inbound numbers

Tom Angle tangle70 at gmail.com
Tue Oct 7 19:25:01 MSD 2014


I tried the below code and it failed to set the variable. I posted the 
full log in pastebin.

Dialplan: sofia/internal/1005 at 192.168.31.10 Regex (FAIL) [set my hold 
music] effective_caller_id_number() =~ /^(1000)$/ break=on-true
Dialplan: sofia/internal/1005 at 192.168.31.10 Regex (FAIL) [set my hold 
music] effective_caller_id_number() =~ /^(1005)$/ break=on-true

I am not sure why setting this variable failed. I set console loglevel 
DEBUG. Is there some other way to get more info on why it failed? Thanks

Tom

On 10/3/2014 5:27 PM, Michael Collins wrote:
> In the long term I would create some sort of lookup, like using a Lua 
> script and database. However, in the short term you could do something 
> very simple, like create a utility extension whose sole job it is to 
> set the my_hold_music variable. Then you can play the hold music in 
> the extension for 4000. Here's a sample:
>
> <extension name="set my hold music" continue="true">
>   <condition break="never">
>     <!-- default to standard hold music -->
>     <action application="set" data="my_hold_music=${hold_music}"/>
>   </condition>
>   <condition field="effective_caller_id_number" expression="^(1000)$" 
> break="on-true">
>     <action application="set" data="my_hold_music=/path/to/file1.wav"/>
>   </condition>
>   <condition field="effective_caller_id_number" expression="^(1001)$" 
> break="on-true">
>     <action application="set" data="my_hold_music=/path/to/file2.wav"/>
>   </condition>
>   <!-- add a condition for each caller id value... -->
> </extension>
>
> <extension name="x4000">
>   <condition field="destination_number" expression="^(4000)$">
>     <action application="answer"/>
>     <action application="sleep" data="1000"/>
>     <action application="playback" data="${my_hold_music}"/>
>   </condition>
> </extension>
>
> Play around with that and see what happens. Don't forget about the 
> standard disclaimer 
> <https://wiki.freeswitch.org/wiki/Reporting_Bugs#Standard_Disclaimer>. :)
> -MC
>
> On Fri, Oct 3, 2014 at 1:40 PM, Tom Angle <tangle70 at gmail.com 
> <mailto:tangle70 at gmail.com>> wrote:
>
>     In plain english. I want an incoming SIP call to user 4000 to go
>     directly to hold and play a wav file. Also I want to assign
>     different wav file to different incoming numbers. This was a
>     customer can choose what on hold music their clients will hear.
>
>     I posted the cli output in pastebin under Tom Angle. Thanks
>
>     Tom
>
>     On 10/3/2014 3:17 PM, Michael Collins wrote:
>>     Welcome to FreeSWITCH!
>>
>>     The folks around here will be happy to help. In this case I
>>     believe they/we just need some additional information. I
>>     recommend that you get a console debug log and drop it into
>>     pastebin.freeswitch.org <http://pastebin.freeswitch.org> and set
>>     the syntax highlight to "FreeSWITCH Log".
>>
>>     Also, it would probably help if you gave us a plain language
>>     description of what you are trying to do with that dialplan
>>     snippet. I see a lot of anti-actions which may or may not be what
>>     you need. Maybe a brief description would help, something like:
>>     "When caller id 1005 calls in, play file1.wav and then hangup."
>>
>>     Lastly I recommend reviewing this wiki page:
>>     https://confluence.freeswitch.org/display/FREESWITCH/Troubleshooting+Debugging
>>
>>     It will get you on the right path for figuring out what
>>     information to collect for the troubleshooting process.
>>
>>     -Michael
>>
>>     On Fri, Oct 3, 2014 at 8:47 AM, Tom Angle <tangle70 at gmail.com
>>     <mailto:tangle70 at gmail.com>> wrote:
>>
>>         I am new to Freeswitch.
>>
>>         I am trying to create a MOH server for our Metaswitch.
>>         Currently I have
>>         it working, but it will only play on audio file. I would like
>>         to set it
>>         up to play a particular audio depending on the inbound phone
>>         number. The
>>         below code is in my dialplan/default.xml and does not work. Could
>>         someone tell me what I am doing wrong? Thanks for any help.
>>
>>
>>              <extension name="4000_hold_music">
>>                <condition field="effective_caller_id_number"
>>         expression="^(1000)$">
>>                  <action application="answer"/>
>>                  <action application="execute_extension"
>>         data="is_secure XML
>>         features"/>
>>                  <action application="playback" data="$${hold_music}"/>
>>                  <anti-action application="set"
>>         data="zrtp_secure_media=true"/>
>>                  <anti-action application="answer"/>
>>                  <anti-action application="execute_extension"
>>         data="is_zrtp_secure XML features"/>
>>                  <anti-action application="playback"
>>         data="/music/music1.wav"/>
>>                </condition>
>>
>>                <condition field="effective_caller_id_number"
>>         expression="^(1005)$">
>>                  <action application="answer"/>
>>                  <action application="execute_extension"
>>         data="is_secure XML
>>         features"/>
>>                  <action application="playback" data="$${hold_music}"/>
>>                  <anti-action application="set"
>>         data="zrtp_secure_media=true"/>
>>                  <anti-action application="answer"/>
>>                  <anti-action application="execute_extension"
>>         data="is_zrtp_secure XML features"/>
>>                  <anti-action application="playback"
>>         data="/music/music4.wav"/>
>>                </condition>
>>              </extension>
>>
>>         _________________________________________________________________________
>>         Professional FreeSWITCH Consulting Services:
>>         consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>>         http://www.freeswitchsolutions.com
>>
>>         Official FreeSWITCH Sites
>>         http://www.freeswitch.org
>>         http://confluence.freeswitch.org
>>         http://www.cluecon.com
>>
>>         
>>         
>>
>>         FreeSWITCH-users mailing list
>>         FreeSWITCH-users at lists.freeswitch.org
>>         <mailto: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
>>
>>
>>
>>
>>     _________________________________________________________________________
>>     Professional FreeSWITCH Consulting Services:
>>     consulting at freeswitch.org  <mailto:consulting at freeswitch.org>
>>     http://www.freeswitchsolutions.com
>>
>>     Official FreeSWITCH Sites
>>     http://www.freeswitch.org
>>     http://confluence.freeswitch.org
>>     http://www.cluecon.com
>>
>>     
>>     
>>
>>     FreeSWITCH-users mailing list
>>     FreeSWITCH-users at lists.freeswitch.org  <mailto: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
>
>
>     _________________________________________________________________________
>     Professional FreeSWITCH Consulting Services:
>     consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>     http://www.freeswitchsolutions.com
>
>     Official FreeSWITCH Sites
>     http://www.freeswitch.org
>     http://confluence.freeswitch.org
>     http://www.cluecon.com
>
>     
>     
>
>     FreeSWITCH-users mailing list
>     FreeSWITCH-users at lists.freeswitch.org
>     <mailto: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
>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20141007/e7581049/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list