Hi

 

I find below documentation for hangup after bridge

 

hangup_after_bridge

BOOLEAN Controls what happens to a calling (A) party when in a bridge state and the called (B) party hangs up. If true the dialplan will stop processing and the A leg will be terminated when the B leg terminates. If false (default) the dialplan continues to be processed after the B leg terminates. This is checked after park_after_bridge and transfer_after_bridge.

 

In the below code within switch_ivr_bridge.c we are checking park_after_bridge transfer after bridge (highlighted). However we are not checking for hangup_after_bridge setting and hanging up the channel. Is there any reason for missing the check of hangup_after_bridge flag before hanging up the channel?

 

static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *session)

{

       switch_channel_t *channel = switch_core_session_get_channel(session);

       switch_ivr_bridge_data_t *bd = switch_channel_get_private(channel, "_bridge_");

       switch_channel_state_t state;

       const char *var;

 

       if (bd) {

              switch_channel_set_private(channel, "_bridge_", NULL);

              if (bd->session == session && *bd->b_uuid) {

                     audio_bridge_thread(NULL, (void *) bd);

                     switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);

              } else {

                     switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);

              }

       } else {

              switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);

       }

       switch_channel_clear_state_handler(channel, &audio_bridge_peer_state_handlers);

 

       state = switch_channel_get_state(channel);

 

       if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) &&

              !switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit && state != CS_PARK && state != CS_ROUTING &&

              state == CS_EXCHANGE_MEDIA && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {

 

              if (state < CS_HANGUP && switch_true(switch_channel_get_variable(channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {

                     switch_ivr_park_session(session);

                     return SWITCH_STATUS_FALSE;

              } else if (state < CS_HANGUP && (var = switch_channel_get_variable(channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {

                     transfer_after_bridge(session, var);

                     return SWITCH_STATUS_FALSE;

              }

 

              if (switch_channel_test_flag(channel, CF_INTERCEPTED)) {

                     switch_channel_clear_flag(channel, CF_INTERCEPT);

                     switch_channel_clear_flag(channel, CF_INTERCEPTED);

                     return SWITCH_STATUS_FALSE;

              } else {

                     if (switch_channel_test_flag(channel, CF_INTERCEPT)) {

                           switch_channel_hangup(channel, SWITCH_CAUSE_PICKED_OFF);

                     } else {

                           if (!switch_channel_test_flag(channel, CF_ANSWERED)) {

                                  int x = 0;

 

                                  if (switch_channel_execute_on(channel, "execute_on_orphaned_bleg") == SWITCH_STATUS_SUCCESS) {

                                         x++;

                                  }

 

                                  if (switch_channel_api_on(channel, "api_on_orphaned_bleg") == SWITCH_STATUS_SUCCESS) {

                                         x++;

                                  }

 

                                  if (!x) {

                                         switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);

                                  }

                                 

                           } else {

                                  switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);

                           }

                     }

              }

       }

 

       if (switch_channel_get_state(channel) == CS_EXCHANGE_MEDIA) {

              switch_channel_set_variable(channel, "park_timeout", "3");

              switch_channel_set_state(channel, CS_PARK);

       }

 

       return SWITCH_STATUS_FALSE;

}

 

Thanks

Darshan