[Freeswitch-users] How to change Music-on-hold while digit_bind_action is used ?

Michael Collins msc at freeswitch.org
Wed Apr 24 08:53:57 MSD 2013


Hi Julien,

Welcome to FreeSWITCH! Glad you like it.

To answer your initial question: yes, what you are trying to accomplish is
definitely possible. However if you want the caller ("A" in your scenario)
to press only a single key then you can't use bind_meta_app (BMA). BMA
requires two key presses: * and one other DTMF. That's why your scenario
requires ** to trigger.

If you want to have only a single key press trigger your Lua script then
you'll need to use bind_digit_action (BDA). It's a bit more complicated,
but it's also more powerful. Start here:
http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_bind_digit_action

You should be able to match on just a single * key press. The dialplan will
have something kind of like this:

<action application="bind_digit_action"
data="my_realm,*,exec:lua,send_email.lua,a,peer"/>
<action application="digit_action_set_realm" data="my_realm"/>

Tinker with that and remember the standard
disclaimer<http://wiki.freeswitch.org/wiki/Reporting_Bugs#Standard_Disclaimer>before
you tell me it doesn't work. :)

Have fun!
-MC


On Mon, Apr 22, 2013 at 2:09 AM, julien terrasson <
julien.terrasson at gmail.com> wrote:

> Hi,
>
> First of all, i've been discovering freeswitch recently and i found that
> this is an awesome piece of software. I really enjoy discovering the
> possibilities of the software and creating scenarios. Thanks for all the
> people who made this possible and available.
>
> The reason i'm posting is that i need help me to guide me in
> troubleshooting..
>
> This is the scenario i would like to acheive :*
> *
> ***************************************************
>
> * A & B are registered on FS
> * A call B.
> * When A press the star key
> => B is play a prompt that ask him if he would like to receive an email.
> => B can then choose to accept (by pressing "1") or reject (by pressing
> "2")
> Meanwhile, A is played a specific moh that tell him that he have to wait
> for B answer.
>
> This the way i tried to implement it :
> ******************************************
>
> DIALPLAN :
>
> i'm using bind_digit_action with "*" to start a lua script on the *b_leg
> context*.
> => "bind_digit_action","my_context,*,exec:lua,send_email.lua,a,*peer*"
>
> EMAIL.LUA  :
>
> *=> Change the moh on the A leg
> *api:executeString("uuid_setvar ".. a_leg_uuid .. " hold_music
> /usr/local/freeswitch/sounds/fr/ca/june/voxService/fr_wait_email.wav");
>
> *=> Play and request digit (B leg)*
> digit = session:playAndGetDigits(1, 1, 1, 5000, '#',
> '/usr/local/freeswitch/sounds/fr/ca/june/voxService/fr_ask_email.wav', '',
> '\\d+');
>
> 3/ Result :
> *************
> When "*" is pressed for the 1st time, FS act as if moh wasn't change.
> It does only take into account the change the second time "*" is pressed.
>
> i assume thats moh change can only be taken into account when
> bind_digit_action is over.
>
> So i would like to know if there is any existing way to change this
> behaviour ?
> If not, what would be the best way of implementing this scenario ?
>
> Thanks for your answers.
>
> Julien
>
>
> _________________________________________________________________________
> 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
>
>


-- 
Michael S Collins
Twitter: @mercutioviz
http://www.FreeSWITCH.org
http://www.ClueCon.com
http://www.OSTAG.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130423/96e56007/attachment.html 


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