adding api to release all calls/context during Subtract with Context ALL(C=*{S=*}) request processing

This commit is contained in:
Kapil Gupta 2012-09-07 12:10:16 -04:00
parent 84cd6f0873
commit 50b044d66f
6 changed files with 40 additions and 1 deletions

View File

@ -781,6 +781,22 @@ switch_status_t megaco_profile_destroy(megaco_profile_t **profile)
return SWITCH_STATUS_SUCCESS;
}
switch_status_t mgco_process_mgc_failure(SuId suId)
{
megaco_profile_t* profile = NULL;
if(NULL == (profile = megaco_get_profile_by_suId(suId))){
return SWITCH_STATUS_FALSE;
}
if(0x01 == profile->peer_active){
/* MGC failure during active association , release all on-going calls contexts */
megaco_release_all_calls(profile);
profile->peer_active = 0x00;
}
return SWITCH_STATUS_SUCCESS;
}
switch_status_t mgco_init_ins_service_change(SuId suId)
{

View File

@ -1335,7 +1335,7 @@ switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoComma
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO," SUB Request for ALL context \n");
/* TODO */
megaco_release_all_calls(mg_profile);
/* As of now sending +ve response */
goto response;

View File

@ -247,6 +247,8 @@ switch_status_t mg_activate_ito_timer(megaco_profile_t* profile);
void mg_restart_inactivity_timer(megaco_profile_t* profile);
switch_status_t mgco_process_mgc_failure(SuId suId);
/****************************************************************************************************************/
/* MG Stack defines */

View File

@ -76,6 +76,7 @@ void handle_mg_alarm(Pst *pst, MgMngmt *usta)
{
case LMG_EVENT_ALL_MGC_FAILED:
{
//mgco_process_mgc_failure(usta->t.usta.alarmInfo.sapId);
len = len + sprintf(prBuf+len, "ALL MGC Failed ");
break;
}

View File

@ -230,6 +230,25 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_media_gateway_shutdown)
return SWITCH_STATUS_SUCCESS;
}
/*****************************************************************************************************************************/
switch_status_t megaco_release_all_calls(megaco_profile_t* mg_profile)
{
mg_context_t* ctx = NULL;
uint32_t context_id = 0x00;
if(NULL == mg_profile) return SWITCH_STATUS_FALSE;
for (context_id = 0; context_id < MG_MAX_CONTEXTS; context_id++) {
ctx = megaco_get_context(mg_profile, context_id);
if(NULL == ctx) continue;
megaco_context_sub_all_termination(ctx);
megaco_release_context(ctx);
}
return SWITCH_STATUS_SUCCESS;
}
/*****************************************************************************************************************************/
switch_status_t megaco_start_all_profiles()
{

View File

@ -332,6 +332,7 @@ mg_termination_t* megaco_find_termination_by_span_chan(megaco_profile_t *profile
switch_status_t megaco_start_all_profiles(void);
switch_status_t megaco_profile_start(const char *profilename);
switch_status_t megaco_profile_destroy(megaco_profile_t **profile);
switch_status_t megaco_release_all_calls(megaco_profile_t* mg_profile);
uint32_t mg_rtp_request_id(megaco_profile_t *profile);
void mg_rtp_release_id(megaco_profile_t *profile, uint32_t id);