# HG changeset patch # User Mychaela Falconia # Date 1665129458 28800 # Node ID ce02fd05fd9e22271e441e2e99eeb6269d845983 # Parent 333dbb7ce704de1112b47207316f5f0aa2190d2d liboutrt: implement special number routing diff -r 333dbb7ce704 -r ce02fd05fd9e liboutrt/Makefile --- a/liboutrt/Makefile Thu Oct 06 23:44:17 2022 -0800 +++ b/liboutrt/Makefile Thu Oct 06 23:57:38 2022 -0800 @@ -1,6 +1,6 @@ CC= gcc CFLAGS= -O2 -OBJS= readbin.o refresh.o route_e164.o +OBJS= readbin.o refresh.o route_e164.o route_special.o LIB= liboutrt.a all: ${LIB} diff -r 333dbb7ce704 -r ce02fd05fd9e liboutrt/route_special.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboutrt/route_special.c Thu Oct 06 23:57:38 2022 -0800 @@ -0,0 +1,39 @@ +/* + * In this module we implement routing of calls to special numbers + * such as N11. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "../include/out_routes.h" + +extern struct out_routes_header outrt_hdr; +extern struct sip_out_dest *outrt_dest_array; +extern struct special_num_route *outrt_spec_array; + +route_special_number(target_num, destp, specp) + char *target_num; + struct sip_out_dest **destp; + struct special_num_route **specp; +{ + unsigned rt_index; + struct special_num_route *spec; + struct sip_out_dest *dest; + + for (rt_index = 0; rt_index < outrt_hdr.num_special; rt_index++) { + spec = outrt_spec_array + rt_index; + if (strcmp(spec->special_num, target_num)) + continue; + dest = outrt_dest_array + spec->sip_dest_id; + *destp = dest; + *specp = spec; + return 1; + } + return 0; +}