diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2024-03-28 21:17:12 +0100 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2024-04-02 08:22:08 +0000 |
commit | 37ee0ed83ca11a50a46cb582482ea72401b3253f (patch) | |
tree | 3a644cbe85666d36c153f952acfe1848a06dca78 /library | |
parent | fb34d863c3a016269d74c3818b5404bea4cc9d7e (diff) |
Introduce Asterisk_Tests testsuite
Add initial infrastructure to run tests against an Asterisk process.
An not-yet-finished draft test doing registration is submitted to
validate communication towards Asterisk works.
The testsuite will be improved in follow-up commits, but this way other
people can already start using it and we can set up the dockerized setup
+ jenkins jobs to run it nightly.
Related: SYS#6782
Change-Id: I66f776d5df6fb5dc488d9e589b84a6b2385406e8
Diffstat (limited to 'library')
-rw-r--r-- | library/SIP_Emulation.ttcn | 21 | ||||
-rw-r--r-- | library/SIP_Templates.ttcn | 20 |
2 files changed, 40 insertions, 1 deletions
diff --git a/library/SIP_Emulation.ttcn b/library/SIP_Emulation.ttcn index e71c611b..41e69753 100644 --- a/library/SIP_Emulation.ttcn +++ b/library/SIP_Emulation.ttcn @@ -72,6 +72,13 @@ template RequestLine tr_ReqLine(template Method method) := { sipVersion := ? } +private template PDU_SIP_Request tr_SIP_REGISTER := { + requestLine := tr_ReqLine(REGISTER_E), + msgHeader := t_SIP_msgHeader_any, + messageBody := *, + payload := * +} + private template PDU_SIP_Request tr_SIP_INVITE := { requestLine := tr_ReqLine(INVITE_E), msgHeader := t_SIP_msgHeader_any, @@ -79,7 +86,6 @@ private template PDU_SIP_Request tr_SIP_INVITE := { payload := * } - template SipUrl tr_SIP_Url(template charstring user_or_num, template charstring host := *, template integer portField := *) := { @@ -286,6 +292,19 @@ runs on SIP_Emulation_CT { } } + /* a ConnHdlr is sending us a SIP REGISTER: Forward to SIP port */ + [] CLIENT.receive(tr_SIP_REGISTER) -> value sip_req sender vc_conn { + var CallidString call_id := sip_req.msgHeader.callId.callid; + if (f_call_id_known(call_id)) { + /* re-register */ + vc_conn := f_comp_by_call_id(call_id); + } else { + /* new REGISTER: add to table */ + f_call_table_add(vc_conn, call_id); + } + SIP.send(sip_req); + } + /* a ConnHdlr is sending us a SIP INVITE: Forward to SIP port */ [] CLIENT.receive(tr_SIP_INVITE) -> value sip_req sender vc_conn { var CallidString call_id := sip_req.msgHeader.callId.callid; diff --git a/library/SIP_Templates.ttcn b/library/SIP_Templates.ttcn index f48d1371..fc8e23f6 100644 --- a/library/SIP_Templates.ttcn +++ b/library/SIP_Templates.ttcn @@ -525,6 +525,26 @@ tr_SIP_Response(template CallidString call_id, payload := omit } +/* Expect during first REGISTER when authorization is required: */ +template (present) PDU_SIP_Response +tr_SIP_Response_REGISTER_Unauthorized( + template CallidString call_id, + template SipAddr from_addr, + template SipAddr to_addr, + template (present) Via via := tr_Via_from(?), + template Contact contact := *, + template integer seq_nr := ?, + template charstring method := "REGISTER", + template integer status_code := 401, + template charstring reason := "Unauthorized", + template charstring body := *) := { + statusLine := tr_SIP_StatusLine(status_code, reason), + msgHeader := tr_SIP_msgh_std(call_id, from_addr, to_addr, contact, + via, + method, *, seq_nr), + messageBody := body, + payload := omit +} /* RFC 3261 8.1.1.5: * "The sequence number value MUST be expressible as a 32-bit unsigned integer |