comparison liboutrt/route_special.c @ 136:ce02fd05fd9e

liboutrt: implement special number routing
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 06 Oct 2022 23:57:38 -0800
parents liboutrt/route_e164.c@333dbb7ce704
children
comparison
equal deleted inserted replaced
135:333dbb7ce704 136:ce02fd05fd9e
1 /*
2 * In this module we implement routing of calls to special numbers
3 * such as N11.
4 */
5
6 #include <sys/types.h>
7 #include <sys/socket.h>
8 #include <netinet/in.h>
9 #include <stdio.h>
10 #include <stdint.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <strings.h>
14 #include "../include/out_routes.h"
15
16 extern struct out_routes_header outrt_hdr;
17 extern struct sip_out_dest *outrt_dest_array;
18 extern struct special_num_route *outrt_spec_array;
19
20 route_special_number(target_num, destp, specp)
21 char *target_num;
22 struct sip_out_dest **destp;
23 struct special_num_route **specp;
24 {
25 unsigned rt_index;
26 struct special_num_route *spec;
27 struct sip_out_dest *dest;
28
29 for (rt_index = 0; rt_index < outrt_hdr.num_special; rt_index++) {
30 spec = outrt_spec_array + rt_index;
31 if (strcmp(spec->special_num, target_num))
32 continue;
33 dest = outrt_dest_array + spec->sip_dest_id;
34 *destp = dest;
35 *specp = spec;
36 return 1;
37 }
38 return 0;
39 }