FreeCalypso > hg > themwi-interim
view mncc/outcall.c @ 13:c71801aa0039 default tip
themwi-test-mtc: increase maximum play length
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 29 Oct 2024 00:06:28 +0000 |
parents | 053f04687106 |
children |
line wrap: on
line source
/* * In this module we handle routing of outbound MO calls * to the outcall socket provided by themwi-sip-out. */ #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <syslog.h> #include <unistd.h> #include "../include/mncc.h" #include "../include/gsm48_const.h" #include "struct.h" extern struct socket_conn outcall_conn; static char outcall_socket_pathname[] = "/var/gsm/outcall_socket"; connect_outcall_socket() { struct sockaddr_un sa; unsigned sa_len; int fd, rc; if (outcall_conn.fd >= 0) return(0); fd = socket(AF_UNIX, SOCK_SEQPACKET, 0); if (fd < 0) { syslog(LOG_CRIT, "socket(AF_UNIX, SOCK_SEQPACKET, 0): %m"); return(-1); } fill_sockaddr_un(outcall_socket_pathname, &sa, &sa_len); rc = connect(fd, (struct sockaddr *) &sa, sa_len); if (rc < 0) { syslog(LOG_ERR, "connect to %s: %m", outcall_socket_pathname); close(fd); return(-1); } update_max_fd(fd); outcall_conn.fd = fd; return(0); } void outbound_mo_setup(call, msg) struct gsm_call *call; struct gsm_mncc *msg; { int rc; rc = connect_outcall_socket(); if (rc < 0) { syslog(LOG_ERR, "rejecting MO call 0x%x: outbound gateway down", msg->callref); reject_mo_call(msg->callref, GSM48_CAUSE_LOC_PRN_S_LU, GSM48_CC_CAUSE_DEST_OOO); call->gc_flag = 1; return; } call->socket = &outcall_conn; call->socket_ref = msg->callref; outcall_conn.ncalls++; mncc_signal_to_socket(call, msg); }