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

Michael Collins msc at freeswitch.org
Wed Oct 8 00:30:51 MSD 2014


I think that's a copy & paste error. Shouldn't be checking against
"effective_caller_id_number" variable. Try replacing it just with
"caller_id_number" and see what happens.

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

Note the empty parentheses right after "effective_caller_id_number" - this
indicates that the variable had no value at the time of the evaluation. If
the variable had had a value then you would see the value in the parens.
Knowing that tidbit will help you tremendously as you learn how to debug
dialplan processing issues.

Have fun!

-Michael



On Tue, Oct 7, 2014 at 8:25 AM, Tom Angle <tangle70 at gmail.com> wrote:

>  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> 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 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
>>> 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
>>>
>>
>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services: consulting at freeswitch.orghttp://www.freeswitchsolutions.com
>>
>> Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon.com
>>
>> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
>>
>> FreeSWITCH-users mailing listFreeSWITCH-users at lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://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
>>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services: consulting at freeswitch.orghttp://www.freeswitchsolutions.com
>
> Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://confluence.freeswitch.orghttp://www.cluecon.com
>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
>
> FreeSWITCH-users mailing listFreeSWITCH-users at lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://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/b9e2d4f9/attachment-0001.html 


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