diff --git a/lib/python/asterisk/sipp.py b/lib/python/asterisk/sipp.py index a7bf5d539..74700e601 100644 --- a/lib/python/asterisk/sipp.py +++ b/lib/python/asterisk/sipp.py @@ -143,9 +143,9 @@ def run(self): """ super(SIPpTestCase, self).run() - for a in range(1, self.asterisk_instances): - self.ast[a-1].cli_exec('sip set debug on') - self.ast[a-1].cli_exec('pjsip set logger on') + for a in range(0, self.asterisk_instances): + self.ast[a].cli_exec('sip set debug on') + self.ast[a].cli_exec('pjsip set logger on') LOGGER.info("creating ami factory") if not isinstance(self.connect_ami, dict): @@ -556,6 +556,9 @@ def errReceived(self, data): # SIPp will send some 'normal' messages to stderr. Buffer them so we # can output them later if we want self.stderr.append(data) + LOGGER.debug("Received from SIPp scenario %s:\n %s" % (self._name, + data.decode('utf-8', 'ignore'))) + self.output += data.decode('utf-8', 'ignore') def processEnded(self, reason): """Override of ProcessProtocol.processEnded""" diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/configs/ast1/extensions.conf b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/configs/ast1/extensions.conf index 0031d35f1..0bc2a51dd 100644 --- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/configs/ast1/extensions.conf +++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/configs/ast1/extensions.conf @@ -1,9 +1,9 @@ [default] -exten => call_c,1,NoOp() - same => n,Dial(PJSIP/charlie) +exten => bob,1,NoOp() + same => n,Dial(PJSIP/bob) same => n,Hangup() -exten => call_a,1,NoOp() - same => n,Dial(PJSIP/alice) +exten => charlie,1,NoOp() + same => n,Dial(PJSIP/charlie) same => n,Hangup() diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/configs/ast1/pjsip.conf b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/configs/ast1/pjsip.conf index 62bc07a36..0d3a97bca 100644 --- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/configs/ast1/pjsip.conf +++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/configs/ast1/pjsip.conf @@ -9,15 +9,10 @@ context=default disallow=all allow=ulaw direct_media=no -aors=alice send_pai=yes send_rpid=yes callerid=Alice -[alice] -type=aor -contact=sip:alice@127.0.0.1:5068 - [bob] type=endpoint context=default @@ -27,6 +22,11 @@ direct_media=no send_pai=yes send_rpid=yes callerid=Bob +aors=bob + +[bob] +type=aor +contact=sip:bob@127.0.0.4:5060 [charlie] type=endpoint @@ -41,4 +41,4 @@ callerid=Charlie [charlie] type=aor -contact=sip:charlie@127.0.0.1:5067 +contact=sip:charlie@127.0.0.5:5060 diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/referer.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/alice_calls_bob.xml similarity index 81% rename from tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/referer.xml rename to tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/alice_calls_bob.xml index ad6a0d302..c84243a90 100644 --- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/referer.xml +++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/alice_calls_bob.xml @@ -22,13 +22,13 @@ ;tag=[call_number] - To: + From: ;tag=[call_number] + To: Call-ID: [call_id] CSeq: [cseq] INVITE - Contact: + Contact: Content-Type: application/sdp Max-Forwards: 70 Content-Length: [len] @@ -54,30 +54,31 @@ Max-Forwards: 70 Content-Length: 0 ]]> + + Contact: Content-Type: application/sdp Max-Forwards: 70 Content-Length: [len] @@ -103,13 +104,13 @@ Max-Forwards: 70 Content-Length: 0 @@ -152,55 +153,22 @@ + Contact: Max-Forwards: 70 Refer-to: <[$remote_contact]?Replaces=REMOTE[$callid_chunk_1]%40[$callid_chunk_2]%3Bto-tag%3D[$remote_to_tag]%3Bfrom-tag%3D[$remote_from_tag]> - Referred-By: sip:bob@[local_ip] + Referred-By: sip:alice@[local_ip] Content-Length: 0 ]]> - - - - Content-Length:0 - - ]]> - - - - - - - Content-Length:0 - - ]]> - - diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/referee.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/alice_calls_charlie.xml similarity index 88% rename from tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/referee.xml rename to tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/alice_calls_charlie.xml index ad0285c35..38e663929 100644 --- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/referee.xml +++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/alice_calls_charlie.xml @@ -32,13 +32,13 @@ ;tag=[call_number] - To: + From: ;tag=[call_number] + To: Call-ID: [call_id] CSeq: [cseq] INVITE - Contact: + Contact: Max-Forwards: 70 Content-Type: application/sdp Content-Length: [len] @@ -80,7 +80,7 @@ Call-ID: [$original_callid] Remote-To-Tag: [$to_tag] Remote-From-Tag: [$from_tag] - Remote-URI: sip:call_a@[remote_ip]:[remote_port] + Remote-URI: sip:charlie@[remote_ip]:[remote_port] ]]> @@ -89,13 +89,13 @@ Max-Forwards: 70 Content-Length: 0 diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/uas.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/bob.xml similarity index 96% rename from tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/uas.xml rename to tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/bob.xml index b7b295182..0591d793d 100644 --- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/uas.xml +++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/bob.xml @@ -84,12 +84,12 @@ - - - + diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/uas_hangup.xml b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/charlie.xml similarity index 95% rename from tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/uas_hangup.xml rename to tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/charlie.xml index 9f395b60a..68efdf2e5 100644 --- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/uas_hangup.xml +++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/sipp/charlie.xml @@ -86,12 +86,12 @@ - - - ;tag=[call_number] + From: ;tag=[call_number] To: <[$remote_user]@[remote_ip]:[remote_port]>[$remote_tag] Call-ID: [call_id] CSeq: [cseq] BYE - Contact: sip:charlie@[local_ip]:[local_port] + Contact: Max-Forwards: 70 Subject: Performance Test Content-Length: 0 diff --git a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/test-config.yaml b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/test-config.yaml index cd0c6c4ec..1324856e0 100644 --- a/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/test-config.yaml +++ b/tests/channels/pjsip/transfers/attended_transfer/nominal/caller_local_blonde/test-config.yaml @@ -4,20 +4,43 @@ testinfo: "Originate two SIP calls through Asterisk to remote endpoints and then have one originating call transfer the other via REFER with Replaces header. - The four SIPp scenarios involved perform the following actions: - SIPp #1 (referer.xml) calls through Asterisk to SIPp #2 (uas.xml) - SIPp #1 kicks off SIPp #3 (referee.xml) which calls SIPp #4 (uas_hangup.xml). - SIPp #3 passes call information back to SIPp #1. - Before SIPp #4 answers SIPp #1 initiates an attended transfer via REFER with Replaces information from SIPp #3. - SIPp #3 is hung up. - SIPp #1 hangs up. - SIPp #4 continues to ring until it answers. - SIPp #2 receives a connected line update and the values are checked. - SIPp #4 answers. - SIPp #2 and SIPp #4 are bridged. - SIPp #4 receives a connected line update and the values are checked. - SIPp #4 hangs up. - SIPp #2 is hung up." + High-level scenario: + Alice calls Bob. When he answers, Alice puts him on hold. + Alice calls Charlie. Before he answers, Alice does a REFER Bob->Charlie. + When Charlie answers he and Bob are bridged and Alice goes away. + + NOTE: sipp doesn't allow more than one dialog in a scenario file so Alice + is actually implemented in two scenario files: alice_calls_bob and alice_calls_charlie. + The two coordinate using sipp's 3pcc capability. + + Low-level flow: + alice_calls_bob starts by calling bob. + bob answers. + alice_calls_bob waits for a second then sends a reINVITE to put bob on hold. + alice_calls_bob does a sendCmd to start alice_calls_charlie then waits on a recvCmd from alice_calls_charlie. + charlie waits 5 seconds before answering. + alice_calls_charlie waits 1 second then does a sendCmd back to alice_calls_bob. + charlie is still waiting. + alice_calls_bob recvCmd returns. + alice_calls_bob does a REFER bob->charlie. + alice_calls_bob receives a 202 and 2 NOTIFYs. The NOTIFYs are handled automatically by sipp. + alice_calls_bob waits again on a recvCmd from alice_calls_charlie. + alice_calls_charlie gets a 603 and sends an ACK. + alice_calls_charlie does a sendCmd to alice_calls_bob. + alice_calls_charlie.xml ENDS. + alice_calls_bob.xml recvCmd returns. + alice_calls_bob.xml sends a BYE. + alice_calls_bob.xml receives a 481. + alice_calls_bob.xml ENDS. + charlie finally answers. + charlie gets an ACK followed by a reINVITE with Bob's callerID. + charlie sends a 200 and gets an ACK. + bob gets a reINVITE with Charlie's callerID. + bob sends a 200 and gets an ACK. + bob waits on a BYE. + charlie sends a BYE. + bob gets the BYE and ENDS. + charlie ENDS. test-modules: add-test-to-search-path: True @@ -34,10 +57,14 @@ test-object-config: test-iterations: - scenarios: - - { 'key-args': {'scenario':'uas.xml', '-p':'5067', '-m':'2', '-sleep': '2'} } - - { 'key-args': {'scenario':'uas_hangup.xml', '-p':'5068', '-m':'2', '-sleep': '2'} } - - { 'coordinated-sender': {'key-args': {'scenario':'referer.xml', '-p':'5066', '-sleep': '2'} }, - 'coordinated-receiver': {'key-args': {'scenario':'referee.xml', '-p':'5065'} } } + - { 'coordinated-sender': {'key-args': {'scenario':'alice_calls_bob.xml', '-i':'127.0.0.2', '-p':'5060', '-sleep': '2'}, + 'ordered-args': [ '-aa', '-bind_local' ] }, + 'coordinated-receiver': {'key-args': {'scenario':'alice_calls_charlie.xml', '-i':'127.0.0.3', '-p':'5060'}, + 'ordered-args': [ '-bind_local' ] } } + - { 'key-args': {'scenario':'bob.xml', '-i':'127.0.0.4', '-p':'5060', '-m':'2', '-sleep': '2'}, + 'ordered-args': [ '-bind_local' ] } + - { 'key-args': {'scenario':'charlie.xml', '-i':'127.0.0.5', '-p':'5060', '-m':'2', '-sleep': '2'}, + 'ordered-args': [ '-bind_local' ] } ami-config: -