diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2024-05-22 17:03:53 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2024-05-22 18:29:02 +0200 |
commit | bd279b85bc9b489ff4e63201dc8e2da3956f7d51 (patch) | |
tree | efe0b61dd322f03dc4c9ec3d0456fd60515a9e76 | |
parent | 16675fe77075da02fa53fdfb0c277f2c0c6564a5 (diff) |
asterisk: Send P-Associated-URI in IMS Register Responsepespin/asterisk
Change-Id: I4c163f34c052d0463baba799c44fecaaa15be394
-rw-r--r-- | asterisk/IMS_ConnectionHandler.ttcn | 15 | ||||
-rw-r--r-- | library/SIP_Templates.ttcn | 44 |
2 files changed, 53 insertions, 6 deletions
diff --git a/asterisk/IMS_ConnectionHandler.ttcn b/asterisk/IMS_ConnectionHandler.ttcn index 091f5dab..a55935a8 100644 --- a/asterisk/IMS_ConnectionHandler.ttcn +++ b/asterisk/IMS_ConnectionHandler.ttcn @@ -66,6 +66,7 @@ type record IMS_ConnHdlrPars { charstring user, charstring display_name, charstring password, + charstring msisdn, /* Expected User-Location-Info in P-Access-Network-Info */ charstring uli_str, octetstring rand, @@ -150,6 +151,7 @@ template (value) IMS_ConnHdlrPars t_IMS_Pars(charstring local_sip_host, user := user, display_name := f_sip_str_quote(display_name), password := password, + msisdn := "90828", uli_str := "2380100010000101", /* The Nonce field is the Base64 encoded version of the RAND value and concatenated with the AUTN: */ rand := '14987631f65f8e3788a0798b6ebcd08e'O, @@ -404,6 +406,7 @@ altstep as_IMS_register(boolean exp_update_to_direct_rtp := true, var template (value) SipAddr to_addr; var template (value) CommaParam_List digestCln ; var template (value) WwwAuthenticate wwwAuthenticate; + var template (value) P_Associated_Uri p_associated_uri := ts_P_Associated_Uri({}); var template (value) Security_server security_server; var template (value) Server server_name := ts_Server({c_sip_server_name}); var template (value) Require require := ts_Require({"sec-agree"}); @@ -487,6 +490,7 @@ altstep as_IMS_register(boolean exp_update_to_direct_rtp := true, wwwAuthenticate, sip_seq_nr, "REGISTER", + p_associated_uri := p_associated_uri, security_server := security_server, server := server_name, supported := supported, @@ -537,6 +541,16 @@ altstep as_IMS_register(boolean exp_update_to_direct_rtp := true, /* Validate P-Access-Network-Info: */ f_ims_validate_register_P_Access_Network_info(g_rx_sip_req, exp_present := true); + p_associated_uri := ts_P_Associated_Uri({ + ts_P_Assoc_uri_spec(ts_NameAddr(ts_SipUrl(ts_HostPort(g_pars.realm), + ts_UserInfo(g_pars.msisdn), + scheme := "sip"))), + ts_P_Assoc_uri_spec(ts_NameAddr(ts_SipUrl(ts_HostPort(g_pars.msisdn), + omit, + scheme := "tel"))), + ts_P_Assoc_uri_spec(g_rx_sip_req.msgHeader.toField.addressField.nameAddr) + }); + /* Tx 200 OK */ to_addr.params := f_sip_param_set(to_addr.params, "tag", f_sip_rand_tag()); tx_resp := ts_SIP_Response(sip_call_id, @@ -546,6 +560,7 @@ altstep as_IMS_register(boolean exp_update_to_direct_rtp := true, sip_seq_nr, "OK", via, + p_associated_uri := p_associated_uri, require := require, server := server_name, supported := supported, diff --git a/library/SIP_Templates.ttcn b/library/SIP_Templates.ttcn index 56404dad..72a44263 100644 --- a/library/SIP_Templates.ttcn +++ b/library/SIP_Templates.ttcn @@ -37,16 +37,18 @@ function f_ts_Param_omit(template (value) charstring id, } template (value) SipUrl ts_SipUrl(template (value) HostPort host_port, - template (omit) UserInfo user_info := omit) := { - scheme := "sip", + template (omit) UserInfo user_info := omit, + template (value) charstring scheme := "sip") := { + scheme := scheme, userInfo := user_info, hostPort := host_port, urlParameters := omit, headers := omit } template (present) SipUrl tr_SipUrl(template (present) HostPort host_port := ?, - template UserInfo user_info := *) := { - scheme := "sip", + template UserInfo user_info := *, + template (present) charstring scheme := "sip") := { + scheme := scheme, userInfo := user_info, hostPort := host_port, urlParameters := *, @@ -54,8 +56,9 @@ template (present) SipUrl tr_SipUrl(template (present) HostPort host_port := ?, } template (value) SipUrl ts_SipUrlHost(template (value) charstring host, - template (omit) integer portField := omit) - := ts_SipUrl(ts_HostPort(host, portField)); + template (omit) integer portField := omit, + template (value) charstring scheme := "sip") + := ts_SipUrl(ts_HostPort(host, portField), scheme := scheme); function ts_SipUrl_from_Addr_Union(template (value) Addr_Union au) return template (value) SipUrl { @@ -241,6 +244,27 @@ template (present) P_Access_Network_Info tr_P_Access_Network_Info(template (pres access_net_specs := access_net_specs } +// [RFC3455 4.1] +template (present) P_Assoc_uri_spec tr_P_Assoc_uri_spec(template (present) NameAddr p_asso_uri := ?, + template SemicolonParam_List ai_params := *) := { + p_asso_uri := p_asso_uri, + ai_params := ai_params +} +template (value) P_Assoc_uri_spec ts_P_Assoc_uri_spec(template (value) NameAddr p_asso_uri, + template (omit) SemicolonParam_List ai_params := omit) := { + p_asso_uri := p_asso_uri, + ai_params := ai_params +} + +// [RFC3455 4.1] +template (present) P_Associated_Uri tr_P_Associated_Uri(template (present) P_Assoc_uri_spec_list p_assoc_uris := ?) := { + fieldName := P_ASSOCIATED_URI, + p_assoc_uris := p_assoc_uris +} +template (value) P_Associated_Uri ts_P_Associated_Uri(template (value) P_Assoc_uri_spec_list p_assoc_uris := {}) := { + fieldName := P_ASSOCIATED_URI, + p_assoc_uris := p_assoc_uris +} // [20.32] template (value) Require ts_Require(template (value) OptionTag_List optionsTags := {}) := { @@ -588,6 +612,7 @@ ts_SIP_msgh_std(template (value) CallidString call_id, template (omit)Authorization authorization := omit, template (omit) Allow allow := ts_Allow(c_SIP_defaultMethods), template (omit) Expires expires := omit, + template (omit) P_Associated_Uri p_associated_uri := omit, template (omit) Require require := omit, template (omit) Security_client security_client := omit, template (omit) Security_server security_server := omit, @@ -616,6 +641,7 @@ ts_SIP_msgh_std(template (value) CallidString call_id, addressField := from_addr.addr, fromParams := from_addr.params }, + p_associated_uri := p_associated_uri, require := require, security_client := security_client, security_server := security_server, @@ -644,6 +670,7 @@ tr_SIP_msgh_std(template CallidString call_id, template Allow allow := *, template Authorization authorization := *, template Expires expires := *, + template P_Associated_Uri p_associated_uri := *, template Require require := *, template Security_client security_client := *, template Security_server security_server := *, @@ -672,6 +699,7 @@ tr_SIP_msgh_std(template CallidString call_id, addressField := from_addr.addr, fromParams := from_addr.params }, + p_associated_uri := p_associated_uri, require := require, security_client := security_client, security_server := security_server, @@ -864,6 +892,7 @@ ts_SIP_Response(template (value) CallidString call_id, charstring reason, Via via, template (omit) Allow allow := omit, + template (omit) P_Associated_Uri p_associated_uri := omit, template (omit) Require require := omit, template (omit) Server server := omit, template (omit) Supported supported := omit, @@ -875,6 +904,7 @@ ts_SIP_Response(template (value) CallidString call_id, content_length := f_ContentLength(body), content_type := f_ContentTypeOrOmit(ts_CT_SDP, body), allow := allow, + p_associated_uri := p_associated_uri, require := require, server := server, supported := supported, @@ -936,6 +966,7 @@ ts_SIP_Response_Unauthorized( integer seq_nr, charstring method := "REGISTER", template (omit) Allow allow := omit, + template (omit) P_Associated_Uri p_associated_uri := omit, template (omit) Security_server security_server := omit, template (omit) Server server := omit, template (omit) Supported supported := omit, @@ -947,6 +978,7 @@ ts_SIP_Response_Unauthorized( content_length := f_ContentLength(body), content_type := f_ContentTypeOrOmit(ts_CT_SDP, body), allow := allow, + p_associated_uri := p_associated_uri, security_server := security_server, server := server, supported := supported, |