***************************************************
* 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