Exemplo n.º 1
0
void
_eXosip_call_free (struct eXosip_t *excontext, eXosip_call_t * jc)
{
  eXosip_dialog_t *jd;

  if (jc->c_inc_tr != NULL && jc->c_inc_tr->orig_request != NULL && jc->c_inc_tr->orig_request->call_id != NULL && jc->c_inc_tr->orig_request->call_id->number != NULL)
    _eXosip_delete_nonce (excontext, jc->c_inc_tr->orig_request->call_id->number);
  else if (jc->c_out_tr != NULL && jc->c_out_tr->orig_request != NULL && jc->c_out_tr->orig_request->call_id != NULL && jc->c_out_tr->orig_request->call_id->number != NULL)
    _eXosip_delete_nonce (excontext, jc->c_out_tr->orig_request->call_id->number);

  for (jd = jc->c_dialogs; jd != NULL; jd = jc->c_dialogs) {
    REMOVE_ELEMENT (jc->c_dialogs, jd);
    _eXosip_dialog_free (excontext, jd);
  }

  _eXosip_delete_reserved (jc->c_inc_tr);
  _eXosip_delete_reserved (jc->c_out_tr);
  if (jc->c_inc_tr != NULL)
    osip_list_add (&excontext->j_transactions, jc->c_inc_tr, 0);
  if (jc->c_out_tr != NULL)
    osip_list_add (&excontext->j_transactions, jc->c_out_tr, 0);

  osip_free (jc);
#ifndef MINISIZE
  excontext->statistics.allocated_calls--;
#endif
}
Exemplo n.º 2
0
void
_eXosip_reg_free (struct eXosip_t *excontext, eXosip_reg_t * jreg)
{

  osip_free (jreg->r_aor);
  osip_free (jreg->r_contact);
  osip_free (jreg->r_registrar);

  if (jreg->r_last_tr != NULL) {
    if (jreg->r_last_tr != NULL && jreg->r_last_tr->orig_request != NULL && jreg->r_last_tr->orig_request->call_id != NULL && jreg->r_last_tr->orig_request->call_id->number != NULL)
      _eXosip_delete_nonce (excontext, jreg->r_last_tr->orig_request->call_id->number);

    if (jreg->r_last_tr->state == IST_TERMINATED || jreg->r_last_tr->state == ICT_TERMINATED || jreg->r_last_tr->state == NICT_TERMINATED || jreg->r_last_tr->state == NIST_TERMINATED) {
      OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_INFO1, NULL, "Release a terminated transaction\n"));
      _eXosip_delete_reserved (jreg->r_last_tr);
      if (jreg->r_last_tr != NULL)
        osip_list_add (&excontext->j_transactions, jreg->r_last_tr, 0);
    }
    else {
      OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_INFO1, NULL, "Release a non-terminated transaction\n"));
      _eXosip_delete_reserved (jreg->r_last_tr);
      if (jreg->r_last_tr != NULL)
        osip_list_add (&excontext->j_transactions, jreg->r_last_tr, 0);
    }
  }

  osip_free (jreg);
}
Exemplo n.º 3
0
void _eXosip_subscribe_free(struct eXosip_t *excontext, eXosip_subscribe_t * js)
{
	/* ... */

	eXosip_dialog_t *jd;

	if (js->s_inc_tr != NULL && js->s_inc_tr->orig_request != NULL
		&& js->s_inc_tr->orig_request->call_id != NULL
		&& js->s_inc_tr->orig_request->call_id->number != NULL)
		_eXosip_delete_nonce(excontext, js->s_inc_tr->orig_request->call_id->number);
	else if (js->s_out_tr != NULL && js->s_out_tr->orig_request != NULL
			 && js->s_out_tr->orig_request->call_id != NULL
			 && js->s_out_tr->orig_request->call_id->number != NULL)
		_eXosip_delete_nonce(excontext, js->s_out_tr->orig_request->call_id->number);

	for (jd = js->s_dialogs; jd != NULL; jd = js->s_dialogs) {
		REMOVE_ELEMENT(js->s_dialogs, jd);
		_eXosip_dialog_free(excontext, jd);
	}

	_eXosip_delete_reserved(js->s_inc_tr);
	_eXosip_delete_reserved(js->s_out_tr);
	if (js->s_inc_tr != NULL)
		osip_list_add(&excontext->j_transactions, js->s_inc_tr, 0);
	if (js->s_out_tr != NULL)
		osip_list_add(&excontext->j_transactions, js->s_out_tr, 0);

	osip_free(js);
}
Exemplo n.º 4
0
void
_eXosip_dialog_free (struct eXosip_t *excontext, eXosip_dialog_t * jd)
{
  while (!osip_list_eol (jd->d_inc_trs, 0)) {
    osip_transaction_t *tr;

    tr = (osip_transaction_t *) osip_list_get (jd->d_inc_trs, 0);
    osip_list_remove (jd->d_inc_trs, 0);
    _eXosip_delete_reserved (tr);
    osip_list_add (&excontext->j_transactions, tr, 0);
  }

  while (!osip_list_eol (jd->d_out_trs, 0)) {
    osip_transaction_t *tr;

    tr = (osip_transaction_t *) osip_list_get (jd->d_out_trs, 0);
    osip_list_remove (jd->d_out_trs, 0);
    _eXosip_delete_reserved (tr);
    osip_list_add (&excontext->j_transactions, tr, 0);
  }

  osip_message_free (jd->d_200Ok);
  osip_message_free (jd->d_ack);

  osip_dialog_free (jd->d_dialog);

  osip_free (jd->d_out_trs);
  osip_free (jd->d_inc_trs);
  osip_free (jd);

  _eXosip_update (excontext);
}