Might I suggest LUA… I do exactly what you want and then some. I control the early media as well. Caller hears “Hi Tom, please hold while our phones ring”, music. “hold on Tom on while our iPhones ring”, music, “Sorry Tom, please leave a message”. The media is constructed based on the incoming line, the caller ID, etc. The LUA program even adjusts the music between verbiage so the full length is constant and takes into account resolution. The string can be used for early media or music on hold. The point is, it is far more dynamic than anything you can do in XML. BTW, the same LUA program also sets different ringtones based on caller ID. Lot’s of work but once done worth it. Something to think about.

This is how to build the string in FreeSWITCH (I added this to the wiki Feb 13): http://wiki.freeswitch.org/wiki/Mod_local_stream#Execution_Parameters
Mario G

On Oct 3, 2014, at 3:27 PM, Michael Collins <msc@freeswitch.org> 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. :)
-MC

On Fri, Oct 3, 2014 at 1:40 PM, Tom Angle <tangle70@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 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@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@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

FreeSWITCH-users mailing list
FreeSWITCH-users@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@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

FreeSWITCH-users mailing list
FreeSWITCH-users@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@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

FreeSWITCH-users mailing list
FreeSWITCH-users@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@freeswitch.org
http://www.freeswitchsolutions.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://confluence.freeswitch.org
http://www.cluecon.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org