view sip-in/mncc_sig_out.c @ 272:c78b8d6ce885

doc/Number-database: should be complete for now
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 26 Nov 2023 19:13:52 -0800
parents 99fd4ae573ae
children
line wrap: on
line source

/*
 * In this module we implement functions that send MNCC messages
 * to OsmoMSC via themwi-mncc, to be called by SIP and TMGW events.
 */

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <syslog.h>
#include "../include/mncc.h"
#include "../include/gsm48_const.h"
#include "call.h"

void
send_mncc_connect_ack(call)
	struct call *call;
{
	struct gsm_mncc ack;

	bzero(&ack, sizeof(struct gsm_mncc));
	ack.msg_type = MNCC_SETUP_COMPL_REQ;
	ack.callref = call->mncc_callref;
	send_mncc_to_gsm(&ack, sizeof(struct gsm_mncc));
	call->mncc_state = MNCC_STATE_CONNECTED;
	call->overall_state = OVERALL_STATE_CONNECTED;
}

void
mncc_dtmf_start_ok(call)
	struct call *call;
{
	struct gsm_mncc msg;

	bzero(&msg, sizeof(struct gsm_mncc));
	msg.msg_type = MNCC_START_DTMF_RSP;
	msg.callref = call->mncc_callref;
	msg.fields |= MNCC_F_KEYPAD;
	msg.keypad = call->dtmf_digit;
	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
}

void
mncc_dtmf_start_err(call)
	struct call *call;
{
	struct gsm_mncc msg;

	bzero(&msg, sizeof(struct gsm_mncc));
	msg.msg_type = MNCC_START_DTMF_REJ;
	msg.callref = call->mncc_callref;
	mncc_set_cause(&msg, GSM48_CAUSE_LOC_PRN_S_LU,
			GSM48_CC_CAUSE_PROTO_ERR);
	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
}

void
mncc_dtmf_stop_ok(call)
	struct call *call;
{
	struct gsm_mncc msg;

	bzero(&msg, sizeof(struct gsm_mncc));
	msg.msg_type = MNCC_STOP_DTMF_RSP;
	msg.callref = call->mncc_callref;
	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
}

void
mncc_send_hold_ack(call)
	struct call *call;
{
	struct gsm_mncc msg;

	bzero(&msg, sizeof(struct gsm_mncc));
	msg.msg_type = MNCC_HOLD_CNF;
	msg.callref = call->mncc_callref;
	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
}

void
mncc_send_retrieve_ack(call)
	struct call *call;
{
	struct gsm_mncc msg;

	bzero(&msg, sizeof(struct gsm_mncc));
	msg.msg_type = MNCC_RETRIEVE_CNF;
	msg.callref = call->mncc_callref;
	send_mncc_to_gsm(&msg, sizeof(struct gsm_mncc));
}