Browse code

kemix: exported function to get next hop uri

Daniel-Constantin Mierla authored on 17/02/2020 15:37:55
Showing 1 changed files
... ...
@@ -778,6 +778,21 @@ static sr_kemi_xval_t* ki_kx_gete_duri(sip_msg_t *msg)
778 778
 	return ki_kx_get_duri_mode(msg, SR_KEMI_XVAL_NULL_EMPTY);
779 779
 }
780 780
 
781
+/**
782
+ *
783
+ */
784
+static sr_kemi_xval_t* ki_kx_get_nhuri(sip_msg_t *msg)
785
+{
786
+	memset(&_sr_kemi_kx_xval, 0, sizeof(sr_kemi_xval_t));
787
+	if(msg->dst_uri.s==NULL || msg->dst_uri.len<=0) {
788
+		return ki_kx_get_ruri(msg);
789
+	}
790
+
791
+	_sr_kemi_kx_xval.vtype = SR_KEMIP_STR;
792
+	_sr_kemi_kx_xval.v.s = msg->dst_uri;
793
+	return &_sr_kemi_kx_xval;
794
+}
795
+
781 796
 /**
782 797
  *
783 798
  */
... ...
@@ -938,7 +953,11 @@ static sr_kemi_t sr_kemi_kx_exports[] = {
938 953
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
939 954
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
940 955
 	},
941
-
956
+	{ str_init("kx"), str_init("get_nhuri"),
957
+		SR_KEMIP_XVAL, ki_kx_get_nhuri,
958
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
959
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
960
+	},
942 961
 	{ str_init("kx"), str_init("get_ua"),
943 962
 		SR_KEMIP_XVAL, ki_kx_get_ua,
944 963
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,