FreeCalypso > hg > themwi-system-sw
view sip-out/disconnect.c @ 275:def9f6e4f49e default tip
doc/Use-outside-USA: Fake-NANP-numbers article is here
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 27 Nov 2023 21:49:19 -0800 |
parents | e54b0a9e322f |
children |
line wrap: on
line source
/* * In this module we implement call disconnection and clearing procedures. */ #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 "../include/out_routes.h" #include "call.h" extern unsigned sip_linger_timeout; void disconnect_mncc(call, cause_loc, cause_val) struct call *call; { struct gsm_mncc msg; if (!call->mncc) return; switch (call->mncc_state) { case MNCC_STATE_DISCONNECT: case MNCC_STATE_RELEASE: return; } bzero(&msg, sizeof(struct gsm_mncc)); msg.msg_type = MNCC_DISC_REQ; msg.callref = call->mncc_callref; mncc_set_cause(&msg, cause_loc, cause_val); send_mncc_to_sock(call->mncc, &msg, sizeof(struct gsm_mncc)); call->mncc_state = MNCC_STATE_DISCONNECT; } void disconnect_tmgw(call) struct call *call; { switch (call->mgw_state) { case MGW_STATE_NO_EXIST: case MGW_STATE_DELETING: case MGW_STATE_MDCX_IBT: case MGW_STATE_MDCX_CONN: case MGW_STATE_MDCX_HOLD: case MGW_STATE_MDCX_RETR: case MGW_STATE_DTMF_OP: return; case MGW_STATE_ALLOCATED: case MGW_STATE_IBT_CONN: case MGW_STATE_COMPLETE: case MGW_STATE_HELD: tmgw_send_dlcx(call); return; default: syslog(LOG_CRIT, "FATAL: invalid MGW state 0x%x in disconnect_tmgw()", call->mgw_state); exit(1); } } void disconnect_sip(call) struct call *call; { if (!call->sip_call_exists) return; switch (call->sip_state) { case SIP_STATE_INV_SENT: call->sip_state = SIP_STATE_ACCEPT_100; sip_mark_end_time(call, sip_linger_timeout); break; case SIP_STATE_100_RCVD: initiate_sip_cancel(call); break; case SIP_STATE_CONNECTED: initiate_bye(call); break; } }