Thanks for responding and for your help.
The xml and confirm.js are attached below. Basically trying to bypass_media after the leg B presses 1 to accept the call. I tried, using bypass_media_after_bridge=true, but the re-invite appears to be done before the confirm.js, So the media is successfully rerouted, but BEFORE the leg b never gets hear a prompt or gets the opportunity to press 1.
To get round this I am trying to manually bypass_media in the confirm.js script with apiExecute("uuid_media", "off " + session.uuid);. However only the B leg is reinvited (and media is routed correctly). I don't see the A leg reinvite, and then a BYE is issueed on both legs.
<extension name="public_did">
<condition field="destination_number" expression="^(12125553666)$">
<action application="set" data="domain_name=$${domain}"/>
<action application="set" data="call_timeout=60"/>
<action application="set" data="group_confirm_key=exec"/>
<action application="set" data="group_confirm_file=javascript confirm.js"/><
<action application="bridge" data="[leg_confirm=y]sofia/gateway/broadvox/6095553828"/>
</condition>
</extension>
</include>
This is the confirm.js:
// confirm.js - FreeSwitch call confirmation script
// (c) 2009 - St‚phane Alnet
// License: GPL2 or above
console_log("info", "Destination: "+ session.destination + "\n");
if(!session.getVariable('leg_confirm'))
{
console_log("info", "No need to confirm, connect the call!\n");
exit();
}
var confirmed = false;
var confirmation_digit = "1";
var try_count = 6;
var prompt_file = "prompts/ToAcceptThisCallPress1.wav";
function onInput( session, type, data, arg ) {
if ( type == "dtmf" ) {
console_log( "info", "Got digit " + data.digit + "\n" );
if ( data.digit == confirmation_digit ) {
confirmed = true;
console_log( "info", "Confirming session..\n" );
return(false);
}
}
return(true);
}
if ( session.ready() )
{
session.answer();
session.flushDigits();
console_log("info", "Starting confirmation\n");
var count = try_count;
while( session.ready() && ! confirmed && count-- > 0 )
{
session.execute("sleep","200");
session.streamFile( prompt_file, onInput );
}
if( ! confirmed )
{
console_log("info", "Not confirmed\n");
session.hangup();
}
else
{
apiExecute("uuid_media", "off " + session.uuid);
console_log("info", "Confirmed\n");
}
}
else
{
console_log("info", "Session is not ready.\n");
}