FreeCalypso > hg > themwi-system-sw
view sip-in/call_list.c @ 240:c7a3ba56c636
themwi-short-dial: fix bug in printf arguments
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 14 Aug 2023 15:37:59 -0800 |
parents | 6aa63cf4620a |
children |
line wrap: on
line source
/* * In this module we implement call list management for themwi-sip-in. */ #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 "call.h" struct call *call_list; struct call * find_call_by_sip_id(sought_id) char *sought_id; { struct call *call; for (call = call_list; call; call = call->next) if (!strcmp(call->sip_call_id, sought_id)) return call; return 0; } struct call * find_call_by_mncc_callref(callref) uint32_t callref; { struct call *call; for (call = call_list; call; call = call->next) if (call->mncc_state && call->mncc_callref == callref) return call; return 0; } allocate_mncc_callref(call) struct call *call; { static uint32_t next_callref; for (;;) { next_callref++; if (!find_call_by_mncc_callref(next_callref)) { call->mncc_callref = next_callref; return(0); } } } void scan_call_list_for_timeouts(retrans, dead_sip_flag, dead_sip_time) int *retrans, *dead_sip_flag; time_t *dead_sip_time; { struct call *call; int got_dead_sip = 0; for (call = call_list; call; call = call->next) { switch (call->sip_state) { case SIP_STATE_RINGING_REL: case SIP_STATE_INVITE_200: case SIP_STATE_INVITE_ERR: case SIP_STATE_BYE_SENT: *retrans = 1; break; case SIP_STATE_ENDED: case SIP_STATE_MSG_SIZE_ERR: if (call->overall_state != OVERALL_STATE_DEAD_SIP) continue; if (got_dead_sip) { if (call->sip_clear_time < *dead_sip_time) *dead_sip_time = call->sip_clear_time; } else { got_dead_sip = 1; *dead_sip_flag = 1; *dead_sip_time = call->sip_clear_time; } } } }