Hi,
I’ve been developing an application module in C/C++
for our online personals type of application. All are well until I need
to bridge two existing sessions together and need to find a way to monitor DTMF
key (*) so I can un-bridge them and hopefully put them back to where they were.
Call flow is like:
Caller 1 sends recorded message to Caller 2 asking for live
connection
Caller 1 in a loop of listening to wait music and checking
Caller 2 response (via database) (is there a better way like putting
caller 1 on hold and somehow signal it from Caller 2’s thread?)
Caller 2 hears message and accepts (update database)
*bridge Caller 1 and Caller 2
*monitor DTMF for asterisk key
*un-bridge and send them back to where they were so they can
continue to exchange messages with other callers
I tried switch_ivr_uuid_bridge function like below:
Originator side:
switch_ivr_uuid_bridge
//set up args so it stops on any dtmf
while
(switch_channel_ready(channel))
{
status
= switch_ivr_sleep(session, 60000, SWITCH_TRUE, &args);
if
(status == SWITCH_BREAK && dtmf_key == ‘*’)
break;
}
Originatee side:
//set up args so it stops on any dtmf
while
(switch_channel_ready(channel))
{
status
= switch_ivr_sleep(session, 60000, SWITCH_TRUE, &args);
if
(status == SWITCH_BREAK && dtmf_key == ‘*’)
break;
}
The problem is after switch_ivr_uuid_bridge call, the
channel state has changed and switch_channel_ready becomes false and I immediately
got out of the loop and eventually exit from the thread.
How do I make this work? Any suggestions are
appreciated. Thanks.
Eddy Chu