changeset 265:e4a93ad611f3

liboutrt: add prefix length output arg to route_e164_number()
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 13 Nov 2023 15:09:10 -0800
parents cdc807117841
children 556cd78f750a
files liboutrt/route_e164.c sip-out/call_setup.c
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/liboutrt/route_e164.c	Sun Nov 05 16:07:14 2023 -0800
+++ b/liboutrt/route_e164.c	Mon Nov 13 15:09:10 2023 -0800
@@ -16,9 +16,10 @@
 extern struct sip_out_dest *outrt_dest_array;
 extern struct inn_route *outrt_inn_array;
 
-route_e164_number(target_num, destp)
+route_e164_number(target_num, destp, prefix_len_ret)
 	char *target_num;
 	struct sip_out_dest **destp;
+	int *prefix_len_ret;
 {
 	unsigned inn_index;
 	struct inn_route *rec;
@@ -37,6 +38,8 @@
 			continue;
 		dest = outrt_dest_array + rec->sip_dest_id;
 		*destp = dest;
+		if (prefix_len_ret)
+			*prefix_len_ret = pp - rec->prefix;
 		return 1;
 	}
 	return 0;
--- a/sip-out/call_setup.c	Sun Nov 05 16:07:14 2023 -0800
+++ b/sip-out/call_setup.c	Mon Nov 13 15:09:10 2023 -0800
@@ -58,7 +58,7 @@
 	struct sip_out_dest *dest;
 	struct special_num_route *special_rt;
 	char to_sip_user[MAX_SIP_USER_PART+1];
-	int rc;
+	int rc, prefix_len;
 
 	if (msglen != sizeof(struct gsm_mncc)) {
 		syslog(LOG_CRIT,
@@ -108,7 +108,7 @@
 				return;
 			}
 		}
-		rc = route_e164_number(msg->called.number, &dest);
+		rc = route_e164_number(msg->called.number, &dest, &prefix_len);
 		if (!rc) {
 no_route_to_dest:	reject_mo_call(mncc, msg->callref,
 					GSM48_CAUSE_LOC_PRN_S_LU,