pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36488?usp=email )
Change subject: SIP: generate seq_nr within allowed range ...................................................................... SIP: generate seq_nr within allowed range Change-Id: Iea5f4568af1bd795db57d2b77e82d976edc9e337 --- M library/SIP_Templates.ttcn M sip/SIP_Tests.ttcn 2 files changed, 20 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/88/36488/1 diff --git a/library/SIP_Templates.ttcn b/library/SIP_Templates.ttcn index 75681a9..f57b524 100644 --- a/library/SIP_Templates.ttcn +++ b/library/SIP_Templates.ttcn @@ -1,6 +1,7 @@ module SIP_Templates { import from SIPmsg_Types all; +import from Osmocom_Types all; /* wrapper type to encapsulate the Addr_Union + parameter list used in From, To. ... */ type record SipAddr { @@ -409,5 +410,13 @@ } +/* RFC 3261 8.1.1.5: + * "The sequence number value MUST be expressible as a 32-bit unsigned integer + * and MUST be less than 2**31." + */ +function f_sip_rand_seq_nr() return integer { + /* 2**31 = 2147483648 */ + return f_rnd_int(2147483648) +} } diff --git a/sip/SIP_Tests.ttcn b/sip/SIP_Tests.ttcn index 9d92b87..ab33af7 100644 --- a/sip/SIP_Tests.ttcn +++ b/sip/SIP_Tests.ttcn @@ -101,13 +101,13 @@ if (cp.is_mo) { cp.comp.sip_url_ext := valueof(ts_SipAddr(cp.called, mp_local_host, 5060)); cp.comp.sip_url_gsm := valueof(ts_SipAddr(cp.calling, mp_osmosip_host, 5060)); - cp.mncc_call_id := f_rnd_int(429496725); + cp.mncc_call_id := f_sip_rand_seq_nr(); } else { cp.comp.sip_url_ext := valueof(ts_SipAddr(cp.calling, mp_local_host, 5060)); cp.comp.sip_url_gsm := valueof(ts_SipAddr(cp.called, mp_osmosip_host, 5060)); cp.comp.sip_call_id := hex2str(f_rnd_hexstring(15)); } - cp.comp.sip_seq_nr := f_rnd_int(4294967295); + cp.comp.sip_seq_nr := f_sip_rand_seq_nr(); cp.comp.sip_body := ""; } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36488?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Iea5f4568af1bd795db57d2b77e82d976edc9e337 Gerrit-Change-Number: 36488 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pes...@sysmocom.de> Gerrit-MessageType: newchange