Browse code

kemix: exported KSR.kx.get_send_sock_port()

- return send socket port if set, 0 otherwise

Daniel-Constantin Mierla authored on 05/01/2021 15:57:13
Showing 1 changed files
... ...
@@ -522,6 +522,17 @@ static sr_kemi_xval_t* ki_kx_get_send_sock_name(sip_msg_t *msg)
522 522
 	return &_sr_kemi_kx_xval;
523 523
 }
524 524
 
525
+/**
526
+ *
527
+ */
528
+static int ki_kx_get_send_sock_port(sip_msg_t *msg)
529
+{
530
+	if (msg==NULL || msg->force_send_socket==0) {
531
+		return 0;
532
+	}
533
+	return (int)msg->force_send_socket->port_no;
534
+}
535
+
525 536
 /**
526 537
  *
527 538
  */
... ...
@@ -1325,6 +1336,11 @@ static sr_kemi_t sr_kemi_kx_exports[] = {
1325 1336
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
1326 1337
 			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1327 1338
 	},
1339
+	{ str_init("kx"), str_init("get_send_sock_port"),
1340
+		SR_KEMIP_INT, ki_kx_get_send_sock_port,
1341
+		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
1342
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
1343
+	},
1328 1344
 	{ str_init("kx"), str_init("get_rcvip"),
1329 1345
 		SR_KEMIP_XVAL, ki_kx_get_rcvip,
1330 1346
 		{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,