FreeCalypso > hg > themwi-system-sw
view sip-out/e911.c @ 263:1bf989f60aa3
smpp-trx-sa: log times of enquire_link packets
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 11 Oct 2023 21:22:32 -0800 |
parents | 9f96e5b14755 |
children |
line wrap: on
line source
/* * In this module we implement E911 routing, i.e., special handling * for calls to either the real 911 or E911 test numbers. */ #include <sys/types.h> #include <sys/socket.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/number_db_v2.h" #include "../libnumdb2/lookup_func.h" e911_call_preen(msg) struct gsm_mncc *msg; { struct owned_number_rec *nr; syslog(LOG_NOTICE, "E911 call attempt from %s to %s, emergency flag %d", msg->calling.number, msg->called.number, msg->emergency); refresh_number_db(); nr = numdb_lookup_nanp(msg->calling.number+1); if (!nr) { syslog(LOG_NOTICE, "E911 call rejected: calling number is not in database"); return 0; } if (nr->number_flags & NUMBER_FLAG_E911PROV) { syslog(LOG_NOTICE, "E911 call allowed: calling number has E911 flag set"); return 1; } if (nr->usage & NUMBER_USAGE_FLAG_E911_VIA) { sprintf(msg->calling.number, "1%03u%03u%04u", nr->remap[0], nr->remap[1], nr->remap[2]); syslog(LOG_NOTICE, "E911 call: source number changed to %s", msg->calling.number); return 1; } syslog(LOG_NOTICE, "E911 call rejected: calling number is not E911-provisioned"); return 0; }