optimizing the N5 routing Logic more (#389)

* Improving N5 Routing Logic

Change NFType to "AF"

* Improving N5 Routing Logic

Change NFType to "AF" to comply with 3GPP

* Improving N5 Routing Logic

Add failing condition in case QoS N5 fails 
Remove/adjust logging to console
Improving the request sent to PCF

* Improving N5 Routing Logic

Add failing condition in case QoS N5 fails 
Remove/adjust logging to console
Improving the request sent to PCF

* Improving N5 Routing Logic

Add failing condition in case QoS N5 fails 
Remove/adjust logging to console
Improving the request sent to PCF

* set maxcontact to one

set maxcontact to one
This commit is contained in:
Abdulkarim Barbour
2024-11-14 19:12:32 +01:00
committed by GitHub
parent 6b6cd6f95a
commit 9560e618b4
5 changed files with 252 additions and 145 deletions

View File

@@ -453,16 +453,15 @@ modparam("htable", "htable", "user_sip_ports=>size=8;autoexpire=3600;")
# HTTP2 for 5G -- Modules Parameters
modparam("http_client", "httpredirect", 1)
modparam("http_client", "useragent", "PCSCF")
modparam("http_client", "useragent", "AF")
modparam("http_client", "maxdatasize", 64535)
modparam("http_client", "connection_timeout", 2)
modparam("http_client", "keep_connections", 1)
modparam("http_client", "response_headers", 1)
modparam("http_client", "query_result", 1)
# modparam("http_client", "httpcon", "pcfapi=>http://N5_BIND_IP:N5_BIND_PORT")
modparam("nghttp2", "listen_addr", "N5_BIND_IP")
modparam("nghttp2", "listen_port", "N5_BIND_PORT")
# Replace the following with your own Key and Cert
# Replace the following with your own Key and Cert, you can use HAProxy to terminate TLS towards Clients (Open5gs)
# modparam("nghttp2", "tls_private_key", "/mnt/pcscf/http2_key.pem")
# modparam("nghttp2", "tls_public_key", "/mnt/pcscf/http2_tr.pem")
@@ -1026,20 +1025,20 @@ event_route[nghttp2:request] {
// Check if the requested URL is /nf-status-notify
if ($nghttp2(path) == "/nf-status-notify") {
nghttp2_reply_header("Content-Type", "text/html");
nghttp2_reply_header("Server:", "PCSCF");
nghttp2_reply_header("Server:", "AF");
nghttp2_reply("200", "<html><body>PCF registered at PCSCF</body></html>");
} else if ($nghttp2(path) == "/terminate") {
nghttp2_reply_header("accept", "application/json");
nghttp2_reply_header("accept", "application/problem+json");
nghttp2_reply_header("Content-Type", "application/json");
nghttp2_reply_header("Server", "PCSCF");
nghttp2_reply_header("Server", "AF");
nghttp2_reply("204", "No Content");
} else {
// Optionally handle other URLs or do nothing
nghttp2_reply_header("accept", "application/json");
nghttp2_reply_header("accept", "application/problem+json");
nghttp2_reply_header("Content-Type", "application/json");
nghttp2_reply_header("Server", "PCSCF");
nghttp2_reply_header("Server", "AF");
nghttp2_reply("404", "Not Found");
}
}
@@ -1101,7 +1100,7 @@ route[NRF_NFM] {
$var(nf_reg_body) = '{
"nfInstanceId": "PCSCF_UUID",
"nfType": "PCSCF",
"nfType": "AF",
"nfStatus": "REGISTERED",
"ipv4Addresses": ["N5_BIND_IP"],
"allowedNfTypes": ["SCP", "PCF"],
@@ -1170,7 +1169,7 @@ route[NRF_NFM_SUBSCRIBE_PCF] {
"subscrCond": {
"nfType": "PCF"
},
"reqNfType": "PCSCF",
"reqNfType": "AF",
"requesterFeatures": "1"
}';
$var(pcf_subc_body) = $(var(pcf_subc_body){re.subst,/PCSCF_UUID/$var(pcscf_uuid)/g});

View File

@@ -198,9 +198,9 @@ xlog("L_INFO", "SDP Info : Connection IP is $var(sdp_src_ip) Port is $var(sdp_sr
#### now start to build the N5 Request
xlog("L_ALERT","DEBUG: Preparing QoS N5 Message to PCF for the INVITE\n");
xlog("L_INFO","Preparing QoS N5 Message to PCF for the INVITE\n");
xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
xlog("L_INFO","Initialize empty arrays and objects\n");
### Initialize empty arrays and objects
$var(events) = '[]';
@@ -244,7 +244,7 @@ xlog("L_INFO", "SDP Info : Connection IP is $var(sdp_src_ip) Port is $var(sdp_sr
jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
xlog("L_ALERT","DEBUG: Set evSubsc\n");
xlog("L_INFO","Set evSubsc\n");
### Set evSubsc
jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
@@ -258,7 +258,7 @@ xlog("L_INFO", "SDP Info : Connection IP is $var(sdp_src_ip) Port is $var(sdp_sr
jansson_set("obj", "evSubsc", "$var(evSubsc)", "$var(payload)");
### Set other parameters in payload
jansson_set("string", "notifUri", "http://172.22.0.21:8284", "$var(payload)");
jansson_set("string", "notifUri", "http://172.22.0.21:7777", "$var(payload)");
jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)");
jansson_set("string", "gpsi", "msisdn-$fU", "$var(payload)");
jansson_set("string", "suppFeat", "4", "$var(payload)");
@@ -267,10 +267,10 @@ xlog("L_INFO", "SDP Info : Connection IP is $var(sdp_src_ip) Port is $var(sdp_sr
### Assemble the final JSON request
jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");
xlog("L_INFO", "Set headers for the HTTP2 Request\n");
### Set headers
$var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
xlog("Today is $var(time_now)\n");
xlog("L_INFO", "Today is $var(time_now)\n");
$var(headers) = "Content-Type: application/json\r\n";
$var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
@@ -281,13 +281,17 @@ xlog("L_INFO", "SDP Info : Connection IP is $var(sdp_src_ip) Port is $var(sdp_sr
$var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
xlog("L_ALERT","DEBUG: Sending the request to PCF\n");
xlog("L_INFO","Sending the request to PCF\n");
### Send the request to PCF
http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions", "$var(json_request)", "$var(headers)", "$var(result)" );
xlog("HTTP response: $var(result)\n");
xlog("L_ALERT", "response header: $curlerror(error)\n");
xlog("L_ALERT", "response header: $var(response_code)\n");
xlog("L_ALERT", "response header: $httprhdr(location)\n");
### here we want to kill the dialog in case QoS faild or continue if QoS success.
switch ($rc) {
case 201:
xlog("L_INFO", "N5 QoS Session successfully Created $rc\n");
xlog("L_INFO", "HTTP results: $var(result)\n");
xlog("L_INFO", "HTTP response: $rc\n");
xlog("L_INFO", "Location Header: $httprhdr(location)\n");
# Now I will retrieve the AppSessionID out of the location Header it should be always at the end
# Example URL: "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/(someSessionID)"
@@ -312,9 +316,15 @@ xlog("L_INFO", "SDP Info : Connection IP is $var(sdp_src_ip) Port is $var(sdp_sr
# Extract the substring after the last slash
# now doing some magic
# Set the starting position after the last slash
$var(start_pos) = $var(pos) + 1;
$var(end_pos) = $var(len) - $var(start_pos);
$var(app_session) = $(var(url){s.substr,$var(start_pos),$var(end_pos)});
# Calculate the length of the substring after the last slash
$var(substring_length) = $var(len) - $var(start_pos);
# Extract the substring after the last slash
$var(app_session) = $(var(url){s.substr,$var(start_pos),$var(substring_length)});
# now checking it on console if I got what I wanted :
xlog("L_INFO", "AppSession for user $fU is: $var(app_session)\n");
@@ -325,6 +335,12 @@ xlog("L_INFO", "SDP Info : Connection IP is $var(sdp_src_ip) Port is $var(sdp_sr
# Store the AppSession in the hash table associated with the UE
$sht(user_data=>$var(user_id)) = $var(app_session);
xlog("L_INFO", "Stored AppSession for user $var(user_id): $var(app_session)\n");
break;
default:
xlog("L_ERR", "N5 QoS Session faild - Reason code: $rc\n");
send_reply("412", "MOC N5 QoS Session Creation faild");
exit;
} # switch ends here
}
}
@@ -348,11 +364,48 @@ onreply_route[MO_reply] {
append_hf("Contact: $ct;$hdr(C-Params)\r\n");
}
## N5 PATCH Request
if (t_check_status("183|200|180") && has_body("application/sdp")){
xlog("L_ALERT","Proccessing QoS N5 Request for SDP Answer on INVITE\n");
## N5 PATCH Request
if (t_check_status("180|183|200") && has_body("application/sdp")){
xlog("L_INFO", "received early answer in 18x, Patching N5 session in PCF...\n");
xlog("L_INFO", "N5 PATCH: About to test if this is a retransmitted reply which is still currently suspended\n");
if (t_is_retr_async_reply()) {
xlog("L_INFO", "Dropping retransmitted reply which is still currently suspended\n");
drop();
}
route(N5_PATCH_REQ);
}
## Terminating N5 AppSession after BYE##
if(is_method("BYE|CANCEL") || status=~"[45][0-9][0-9]"){
xlog("L_ALERT", "Terminating AppSession For Call fom User $fU due to call END or Call Faild\n");
# Retrieveing
$var(user_id_midcall_rel) = $fU; # User Part of the from Header to get the USER
$var(user_appsess_midcall_rel) = $sht(user_data=>$var(user_id_midcall_rel));
xlog("L_INFO", "Terminating Stored AppSession for user $var(user_id_midcall_rel): $var(user_appsess_midcall_rel)\n");
$var(headers) = "X-SIP-Status: De-Registration\r\n";
$var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
$var(headers) = $var(headers) + "accept: application/json\r\n";
$var(headers) = $var(headers) + "accept: application/problem+json\r\n";
$var(headers) = $var(headers) + "3gpp-sbi-max-rsp-time: 10000\r\n";
$var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
$var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_midcall_rel)/delete", "$var(json_request)", "$var(headers)", "$var(result)" );
xlog("L_INFO", "Termination resuts: $var(result)\n");
xlog("L_INFO", "response header: $curlerror(error)\n");
xlog("L_INFO", "response header: $var(response_code)\n");
xlog("L_INFO", "response header: $httprhdr(location)\n");
xlog("L_INFO", "response header: $rc\n");
}
#!ifdef WITH_IPSEC
ipsec_forward("location", IPSEC_FORWARD_FLAGS);
@@ -413,15 +466,15 @@ route[MO_indialog] {
## N5 PATCH Request
if(is_method("INVITE")){
xlog("L_ALERT"," InDialog SDP Answer N5 Request for reINVITE\n");
xlog("L_INFO"," InDialog SDP Answer N5 Request for reINVITE\n");
route(N5_PATCH_REQ);
}
## Terminating N5 AppSession after BYE##
if(is_method("BYE"))
if(is_method("BYE|CANCEL"))
{
xlog("L_ALERT","Terminating AppSession For Call fom User $fu due to call END\n");
xlog("L_ALERT","Terminating AppSession For Call for User $fU due to call END or Call Faild\n");
# Retrieveing
$var(user_id_call_rel) = $fU; # User Part of the from Header to get the USER
$var(user_appsess_call_rel) = $sht(user_data=>$var(user_id_call_rel));
@@ -436,10 +489,11 @@ route[MO_indialog] {
$var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_call_rel)/delete", "$var(json_request)", "$var(headers)", "$var(result)" );
xlog("Termination resuls: $var(result)\n");
xlog("L_ALERT", "response header: $curlerror(error)\n");
xlog("L_ALERT", "response header: $var(response_code)\n");
xlog("L_ALERT", "response header: $httprhdr(location)\n");
xlog("L_INFO", "Termination resuls: $var(result)\n");
xlog("L_INFO", "response header: $curlerror(error)\n");
xlog("L_INFO", "response header: $var(response_code)\n");
xlog("L_INFO", "response header: $httprhdr(location)\n");
xlog("L_INFO", "response header: $rc\n");
}
@@ -473,16 +527,19 @@ onreply_route[MO_indialog_reply] {
##
if (t_check_status("200") && has_body("application/sdp")){
if (t_is_retr_async_reply()) {
## N5 PATCH Request
if (t_check_status("180|183|200") && has_body("application/sdp")){
xlog("L_DBG", "received early answer in 18x, Patching N5 session in PCF...\n");
xlog("L_DBG", "N5 PATCH: About to test if this is a retransmitted reply which is still currently suspended\n");
if (t_is_retr_async_reply()) {
xlog("L_DBG", "Dropping retransmitted reply which is still currently suspended\n");
drop();
}
xlog("L_ALERT"," InDialog SDP Answer N5 Request for 200OK reINVITE\n");
drop();
}
route(N5_PATCH_REQ);
}
}
# In case of 1xx and 2xx do NAT
if(status=~"[12][0-9][0-9]")
route(NATMANAGE);
@@ -532,7 +589,7 @@ route[MO_indialog_aar_reply]
route[N5_PATCH_REQ] {
xlog("L_DBG", "IMS: Received 183/200 inside orig_initial_reply\n");
xlog("L_INFO", "IMS: Received 183/200 inside orig_initial_reply\n");
### Getting the IP/Port of UE
@@ -563,7 +620,7 @@ route[N5_PATCH_REQ] {
$var(sdp_answ_port) = $sdp(m0:rtp:port);
$var(sdp_answ_rtcp_port) = $sdp(m0:rtcp:port);
$var(sdp_answ_codec) = $(rb{line.sw,a=rtpmap}{s.select,1, });
xlog("L_ALERT", "SDP Answer connection Info is: $var(sdp_answ_ip), RTP port $var(sdp_answ_port), RTCP Port $var(sdp_answ_rtcp_port) and codec is $var(sdp_answ_codec)\n");
xlog("L_INFO", "SDP Answer connection Info is: $var(sdp_answ_ip), RTP port $var(sdp_answ_port), RTCP Port $var(sdp_answ_rtcp_port) and codec is $var(sdp_answ_codec)\n");
## Retrieveing AppSession from initial INVITE N5 Request
$var(user_id_inv_rep) = $fU; # User Part of the from Header to get the USER
@@ -572,9 +629,9 @@ route[N5_PATCH_REQ] {
#### now start to build the N5 Request
xlog("L_ALERT","DEBUG: Preparing PATCH N5 Message for SDP Answer\n");
xlog("L_INFO","Preparing PATCH N5 Message for SDP Answer\n");
xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
xlog("L_INFO","Initialize empty arrays and objects\n");
### Initialize empty arrays and objects
$var(events) = '[]';
@@ -589,7 +646,7 @@ route[N5_PATCH_REQ] {
### Set medComponents
jansson_set("integer", "medCompN", 1, "$var(medComp)");
# jansson_set("string", "qosReference", "qosVoNR", "$var(medComp)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "qosReference", "qosVoNR", "$var(medComp)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "medType", "AUDIO", "$var(medComp)");
jansson_set("array", "codecs", "[\"downlink\\n$var(sdp_answ_codec)\\n\", \"uplink\\n$var(sdp_answ_codec)\\n\"]", "$var(medComp)");
@@ -597,8 +654,8 @@ route[N5_PATCH_REQ] {
jansson_set("integer", "fNum", 1, "$var(medSubComp1)");
jansson_set("array", "fDescs", "[\"permit out 17 from $var(sdp_answ_ip) $var(sdp_answ_port) to $var(ue_sdp_ip) $var(ue_sdp_port)\", \"permit in 17 from $var(ue_sdp_ip) $var(ue_sdp_port) to $var(sdp_answ_ip) $var(sdp_answ_port)\"]", "$var(medSubComp1)");
jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp1)");
# jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp1)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
# jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp1)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp1)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp1)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
jansson_set("string", "flowUsage", "NO_INFO", "$var(medSubComp1)");
@@ -606,8 +663,8 @@ route[N5_PATCH_REQ] {
jansson_set("integer", "fNum", 2, "$var(medSubComp2)");
jansson_set("array", "fDescs", "[\"permit out 17 from $var(sdp_answ_ip) $var(sdp_answ_rtcp_port) to $var(ue_sdp_ip) $var(ue_sdp_rtcp_port)\", \"permit in 17 from $var(ue_sdp_ip) $var(ue_sdp_rtcp_port) to $var(sdp_answ_ip) $var(sdp_answ_rtcp_port)\"]", "$var(medSubComp2)");
jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp2)");
# jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp2)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
# jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp2)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp2)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp2)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
jansson_set("string", "flowUsage", "RTCP", "$var(medSubComp2)");
# Merging the flows under MediaSubComponent
@@ -618,7 +675,7 @@ route[N5_PATCH_REQ] {
jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
xlog("L_ALERT","DEBUG: Set evSubsc\n");
xlog("L_INFO","DEBUG: Set evSubsc\n");
### Set evSubsc
jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
@@ -632,19 +689,19 @@ route[N5_PATCH_REQ] {
jansson_set("obj", "evSubsc", "$var(evSubsc)", "$var(payload)");
### Set other parameters in payload
jansson_set("string", "notifUri", "http://172.22.0.21:8284", "$var(payload)");
# jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
# jansson_set("string", "gpsi", "msisdn-$fU", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
# jansson_set("string", "suppFeat", "4", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
# jansson_set("string", "ueIpv4", "$var(ue_sip_ip_addr)", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "notifUri", "http://172.22.0.21:7777", "$var(payload)");
jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "gpsi", "msisdn-$fU", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "suppFeat", "4", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "ueIpv4", "$var(ue_sip_ip_addr)", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
### Assemble the final JSON request
jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");
xlog("L_INFO","Set headers for the HTTP2 Request\n");
### Set headers
$var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
xlog("Today is $var(time_now)\n");
xlog("L_INFO", "Today is $var(time_now)\n");
$var(headers) = "Content-Type: application/merge-patch+json\r\n"; # added content-type an set it to "application/merge-patch+json" fo compatibility with RFC7386 for JSON PATCH/Merge
$var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
@@ -655,13 +712,23 @@ route[N5_PATCH_REQ] {
$var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
xlog("L_ALERT","DEBUG: Sending the request to PCF\n");
xlog("L_INFO","Sending the request to PCF\n");
### Send the request to PCF
http_client_request_v2pk("PATCH", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_inv_rep)", "$var(json_request)", "$var(headers)", "$var(result)" );
xlog("HTTP response: $var(result)\n");
xlog("L_ALERT", "response header: $curlerror(error)\n");
xlog("L_ALERT", "response header: $var(response_code)\n");
xlog("L_ALERT", "response header: $httprhdr(location)\n");
#### here we want to kill the dialog in case QoS faild or contiue if QoS success, who knows ;( but this will help where we could have instability on RAN causing mutiple dead contacts with only one working causing INVITE Forks to dead contacts leading to 404 from PCF
switch ($rc) {
case 200:
xlog("L_INFO", "N5 QoS Session modification success - reason code: $rc\n");
xlog("L_INFO", "HTTP results: $var(result)\n");
xlog("L_INFO", "HTTP response: $rc\n");
xlog("L_INFO", "cURL Response: $curlerror(error)\n");
xlog("L_INFO", "Location Header header: $httprhdr(location)\n");
break;
default:
xlog("L_ERR", "N5 QoS Session modification faild - reason code: $rc\n");
send_reply("412", "MOC N5 QoS Session modify faild");
exit;
} # switch ends here
}

View File

@@ -15,12 +15,6 @@ route[MT] {
if(is_method("INVITE")) {
route(N5_INIT_MT_REQ);
}
## not sure why on CANCEL its not triggered maybe I'm missing something ?
if(is_method("CANCEL"))
{
route(N5_MTC_TERM);
}
#!ifdef WITH_IPSEC
ipsec_forward("location", IPSEC_FORWARD_FLAGS);
@@ -47,20 +41,23 @@ onreply_route[MT_reply] {
### N5 PATCH Request
if (t_check_status("180|183|200") && has_body("application/sdp")){
xlog("L_DBG", "About to test if this is a retransmitted reply which is still currently suspended\n");
xlog("L_INFO", "received early answer in 18x, Patching N5 session in PCF...\n");
xlog("L_INFO", "N5 PATCH: About to test if this is a retransmitted reply which is still currently suspended\n");
if (t_is_retr_async_reply()) {
xlog("L_DBG", "Dropping retransmitted reply which is still currently suspended\n");
xlog("L_INFO", "Dropping retransmitted reply which is still currently suspended\n");
drop();
}
route(N5_PATCH_MT_REQ);
}
## not sure why on CANCEL its not triggered maybe I'm missing something ?
## terminate QoS Session after Error response
if(is_method("CANCEL"))
if(status=~"[45][0-9][0-9]")
{
xnotice("Received Error response ON the Call, going to terminate N5 Session\n");
route(N5_MTC_TERM);
}
#!ifdef WITH_RX
if (t_check_status("183|200") && has_body("application/sdp")){
@@ -119,7 +116,7 @@ route[MT_indialog] {
## N5 PATCH Request
if(is_method("INVITE")){
xlog("L_ALERT"," InDialog SDP Answer N5 Request for reINVITE\n");
xlog("L_INFO"," InDialog SDP Change, sending N5 Request for it\n");
route(N5_PATCH_REQ);
}
@@ -127,7 +124,8 @@ route[MT_indialog] {
if(is_method("BYE|CANCEL"))
{
route(N5_MTC_TERM);
xlog("L_INFO"," InDialog Call End/Cancel/Error, terminating N5 QoS Session ...\n");
route(N5_MTC_TERM);
}
#### END of N5 Request
@@ -159,6 +157,19 @@ onreply_route[MT_indialog_reply] {
xnotice("Source IP and Port: ($si:$sp)\n Route-URI: $route_uri\n");
xnotice("Received IP and Port: ($Ri:$Rp)\n");
xnotice("Contact header: $ct\n");
### N5 PATCH Request for Indialog reply
if (t_check_status("180|183|200") && has_body("application/sdp")){
xlog("L_INFO", "received MT_indialog_reply, Patching N5 session in PCF...\n");
xlog("L_INFO", "N5 PATCH: About to test if this is a retransmitted reply which is still currently suspended\n");
if (t_is_retr_async_reply()) {
xlog("L_INFO", "Dropping retransmitted reply which is still currently suspended\n");
drop();
}
route(N5_PATCH_MT_REQ);
}
# In case of 1xx and 2xx do NAT
if(status=~"[12][0-9][0-9]")
route(NATMANAGE);
@@ -237,13 +248,11 @@ route[N5_INIT_MT_REQ] {
#### 5G VoNR N5 NPCF Authorization reuqest
if(is_method("INVITE")){
xlog("L_DBG", "IMS: MTC INVITE TO $tU\n");
xlog("L_INFO", "IMS: MTC INVITE TO $tU\n");
## retrieving SDP Connection Info and Media Port for Orig UE ( in case we will start with INVITE), the values should be already there if the call fom UE registred to this P-CSCF, in case the call coming from outside then we need to get them from the initial INVITE
### due to the current limitation on SRS-gNodeB we will not use the values below, they are there just in case the limitation are fixed.
$var(sdp_src_ip) = $sdp(c:ip);
$var(sdp_src_port) = $sdp(m0:rtp:port);
$var(sdp_src_rtcp_port) = $sdp(m0:rtcp:port);
@@ -294,14 +303,14 @@ $var(sdp_mline_raw) = $sdp(m0:raw);
$sht(user_sdps_rtcp_port=>$var(user_id_sdp_rtcp_port)) = $var(sdp_src_rtcp_port);
xlog("L_INFO", "SDP RTCP_Media_Port of External UE $var(user_id_sdp_rtcp_port): $var(sdp_src_rtcp_port)\n");
} else {
xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_rtcp_port) is: $var(ue_sdp_rtcp_port)\n");
xlog("L_INFO", "SDP Port for UE with MSISDN $var(sdp_id_ue_port) is: $var(ue_sdp_port)\n");
}
#### now start to build the N5 Request
xlog("L_ALERT","DEBUG: Preparing QoS N5 Message to PCF for 18x Response from term UE\n");
xlog("L_INFO", "Preparing QoS N5 Message to PCF for INVITE TO term UE\n");
xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
xlog("L_INFO", "Initialize empty arrays and objects\n");
### Initialize empty arrays and objects
$var(events) = '[]';
@@ -322,7 +331,7 @@ $var(sdp_mline_raw) = $sdp(m0:raw);
### RTP
jansson_set("integer", "fNum", 1, "$var(medSubComp1)");
jansson_set("array", "fDescs", "[\"permit out 17 from any to any\", \"permit in 17 from any to any\"]", "$var(medSubComp1)"); ### setting the values to "any" untill SRS-gNodeB supports PDUSessionRessourceModification
jansson_set("array", "fDescs", "[\"permit out 17 from $var(sdp_src_ip) $var(sdp_src_port) to $dd 49000-51000\", \"permit in 17 from $dd 49000-51000 to $var(sdp_src_ip) $var(sdp_src_port)\"]", "$var(medSubComp1)");
jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp1)");
jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp1)");
jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp1)");
@@ -331,7 +340,7 @@ $var(sdp_mline_raw) = $sdp(m0:raw);
### RTCP
jansson_set("integer", "fNum", 2, "$var(medSubComp2)");
jansson_set("array", "fDescs", "[\"permit out 17 from any to any\", \"permit in 17 from any to any\"]", "$var(medSubComp2)"); ### setting the values to "any" untill SRS-gNodeB supports PDUSessionRessourceModification
jansson_set("array", "fDescs", "[\"permit out 17 from $var(sdp_src_ip) $var(sdp_src_rtcp_port) to $dd 49000-51000\", \"permit in 17 from $dd 49000-51000 to $var(sdp_src_ip) $var(sdp_src_rtcp_port)\"]", "$var(medSubComp2)");
jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp2)");
jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp2)");
jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp2)");
@@ -345,7 +354,7 @@ $var(sdp_mline_raw) = $sdp(m0:raw);
jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
xlog("L_ALERT","DEBUG: Set evSubsc\n");
xlog("L_INFO","DEBUG: Set evSubsc\n");
### Set evSubsc
jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
@@ -368,10 +377,10 @@ $var(sdp_mline_raw) = $sdp(m0:raw);
### Assemble the final JSON request
jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");
xlog("L_INFO","DEBUG: Set headers for the HTTP2 Request\n");
### Set headers
$var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
xlog("Today is $var(time_now)\n");
xlog("L_INFO", "Today is $var(time_now)\n");
$var(headers) = "Content-Type: application/json\r\n";
$var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
@@ -382,13 +391,17 @@ $var(sdp_mline_raw) = $sdp(m0:raw);
$var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
xlog("L_ALERT","DEBUG: Sending the request to PCF\n");
xlog("L_INFO","Sending the request to PCF\n");
### Send the request to PCF
http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions", "$var(json_request)", "$var(headers)", "$var(result)" );
xlog("HTTP response: $var(result)\n");
xlog("L_ALERT", "response header: $curlerror(error)\n");
xlog("L_ALERT", "response header: $var(response_code)\n");
xlog("L_ALERT", "response header: $httprhdr(location)\n");
### here we want to kill the dialog in case QoS faild or continue if QoS success.
switch ($rc) {
case 201:
xlog("L_INFO", "N5 QoS Session successfully Created $rc\n");
xlog("L_INFO", "HTTP results: $var(result)\n");
xlog("L_INFO", "HTTP response: $rc\n");
xlog("L_INFO", "Location Header: $httprhdr(location)\n");
# Now I will retrieve the AppSessionID out of the location Header it should be always at the end
# Example URL: "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/(someSessionID)"
@@ -413,10 +426,15 @@ $var(sdp_mline_raw) = $sdp(m0:raw);
# Extract the substring after the last slash
# now doing some magic
# Set the starting position after the last slash
$var(start_pos) = $var(pos) + 1;
$var(end_pos) = $var(len) - $var(start_pos);
$var(mtc_app_session) = $(var(url){s.substr,$var(start_pos),$var(end_pos)});
# Calculate the length of the substring after the last slash
$var(substring_length) = $var(len) - $var(start_pos);
# Extract the substring after the last slash
$var(mtc_app_session) = $(var(url){s.substr,$var(start_pos),$var(substring_length)});
# now checking it on console if I got what I wanted :
xlog("L_INFO", "AppSession for user $tU is: $var(mtc_app_session)\n");
@@ -425,18 +443,24 @@ $var(sdp_mline_raw) = $sdp(m0:raw);
# Store the AppSession in the hash table associated with the UE
$sht(user_data=>$var(term_user_id)) = $var(mtc_app_session);
xlog("L_INFO", "Stored AppSession for user $var(term_user_id): $var(mtc_app_session)\n");
}
xlog("L_INFO", "Stored AppSession for user $var(term_user_id): $var(mtc_app_session)\n");
break;
default:
xlog("L_ERR", "N5 QoS Session faild - Reason code: $rc\n");
send_reply("412", "MTC N5 QoS Session Creation faild");
exit;
} # switch ends here
# } # else for AppSession not null ends here
} # If Methode INVITE ends here
}
############
#############
#############
route[N5_PATCH_MT_REQ] {
xlog("L_DBG", "IMS: Received 183/200 from Term UE\n");
xlog("L_DBG", "M5 PATCH: Received SDP Change, doing N5 PATCH Request\n");
## retrieving SDP Connection Info and Media Port for UE
@@ -458,7 +482,7 @@ route[N5_PATCH_MT_REQ] {
$var(sdp_answ_port) = $sdp(m0:rtp:port);
$var(sdp_answ_rtcp_port) = $sdp(m0:rtcp:port);
$var(sdp_answ_codec) = $(rb{line.sw,a=rtpmap}{s.select,1, });
xlog("L_ALERT", "SDP Answer connection Info is: $var(sdp_answ_ip), RTP port $var(sdp_answ_port), RTCP Port $var(sdp_answ_rtcp_port) and codec is $var(sdp_answ_codec)\n");
xlog("L_INFO", "SDP Answer connection Info is: $var(sdp_answ_ip), RTP port $var(sdp_answ_port), RTCP Port $var(sdp_answ_rtcp_port) and codec is $var(sdp_answ_codec)\n");
## Retrieveing AppSession from initial INVITE N5 Request
$var(mtc_resp_app_id) = $tU; # User Part of the from Header to get the USER
@@ -467,9 +491,9 @@ route[N5_PATCH_MT_REQ] {
#### now start to build the N5 Request
xlog("L_ALERT","DEBUG: Preparing PATCH N5 Message for SDP Answer\n");
xlog("L_INFO","Preparing PATCH N5 Message for SDP Answer\n");
xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
xlog("L_INFO","Initialize empty arrays and objects\n");
### Initialize empty arrays and objects
$var(events) = '[]';
@@ -484,25 +508,25 @@ route[N5_PATCH_MT_REQ] {
### Set medComponents
jansson_set("integer", "medCompN", 1, "$var(medComp)");
# jansson_set("string", "qosReference", "qosVoNR", "$var(medComp)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "qosReference", "qosVoNR", "$var(medComp)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "medType", "AUDIO", "$var(medComp)");
jansson_set("array", "codecs", "[\"downlink\\n$var(sdp_answ_codec)\\n\", \"uplink\\n$var(sdp_answ_codec)\\n\"]", "$var(medComp)");
### RTP
jansson_set("integer", "fNum", 1, "$var(medSubComp1)");
jansson_set("array", "fDescs", "[\"permit out 17 from any to $var(sdp_answ_ip) $var(sdp_answ_port)\", \"permit in 17 from $var(sdp_answ_ip) $var(sdp_answ_port) to any\"]", "$var(medSubComp1)");
jansson_set("array", "fDescs", "[\"permit out 17 from $var(ue_sdp_ip) $var(ue_sdp_port) to $var(sdp_answ_ip) $var(sdp_answ_port)\", \"permit in 17 from $var(sdp_answ_ip) $var(sdp_answ_port) to $var(ue_sdp_ip) $var(ue_sdp_port)\"]", "$var(medSubComp1)");
jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp1)");
# jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp1)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
# jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp1)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp1)");
jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp1)");
jansson_set("string", "flowUsage", "NO_INFO", "$var(medSubComp1)");
### RTCP
jansson_set("integer", "fNum", 2, "$var(medSubComp2)");
jansson_set("array", "fDescs", "[\"permit out 17 from any to $var(sdp_answ_ip) $var(sdp_answ_rtcp_port)\", \"permit in 17 from $var(sdp_answ_ip) $var(sdp_answ_rtcp_port) to any\"]", "$var(medSubComp2)");
jansson_set("array", "fDescs", "[\"permit out 17 from $var(ue_sdp_ip) $var(ue_sdp_rtcp_port) to $var(sdp_answ_ip) $var(sdp_answ_rtcp_port)\", \"permit in 17 from $var(sdp_answ_ip) $var(sdp_answ_rtcp_port) to $var(ue_sdp_ip) $var(ue_sdp_rtcp_port)\"]", "$var(medSubComp2)");
jansson_set("string", "fStatus", "ENABLED", "$var(medSubComp2)");
# jansson_set("string", "marBwDl", "5000 Kbps", "$var(medSubComp2)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
# jansson_set("string", "marBwUl", "3000 Kbps", "$var(medSubComp2)"); # commented out BW accourding to Open5GC code if they are not there they will be taken from WEBGUI, could be reenabled if needed
jansson_set("string", "marBwDl", "6000 Kbps", "$var(medSubComp2)");
jansson_set("string", "marBwUl", "5000 Kbps", "$var(medSubComp2)");
jansson_set("string", "flowUsage", "RTCP", "$var(medSubComp2)");
# Merging the flows under MediaSubComponent
@@ -513,7 +537,7 @@ route[N5_PATCH_MT_REQ] {
jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
xlog("L_ALERT","DEBUG: Set evSubsc\n");
xlog("L_INFO","DEBUG: Set evSubsc\n");
### Set evSubsc
jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
@@ -528,18 +552,18 @@ route[N5_PATCH_MT_REQ] {
### Set other parameters in payload
jansson_set("string", "notifUri", "http://172.22.0.21:7777", "$var(payload)");
# jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
# jansson_set("string", "gpsi", "msisdn-$tU", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "gpsi", "msisdn-$tU", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "suppFeat", "2", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
# jansson_set("string", "ueIpv4", "$si", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
jansson_set("string", "ueIpv4", "$si", "$var(payload)"); # not all element in PATCH/Merge request are needed only the chanegd one, could be reenabled if needed
### Assemble the final JSON request
jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");
xlog("L_INFO","DEBUG: Set headers for the HTTP2 Request\n");
### Set headers
$var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
xlog("Today is $var(time_now)\n");
xlog("L_INFO", "Today is $var(time_now)\n");
$var(headers) = "Content-Type: application/merge-patch+json\r\n"; # added content-type an set it to "application/merge-patch+json" fo compatibility with RFC7386 for JSON PATCH/Merge
$var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
@@ -550,16 +574,25 @@ route[N5_PATCH_MT_REQ] {
$var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
xlog("L_ALERT","DEBUG: Sending the request to PCF\n");
xlog("L_INFO","Sending the request to PCF\n");
### Send the request to PCF
http_client_request_v2pk("PATCH", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_mtc_rep)", "$var(json_request)", "$var(headers)", "$var(result)" );
xlog("HTTP response: $var(result)\n");
xlog("L_ALERT", "response header: $curlerror(error)\n");
xlog("L_ALERT", "response header: $var(response_code)\n");
xlog("L_ALERT", "response header: $httprhdr(location)\n");
#### here we want to kill the dialog in case QoS faild or continue if QoS success.
switch ($rc) {
case 200:
xlog("L_INFO", "N5 QoS Session modification success - reason code: $rc\n");
xlog("L_INFO", "HTTP results: $var(result)\n");
xlog("L_INFO", "HTTP response: $rc\n");
xlog("L_INFO", "cURL Response: $curlerror(error)\n");
xlog("L_INFO", "Location Header header: $httprhdr(location)\n");
break;
default:
xlog("L_ERR", "N5 QoS Session modification faild - reason code: $rc\n");
send_reply("412", "MTC N5 QoS Session modify faild");
exit;
} # switch ends here
}
########################################
######### END of 5G VoNR N5 Request ####
########################################
@@ -568,19 +601,19 @@ route[N5_MTC_TERM] {
## something need to be clear here about BYE ;( To/From Headers!!!
xlog("L_ALERT","Terminating AppSession For Call fom User $fu due to call END\n");
xlog("L_ALERT","Terminating AppSession For Call for User $tU due to call END\n");
# Retrieveing and paying attention to whom ended teh call
$var(mtc_resp_app_id) = $tU; # User Part of the from Header to get the USER
$var(user_appsess_mtc_rep) = $sht(user_data=>$var(mtc_resp_app_id));
if $var(user_appsess_mtc_rep) == 0 {
xlog("L_INFO", "BYE sent from Term UE, doing alternative Method\n");
xlog("L_INFO", "we dont have AppSessionID to terminate, doing alternative Method\n");
# Retrieveing and paying attention to whom ended teh call
$var(mtc_resp_app_id) = $fU; # User Part of the from Header to get the USER
$var(user_appsess_mtc_rep) = $sht(user_data=>$var(mtc_resp_app_id));
xlog("L_INFO", "Alt-Method : Terminating Stored AppSession for user $var(mtc_resp_app_id): $var(user_appsess_mtc_rep)\n");
} else {
xlog("L_INFO", "BYE sent from Orig UE, doing normal Method\n");
xlog("L_INFO", "We have AppSessionID, doing normal Method\n");
xlog("L_INFO", "Normal Method : Stored MTC AppSession for user $var(mtc_resp_app_id): $var(user_appsess_mtc_rep)\n");
}
@@ -594,9 +627,7 @@ route[N5_MTC_TERM] {
$var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_mtc_rep)/delete", "$var(json_request)", "$var(headers)", "$var(result)" );
xlog("Termination resuls: $var(result)\n");
xlog("L_ALERT", "response header: $curlerror(error)\n");
xlog("L_ALERT", "response header: $var(response_code)\n");
xlog("L_ALERT", "response header: $httprhdr(location)\n");
xlog("L_INFO", "cURL header: $curlerror(error)\n");
xlog("L_INFO", "HTTP response: $rc\n");
}

View File

@@ -22,9 +22,9 @@ route[REGISTER] {
}
### N5 Request create and terminate
xlog("L_ALERT","Checking if its a Registration and not a De-Reg for $fu\n");
xlog("L_INFO","Checking if its a Registration and not a De-Reg for $fu\n");
$var(reg_exp) = $expires(min);
xlog("L_ALERT","Checking Expire $fu and it is : $var(reg_exp)\n");
xlog("L_INFO","Checking Expire $fu and it is : $var(reg_exp)\n");
# tying a dirty workaround to make it only excute after IPSec tunnel to prevent double excution
if ($expires(min) != 0 && is_present_hf("Security-Verify")) {
@@ -350,9 +350,9 @@ route[REGISTER_N5_Req]
{
xlog("L_ALERT","its a Registration, starting N5 Auth for $fu\n");
xlog("L_INFO","its a Registration, starting N5 QoS Auth for $fu\n");
xlog("L_ALERT","DEBUG: Initialize empty arrays and objects\n");
xlog("L_INFO","Initialize empty arrays and objects\n");
### Initialize empty arrays and objects
$var(events) = '[]';
$var(medComponents) = '{}';
@@ -381,7 +381,7 @@ route[REGISTER_N5_Req]
jansson_set("obj", "0", "$var(medComp)", "$var(medComponents)");
jansson_set("obj", "medComponents", "$var(medComponents)", "$var(payload)");
xlog("L_ALERT","DEBUG: Set evSubsc\n");
xlog("L_INFO","Set evSubsc\n");
### Set evSubsc
jansson_set("string", "event", "QOS_NOTIF", "$var(event1)");
@@ -395,7 +395,7 @@ xlog("L_ALERT","DEBUG: Set evSubsc\n");
jansson_set("obj", "evSubsc", "$var(evSubsc)", "$var(payload)");
### Set other parameters in payload
jansson_set("string", "notifUri", "http://172.22.0.21:8284", "$var(payload)");
jansson_set("string", "notifUri", "http://172.22.0.21:7777", "$var(payload)");
jansson_set("string", "sponStatus", "SPONSOR_DISABLED", "$var(payload)");
jansson_set("string", "supi", "imsi-$au", "$var(payload)");
jansson_set("string", "suppFeat", "2", "$var(payload)");
@@ -404,10 +404,10 @@ xlog("L_ALERT","DEBUG: Set evSubsc\n");
### Assemble the final JSON request
jansson_set("obj", "ascReqData", "$var(payload)", "$var(json_request)");
xlog("L_ALERT","DEBUG: Set headers for the HTTP2 Request\n");
xlog("L_INFO","Set headers for the HTTP2 Request\n");
### Set headers
$var(time_now)=$_s($timef(%a, %d %b %Y %H:%M:%S %Z));
xlog("L_ALERT", "Today is $var(time_now)\n");
xlog("L_INFO", "Today is $var(time_now)\n");
$var(headers) = "Content-Type: application/json\r\n";
$var(headers) = $var(headers) + "3gpp-sbi-discovery-target-nf-type: NRF\r\n";
@@ -417,13 +417,17 @@ xlog("L_ALERT","DEBUG: Set evSubsc\n");
$var(headers) = $var(headers) + "3gpp-sbi-discovery-service-names: npcf-policyauthorization\r\n";
$var(headers) = $var(headers) + "3gpp-sbi-sender-timestamp: " + $var(time_now);
xlog("L_ALERT","DEBUG: Sending the request to PCF\n");
xlog("L_INFO","DEBUG: Sending the request to PCF\n");
### Send the request to PCF
http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions", "$var(json_request)", "$var(headers)", "$var(result)" );
xlog("L_ALERT", "HTTP response: $var(result)\n");
xlog("L_ALERT", "response header: $curlerror(error)\n");
xlog("L_ALERT", "response header: $var(response_code)\n");
xlog("L_ALERT", "response header: $httprhdr(location)\n");
### here we want to kill the dialog in case QoS faild or continue if QoS success.
switch ($rc) {
case 201:
xlog("L_INFO", "N5 QoS Session successfully Created $rc\n");
xlog("L_INFO", "HTTP results: $var(result)\n");
xlog("L_INFO", "HTTP response: $rc\n");
xlog("L_INFO", "Location Header: $httprhdr(location)\n");
xlog("L_ALERT","Saving AppSessionID to HTABLE\n");
@@ -480,8 +484,13 @@ xlog("L_ALERT","DEBUG: Set evSubsc\n");
# Store the AppSession in the hash table associated with the UE
$sht(user_ids=>$var(ue_imsi_reg_ip)) = $var(ue_imsi);
xlog("L_INFO", "Stored IMSI for IP $var(ue_imsi_reg_ip) is: $var(ue_imsi)\n");
# now contiue with Reg Proccess
break;
# now contiue with Reg Proccess, Or:
default:
xlog("L_ERR", "N5 QoS Session faild - Reason code: $rc\n");
send_reply("412", "Register N5 QoS Session Creation faild");
exit;
} # switch ends here
### N5 REQ Route END
}
@@ -507,8 +516,9 @@ route[REG_N5_TERMINATE]
http_client_request_v2pk("POST", "http://172.22.0.27:7777/npcf-policyauthorization/v1/app-sessions/$var(user_appsess_dereg)/delete", "$var(json_request)", "$var(headers)", "$var(result)" );
xlog("Termination resuls: $var(result)\n");
xlog("L_ALERT", "response header: $curlerror(error)\n");
xlog("L_ALERT", "response header: $var(response_code)\n");
xlog("L_ALERT", "response header: $httprhdr(location)\n");
xlog("L_ALERT", "cURL response: $curlerror(error)\n");
xlog("L_INFO", "HTTP results: $var(result)\n");
xlog("L_INFO", "HTTP response: $rc\n");
xlog("L_INFO", "Location Header: $httprhdr(location)\n");
}

View File

@@ -222,8 +222,8 @@ modparam("rr", "custom_user_avp", "$avp(RR_CUSTOM_USER_AVP)")
# -- usrloc params --
modparam("ims_usrloc_scscf", "enable_debug_file", 0)
modparam("ims_usrloc_scscf", "matching_mode", 0)
modparam("ims_usrloc_scscf", "maxcontact", 5)
modparam("ims_usrloc_scscf", "maxcontact_3gpp", 5)
modparam("ims_usrloc_scscf", "maxcontact", 1) # set to one as workaround for instable Link
modparam("ims_usrloc_scscf", "maxcontact_3gpp", 1) # set to one as workaround for instable Link
modparam("ims_registrar_scscf", "max_contacts", 5)
modparam("ims_usrloc_scscf", "maxcontact_behaviour", 2) #overwrite
#!ifdef DB_URL