Beispiel #1
0
static void nist_handle_transport_error(osip_transaction_t * nist, int err)
{
	__osip_transport_error_callback(OSIP_NIST_TRANSPORT_ERROR, nist, err);
	__osip_transaction_set_state(nist, NIST_TERMINATED);
	__osip_kill_transaction_callback(OSIP_NIST_KILL_TRANSACTION, nist);
	/* TODO: MUST BE DELETED NOW */
}
Beispiel #2
0
static void ict_handle_transport_error(osip_transaction_t * ict, int err)
{
	__osip_transport_error_callback(OSIP_ICT_TRANSPORT_ERROR, ict, err);
	__osip_transaction_set_state(ict, ICT_TERMINATED);
	__osip_kill_transaction_callback(OSIP_ICT_KILL_TRANSACTION, ict);
	/* TODO: MUST BE DELETED NOW */
}
Beispiel #3
0
void osip_ict_timeout_d_event(osip_transaction_t * ict, osip_event_t * evt)
{
	ict->ict_context->timer_d_length = -1;
	ict->ict_context->timer_d_start.tv_sec = -1;

	__osip_transaction_set_state(ict, ICT_TERMINATED);
	__osip_kill_transaction_callback(OSIP_ICT_KILL_TRANSACTION, ict);
}
Beispiel #4
0
void osip_nist_timeout_j_event(osip_transaction_t * nist, osip_event_t * evt)
{
	nist->nist_context->timer_j_length = -1;
	nist->nist_context->timer_j_start.tv_sec = -1;

	__osip_transaction_set_state(nist, NIST_TERMINATED);
	__osip_kill_transaction_callback(OSIP_NIST_KILL_TRANSACTION, nist);
}
Beispiel #5
0
void osip_ict_timeout_b_event(osip_transaction_t * ict, osip_event_t * evt)
{
	ict->ict_context->timer_b_length = -1;
	ict->ict_context->timer_b_start.tv_sec = -1;

	__osip_message_callback(OSIP_ICT_STATUS_TIMEOUT, ict, evt->sip);
	__osip_transaction_set_state(ict, ICT_TERMINATED);
	__osip_kill_transaction_callback(OSIP_ICT_KILL_TRANSACTION, ict);
}
void
osip_ist_timeout_i_event (osip_transaction_t * ist, osip_event_t * evt)
{
  ist->ist_context->timer_i_length = -1;
  ist->ist_context->timer_i_start.tv_sec = -1;

  __osip_transaction_set_state (ist, IST_TERMINATED);
  __osip_kill_transaction_callback (OSIP_IST_KILL_TRANSACTION, ist);
}
void
osip_nict_timeout_f_event (osip_transaction_t * nict, osip_event_t * evt)
{
  nict->nict_context->timer_f_length = -1;
  nict->nict_context->timer_f_start.tv_sec = -1;

  __osip_message_callback (OSIP_NICT_STATUS_TIMEOUT, nict, evt->sip);
  __osip_transaction_set_state (nict, NICT_TERMINATED);
  __osip_kill_transaction_callback (OSIP_NICT_KILL_TRANSACTION, nict);
}
Beispiel #8
0
void ict_rcv_2xx(osip_transaction_t * ict, osip_event_t * evt)
{
	/* leave this answer to the core application */

	if (ict->last_response != NULL) {
		osip_message_free(ict->last_response);
	}
	ict->last_response = evt->sip;

	__osip_message_callback(OSIP_ICT_STATUS_2XX_RECEIVED, ict, evt->sip);

	__osip_transaction_set_state(ict, ICT_TERMINATED);
	__osip_kill_transaction_callback(OSIP_ICT_KILL_TRANSACTION, ict);
}
void
ist_snd_2xx (osip_transaction_t * ist, osip_event_t * evt)
{
  int i;

  if (ist->last_response != NULL) {
    osip_message_free (ist->last_response);
  }
  ist->last_response = evt->sip;

  i = __osip_transaction_snd_xxx (ist, evt->sip);
  if (i != 0) {
    ist_handle_transport_error (ist, i);
    return;
  }
  else {
    __osip_message_callback (OSIP_IST_STATUS_2XX_SENT, ist, ist->last_response);
    __osip_transaction_set_state (ist, IST_TERMINATED);
    __osip_kill_transaction_callback (OSIP_IST_KILL_TRANSACTION, ist);
  }
  return;
}
Beispiel #10
0
void ict_rcv_3456xx(osip_transaction_t * ict, osip_event_t * evt)
{
	osip_route_t *route;
	int i;
	osip_t *osip = (osip_t *) ict->config;

	/* leave this answer to the core application */

	if (ict->last_response != NULL)
		osip_message_free(ict->last_response);

	ict->last_response = evt->sip;
	if (ict->state != ICT_COMPLETED) {	/* not a retransmission */
		/* automatic handling of ack! */
		osip_message_t *ack = ict_create_ack(ict, evt->sip);

		ict->ack = ack;

		if (ict->ack == NULL) {
			__osip_transaction_set_state(ict, ICT_TERMINATED);
			__osip_kill_transaction_callback(OSIP_ICT_KILL_TRANSACTION, ict);
			return;
		}

		/* reset ict->ict_context->destination only if
		   it is not yet set. */
		if (ict->ict_context->destination == NULL) {
			osip_message_get_route(ack, 0, &route);
			if (route != NULL && route->url != NULL) {
				osip_uri_param_t *lr_param;

				osip_uri_uparam_get_byname(route->url, "lr", &lr_param);
				if (lr_param == NULL) {
					/* using uncompliant proxy: destination is the request-uri */
					route = NULL;
				}
			}

			if (route != NULL && route->url != NULL) {
				int port = 5060;

				if (route->url->port != NULL)
					port = osip_atoi(route->url->port);
				osip_ict_set_destination(ict->ict_context,
										 osip_strdup(route->url->host), port);
			} else {
				int port = 5060;
				/* search for maddr parameter */
				osip_uri_param_t *maddr_param = NULL;

				port = 5060;
				if (ack->req_uri->port != NULL)
					port = osip_atoi(ack->req_uri->port);

				osip_uri_uparam_get_byname(ack->req_uri, "maddr", &maddr_param);
				if (maddr_param != NULL && maddr_param->gvalue != NULL)
					osip_ict_set_destination(ict->ict_context,
											 osip_strdup(maddr_param->gvalue),
											 port);
				else
					osip_ict_set_destination(ict->ict_context,
											 osip_strdup(ack->req_uri->host),
											 port);
			}
		}
		i = osip->cb_send_message(ict, ack, ict->ict_context->destination,
								  ict->ict_context->port, ict->out_socket);
		if (i != 0) {
			ict_handle_transport_error(ict, i);
			return;
		}
		if (MSG_IS_STATUS_3XX(evt->sip))
			__osip_message_callback(OSIP_ICT_STATUS_3XX_RECEIVED, ict, evt->sip);
		else if (MSG_IS_STATUS_4XX(evt->sip))
			__osip_message_callback(OSIP_ICT_STATUS_4XX_RECEIVED, ict, evt->sip);
		else if (MSG_IS_STATUS_5XX(evt->sip))
			__osip_message_callback(OSIP_ICT_STATUS_5XX_RECEIVED, ict, evt->sip);
		else
			__osip_message_callback(OSIP_ICT_STATUS_6XX_RECEIVED, ict, evt->sip);

		__osip_message_callback(OSIP_ICT_ACK_SENT, ict, evt->sip);
	}

	/* start timer D (length is set to MAX (64*DEFAULT_T1 or 32000) */
	osip_gettimeofday(&ict->ict_context->timer_d_start, NULL);
	add_gettimeofday(&ict->ict_context->timer_d_start,
					 ict->ict_context->timer_d_length);
	__osip_transaction_set_state(ict, ICT_COMPLETED);
}