view liboutrt/route_special.c @ 219:9ba474e918c0

smpp-test1: try sending some ID strings
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 01 Aug 2023 22:56:52 -0800
parents ce02fd05fd9e
children
line wrap: on
line source

/*
 * In this module we implement routing of calls to special numbers
 * such as N11.
 */

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#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;
}