changeset 158:51cf5ea7f320

sip-out: map INVITE errors to GSM cause values
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2022 08:45:39 -0800
parents 7643b779dbea
children c8e9b295e88f
files sip-out/invite.c
diffstat 1 files changed, 76 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sip-out/invite.c	Wed Oct 12 07:56:14 2022 -0800
+++ b/sip-out/invite.c	Wed Oct 12 08:45:39 2022 -0800
@@ -230,6 +230,82 @@
 	}
 }
 
+static int
+sip_error_to_gsm_cause(sip_status_code)
+	unsigned sip_status_code;
+{
+	/* mapping taken from osmo-sip-connector */
+	switch (sip_status_code) {
+	case 400:
+		return GSM48_CC_CAUSE_TEMP_FAILURE;
+	case 401:
+	case 402:
+	case 403:
+		return GSM48_CC_CAUSE_CALL_REJECTED;
+	case 404:
+		return GSM48_CC_CAUSE_UNASSIGNED_NR;
+	case 405:
+		return GSM48_CC_CAUSE_SERV_OPT_UNAVAIL;
+	case 406:
+		return GSM48_CC_CAUSE_CHAN_UNACCEPT;
+	case 407:
+		return GSM48_CC_CAUSE_CALL_REJECTED;
+	case 408:
+		return GSM48_CC_CAUSE_RECOVERY_TIMER;
+	case 410:
+		return GSM48_CC_CAUSE_NUMBER_CHANGED;
+	case 413:
+	case 414:
+		return GSM48_CC_CAUSE_INTERWORKING;
+	case 415:
+		return GSM48_CC_CAUSE_SERV_OPT_UNIMPL;
+	case 416:
+		return GSM48_CC_CAUSE_INVAL_TRANS_ID;
+	case 420:
+	case 421:
+	case 423:
+		return GSM48_CC_CAUSE_INTERWORKING;
+	case 480:
+		return GSM48_CC_CAUSE_USER_NOTRESPOND;
+	case 481:
+		return GSM48_CC_CAUSE_TEMP_FAILURE;
+	case 482:
+	case 483:
+		return GSM48_CC_CAUSE_PRE_EMPTION;
+	case 484:
+		return GSM48_CC_CAUSE_INV_NR_FORMAT;
+	case 485:
+		return GSM48_CC_CAUSE_NO_ROUTE;
+	case 486:
+		return GSM48_CC_CAUSE_USER_BUSY;
+	case 488:
+		return GSM48_CC_CAUSE_INCOMPAT_DEST;
+	case 500:
+		return GSM48_CC_CAUSE_TEMP_FAILURE;
+	case 501:
+		return GSM48_CC_CAUSE_SERV_OPT_UNIMPL;
+	case 502:
+		return GSM48_CC_CAUSE_DEST_OOO;
+	case 503:
+		return GSM48_CC_CAUSE_RESOURCE_UNAVAIL;
+	case 504:
+		return GSM48_CC_CAUSE_RECOVERY_TIMER;
+	case 505:
+	case 513:
+		return GSM48_CC_CAUSE_INTERWORKING;
+	case 600:
+		return GSM48_CC_CAUSE_USER_BUSY;
+	case 603:
+		return GSM48_CC_CAUSE_CALL_REJECTED;
+	case 604:
+		return GSM48_CC_CAUSE_NO_ROUTE;
+	case 606:
+		return GSM48_CC_CAUSE_INCOMPAT_DEST;
+	default:
+		return GSM48_CC_CAUSE_NORMAL_UNSPEC;
+	}
+}
+
 static void
 handle_error(call, msg, tag, sin)
 	struct call *call;