Discussion:
[Sipp-users] Understanding loops and conditions in UAC scenario with SIPp
Joel Serrano
2016-01-20 02:53:26 UTC
Permalink
Hi everybody,

I'm new to the list. I'm trying to create a simple scenario with SIPp but
I'm running into the following problem:

During an active call, the UAC might receive a MESSAGE request from the UAS
and it has to answer with a 200 OK to that MESSAGE.

This can happen X times.

Also, it is possible that the BYE comes from the UAS, we have to consider
that option too.

With my current config, I get a message when the script starts that says
"<recv> before <send> sequence without a mandatory message. Please remove
one 'optional=true'..."


SIPp UAC Remote UAS
|(1) INVITE |
|--------------------->|
|(2) 100 (Optional) |
|<---------------------|
|(3) 180 (Optional) |
|<---------------------|
|(4) 183 (Optional) |
|<---------------------|
|(5) 200 |
|<---------------------|
|(6) ACK |
|--------------------->|
| |
|(7) MESSAGE (Optional)| -----+
|<---------------------| |
| | +---- Loop until I get a BYE
|(8) 200 (Optional) | |
|--------------------->| -----+
| |
|(7) BYE | -----+
|<-------------------->| |
| | +---- The BYE can be sent from the UAC
or the UAS.
|(9) 200 | |
|<-------------------->| -----+



My scenario.xml is the as follows:


<scenario name="Test UAC">
<send retrans="500">
<![CDATA[
INVITE [...]
]]>
</send>

<recv response="100" optional="true">
</recv>

<recv response="180" optional="true">
</recv>

<recv response="183" optional="true">
</recv>

<recv response="200" rtd="true">
</recv>

<send>
<![CDATA[
ACK [...]
]]>
</send>

<recv request="MESSAGE" optional="true">
</recv>

<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Content-Length: 0
]]>
</send>

<pause/>

<send retrans="500">
<![CDATA[
BYE [...]
]]>
</send>

<recv response="200" crlf="true">
</recv>

<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>

<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>

</scenario>

I run the script with:

sipp -d 20000 -s *52 X.X.X.X:5060 -r 1 -l 1 -m 1 -trace_msg -trace_err -i
public_ip -sf scenario.xml -inf database.csv


I have read the conditional branching documentation:

http://sipp.sourceforge.net/doc/reference.html#branching

I have also found this previous post in the list with a similar problem:

http://sourceforge.net/p/sipp/mailman/message/9014449/


So for the MESSAGE I think I have to play with the next and label
parameters, but I have tried several combinations and I can't get it to
work.

For the BYE being able to come from UAC if timeout is reached or from UAS
before the timeout is reached is another problem I don't know how to handle.

If there is any more documentation I have missed that can help me figure
this out I would be more than welcome to read it.

All help/comments are appreciated.


Thanks in advance.

Best regards,
Joel.
sindelka
2016-01-20 11:35:59 UTC
Permalink
Hi Joel,

first: given your requirements, please forget about a "simple" scenario.

second: can you re-confirm that the MESSAGE requests do come within the
dialog initiated by the INVITE, i.e. that they are logically related to
and only meaningful within the scope of that dialog (call), and thus
they technically have the same Call-ID, local tag and remote tag like
the 200(INVITE) and the ACK? Because this is critically important to
choose the right way of handling them in the scenario. A wireshark trace
(pcap) which contains the INVITE, 200(INVITE), ACK and MESSAGE,
200(MESSAGE) is fine if you are not sure about the answer.

third: until recent, SIPp required that sending of any message (except
the very first one in an UAC scenario) was triggered by exactly one of
two possible events:
- reception of a SIP or 3PCC message,
- expiration of a "pause" timer.

These two methods could not (and still cannot) be used in parallel, but
there is a recently introduced set of "recv" attributes, called
"timeout" and "ontimeout". Use of these attributes may be your way out
for simple cases (with some drawbacks mentioned below).

In your flow graph, you wrote "loop until I get a BYE" at one place, but
"the BYE can be sent from the UAC or the UAS" on another. Taken
strictly, these two things are contradictory. So what you actually want
the scenario to do is the following: "start waiting for an incoming
message for N seconds. While waiting, serve appropriately any message
which possibly comes in, but unless it is a BYE, continue waiting; if
those N seconds expire and none of the received messages was a BYE, send
it yourself".

If the MESSAGEs are actually not part of the dialog initiated by the
INVITE sent by your UAC scenario, you can (and have to) serve them at
other place than where you wait for the eventual BYE. Doing so requires
to involve 3PCC as I've suggested at this link:
http://sourceforge.net/p/sipp/mailman/message/34707334/ (except that in
your case, you would handle MESSAGE instead of OPTIONS).

In this case, where you only have to decide whether to send the BYE
<recv request="BYE" next="respond_received_BYE" timeout="10000"
ontimeout="send_my_own_BYE"/>
But as said, use of timeout and ontimeout would not save you from using
the 3PCC as use of 3PCC would be necessary to handle incoming
out-of-dialog MESSAGEs, so you may as well use 3PCC for timing the own
BYE instead of the timeout and ontimeout attributes.

If the MESSAGEs are really part of the dialog as you wrote, you wouldn't
need to use 3PCC to handle them, but without 3PCC you would be unable to
schedule your own BYE to a fixed time after sending the ACK regardless
the number of received MESSAGEs. So if you can and want to avoid 3PCC,
...INVITE, 100, 180, 200 ...
<send>
...
ACK...
...
</send>
<label id="wait_for_BYE_or_MESSAGE"/>
<recv request="MESSAGE" optional="true" next="respond_received_MESSAGE"/>
<recv request="BYE" next="respond_received_BYE" timeout="5000"
ontimeout="send_my_own_BYE"/>
<label id="respond_received_BYE"/>
<send next="end_of_call">
...
200...
...
Cseq: [cseq] MESSAGE
...
</send>
<label id="respond_received_MESSAGE"/>
<send next="wait_for_BYE_or_MESSAGE">
...
200...
...
Cseq: [cseq] MESSAGE
...
</send>
<label id=""send_my_own_BYE"/>
<send...
...
BYE...
...
</send>
<recv response="200"/>
<label id="end_of_call"/>
This way, you would send your own BYE if no message would have been
received during 5 seconds since you've sent your last one (ACK or
200(MESSAGE)).

If you need a fixed time between the ACK and your own BYE, regardless
the number of MESSAGEs to come in the meantime, you would need a 3PCC
twin scenario which would receive a command from the basic one and send
its own command back after a pause. The basic scenario would then look
...INVITE, 100, 180, 200 ...
<send>
...
ACK...
...
</send>
<sendCmd>
...
[last_Call-id:]
...
</sendCmd>
<label id="wait_for_BYE_or_MESSAGE"/>
<recv request="MESSAGE" optional="true" next="respond_received_MESSAGE"/>
<recv request="BYE" optional="true" next="respond_received_BYE"/>
<recvCmd next="send_my_own_BYE"/>
<label id="respond_received_BYE"/>
<send next="end_of_call">
...
200...
...
Cseq: [cseq] MESSAGE
...
</send>
<label id="respond_received_MESSAGE"/>
<send next="wait_for_BYE_or_MESSAGE">
...
200...
...
Cseq: [cseq] MESSAGE
...
</send>
<label id=""send_my_own_BYE"/>
<send...
...
BYE...
...
</send>
<recv response="200"/>
<label id="end_of_call"/>
Use of timeout and ontimeout in your scenario affects call statistics,
because a call in which a timeout has expired is counted as a failed
one. So if this is an issue for you, you have to use 3PCC. For me it wasn't.

I don't exclude I don't remember the details of use of timeout and
ontimeout attributes properly, so if it doesn't work for you, come back
to me, I'll dig in my old scenarios.

Also feel free to ask about other things, I may have been unclear somewhere.

Pavel
Hi everybody,
I'm new to the list. I'm trying to create a simple scenario with SIPp
During an active call, the UAC might receive a MESSAGE request from
the UAS and it has to answer with a 200 OK to that MESSAGE.
This can happen X times.
Also, it is possible that the BYE comes from the UAS, we have to
consider that option too.
With my current config, I get a message when the script starts that
says "<recv> before <send> sequence without a mandatory
message. Please remove one 'optional=true'..."
SIPp UAC Remote UAS
|(1) INVITE |
|--------------------->|
|(2) 100 (Optional) |
|<---------------------|
|(3) 180 (Optional) |
|<---------------------|
|(4) 183 (Optional) |
|<---------------------|
|(5) 200 |
|<---------------------|
|(6) ACK |
|--------------------->|
| |
|(7) MESSAGE (Optional)| -----+
|<---------------------| |
| | +---- Loop until I get a BYE
|(8) 200 (Optional) | |
|--------------------->| -----+
| |
|(7) BYE | -----+
|<-------------------->| |
| | +---- The BYE can be sent from the UAC
or the UAS.
|(9) 200 | |
|<-------------------->| -----+
<scenario name="Test UAC">
<send retrans="500">
<![CDATA[
INVITE [...]
]]>
</send>
<recv response="100" optional="true">
</recv>
<recv response="180" optional="true">
</recv>
<recv response="183" optional="true">
</recv>
<recv response="200" rtd="true">
</recv>
<send>
<![CDATA[
ACK [...]
]]>
</send>
<recv request="MESSAGE" optional="true">
</recv>
<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Content-Length: 0
]]>
</send>
<pause/>
<send retrans="500">
<![CDATA[
BYE [...]
]]>
</send>
<recv response="200" crlf="true">
</recv>
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>
sipp -d 20000 -s *52 X.X.X.X:5060 -r 1 -l 1 -m 1 -trace_msg -trace_err
-i public_ip -sf scenario.xml -inf database.csv
http://sipp.sourceforge.net/doc/reference.html#branching
http://sourceforge.net/p/sipp/mailman/message/9014449/
So for the MESSAGE I think I have to play with the next and label
parameters, but I have tried several combinations and I can't get it
to work.
For the BYE being able to come from UAC if timeout is reached or from
UAS before the timeout is reached is another problem I don't know how
to handle.
If there is any more documentation I have missed that can help me
figure this out I would be more than welcome to read it.
All help/comments are appreciated.
Thanks in advance.
Best regards,
Joel.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Sipp-users mailing list
https://lists.sourceforge.net/lists/listinfo/sipp-users
Joel Serrano
2016-01-21 04:40:55 UTC
Permalink
Hi Pavel,

First of all, thank you very much for such a detailed explanation.

I'm separating my answer in blocks so we can keep the multi-conversation in
one thread :)

-----------

** I checked the sip capture, and yes, the messages belong to the dialog,
so they have the same Call-Id, etc. (this is good as it makes things
"easier").

-----------

I tried your version without 3PCC:

[...]
<recv request="MESSAGE" optional="true" next="respond_received_MESSAGE"/>
<recv request="BYE" next="respond_received_BYE" timeout="5000"
ontimeout="send_my_own_BYE"/>
[...]


In this case:

If I get a MESSAGE, it will respond with the OK, and go back to waiting, so
far ok, but after 5 seconds of waiting (the timeout) the flow doesn't jump
to "send_my_own_BYE" and the BYE is not sent, it stays waiting for ever.

If I force the UAS to send a BYE, it will jump correctly to
"respond_received_BYE" and respond with an OK, so the call ends correctly.

So, as an initial approach, I would only need to figure out why it waits
for the BYE for ever instead of sending it after the timeout value (in this
case, 5 seconds).


When we get this sorted out, I might have to go with 3PCC to avoid the
"failed calls" if we hit the timeout (but that is definitely secondary at
the moment).

Do you know why it can be that it waits for the BYE for ever?


-----------

In your second version, the 3PCC, I don't understand quite well how is the
use of the sendCmd and recvCmd or the concept "twin scenario". Can you
please give me more details on how that works?

Do I need to run several instances of sipp with different XMLs to achieve
the "twin scenario" or can I do it with all in one XML? Does the -3pcc
parameter need to be specified in the command?



-----------

And some offtopic questions:

1) Can I put several "exec" statements inside one "nop"/"action"? Example:

<nop>
<action>
<exec play_pcap_audio="rec1.pcap"/>
<exec play_pcap_audio="rec2.pcap"/>
<exec play_pcap_audio="rec3.pcap"/>
</action>
</nop>

Or do they need to be each "exec" in a unique "action" ? Or maybe even one
"nop" + "action" per "exec"?

2) If you play a pcap audio, does the execution stop until the play is
complete, or does it continue and therefor you have to add a "pause" of the
pcap length in order for the flow to not continue until the play has
finished? Example of a 10 second duration pcap:

<nop>
<action>
<exec play_pcap_audio="test.pcap"/>
</action>
</nop>
<pause milliseconds="10000"/>

3) In the non-3PCC I don't have the <pause/> parameter because the duration
is "hard-coded" to the timeout value when waiting for the BYE, correct?

4) In the 3PCC version (although I don't quite understand how that works
yet) where should the <pause/> go to be able to modify the call duration
with the "-d" parameter in the command?


-----------


Thank you again for your help.

Best regards,
Joel.
Post by sindelka
Hi Joel,
first: given your requirements, please forget about a "simple" scenario.
second: can you re-confirm that the MESSAGE requests do come within the
dialog initiated by the INVITE, i.e. that they are logically related to and
only meaningful within the scope of that dialog (call), and thus they
technically have the same Call-ID, local tag and remote tag like the
200(INVITE) and the ACK? Because this is critically important to choose the
right way of handling them in the scenario. A wireshark trace (pcap) which
contains the INVITE, 200(INVITE), ACK and MESSAGE, 200(MESSAGE) is fine if
you are not sure about the answer.
third: until recent, SIPp required that sending of any message (except the
very first one in an UAC scenario) was triggered by exactly one of two
- reception of a SIP or 3PCC message,
- expiration of a "pause" timer.
These two methods could not (and still cannot) be used in parallel, but
there is a recently introduced set of "recv" attributes, called "timeout"
and "ontimeout". Use of these attributes may be your way out for simple
cases (with some drawbacks mentioned below).
In your flow graph, you wrote "loop until I get a BYE" at one place, but
"the BYE can be sent from the UAC or the UAS" on another. Taken strictly,
these two things are contradictory. So what you actually want the scenario
to do is the following: "start waiting for an incoming message for N
seconds. While waiting, serve appropriately any message which possibly
comes in, but unless it is a BYE, continue waiting; if those N seconds
expire and none of the received messages was a BYE, send it yourself".
If the MESSAGEs are actually not part of the dialog initiated by the
INVITE sent by your UAC scenario, you can (and have to) serve them at other
place than where you wait for the eventual BYE. Doing so requires to
http://sourceforge.net/p/sipp/mailman/message/34707334/ (except that in
your case, you would handle MESSAGE instead of OPTIONS).
In this case, where you only have to decide whether to send the BYE
<recv request="BYE" next="respond_received_BYE" timeout="10000"
ontimeout="send_my_own_BYE"/>
But as said, use of timeout and ontimeout would not save you from using
the 3PCC as use of 3PCC would be necessary to handle incoming out-of-dialog
MESSAGEs, so you may as well use 3PCC for timing the own BYE instead of the
timeout and ontimeout attributes.
If the MESSAGEs are really part of the dialog as you wrote, you wouldn't
need to use 3PCC to handle them, but without 3PCC you would be unable to
schedule your own BYE to a fixed time after sending the ACK regardless the
number of received MESSAGEs. So if you can and want to avoid 3PCC, you may
...INVITE, 100, 180, 200 ...
<send>
...
ACK...
...
</send>
<label id="wait_for_BYE_or_MESSAGE"/>
<recv request="MESSAGE" optional="true" next="respond_received_MESSAGE"/>
<recv request="BYE" next="respond_received_BYE" timeout="5000"
ontimeout="send_my_own_BYE"/>
<label id="respond_received_BYE"/>
<send next="end_of_call">
...
200...
...
Cseq: [cseq] MESSAGE
...
</send>
<label id="respond_received_MESSAGE"/>
<send next="wait_for_BYE_or_MESSAGE">
...
200...
...
Cseq: [cseq] MESSAGE
...
</send>
<label id=""send_my_own_BYE"/>
<send...
...
BYE...
...
</send>
<recv response="200"/>
<label id="end_of_call"/>
This way, you would send your own BYE if no message would have been
received during 5 seconds since you've sent your last one (ACK or
200(MESSAGE)).
If you need a fixed time between the ACK and your own BYE, regardless the
number of MESSAGEs to come in the meantime, you would need a 3PCC twin
scenario which would receive a command from the basic one and send its own
command back after a pause. The basic scenario would then look the
...INVITE, 100, 180, 200 ...
<send>
...
ACK...
...
</send>
<sendCmd>
...
[last_Call-id:]
...
</sendCmd>
<label id="wait_for_BYE_or_MESSAGE"/>
<recv request="MESSAGE" optional="true" next="respond_received_MESSAGE"/>
<recv request="BYE" optional="true" next="respond_received_BYE"/>
<recvCmd next="send_my_own_BYE"/>
<label id="respond_received_BYE"/>
<send next="end_of_call">
...
200...
...
Cseq: [cseq] MESSAGE
...
</send>
<label id="respond_received_MESSAGE"/>
<send next="wait_for_BYE_or_MESSAGE">
...
200...
...
Cseq: [cseq] MESSAGE
...
</send>
<label id=""send_my_own_BYE"/>
<send...
...
BYE...
...
</send>
<recv response="200"/>
<label id="end_of_call"/>
Use of timeout and ontimeout in your scenario affects call statistics,
because a call in which a timeout has expired is counted as a failed one.
So if this is an issue for you, you have to use 3PCC. For me it wasn't.
I don't exclude I don't remember the details of use of timeout and
ontimeout attributes properly, so if it doesn't work for you, come back to
me, I'll dig in my old scenarios.
Also feel free to ask about other things, I may have been unclear somewhere.
Pavel
Hi everybody,
I'm new to the list. I'm trying to create a simple scenario with SIPp but
During an active call, the UAC might receive a MESSAGE request from the
UAS and it has to answer with a 200 OK to that MESSAGE.
This can happen X times.
Also, it is possible that the BYE comes from the UAS, we have to consider
that option too.
With my current config, I get a message when the script starts that says
"<recv> before <send> sequence without a mandatory message. Please remove
one 'optional=true'..."
SIPp UAC Remote UAS
|(1) INVITE |
|--------------------->|
|(2) 100 (Optional) |
|<---------------------|
|(3) 180 (Optional) |
|<---------------------|
|(4) 183 (Optional) |
|<---------------------|
|(5) 200 |
|<---------------------|
|(6) ACK |
|--------------------->|
| |
|(7) MESSAGE (Optional)| -----+
|<---------------------| |
| | +---- Loop until I get a BYE
|(8) 200 (Optional) | |
|--------------------->| -----+
| |
|(7) BYE | -----+
|<-------------------->| |
| | +---- The BYE can be sent from the UAC
or the UAS.
|(9) 200 | |
|<-------------------->| -----+
<scenario name="Test UAC">
<send retrans="500">
<![CDATA[
INVITE [...]
]]>
</send>
<recv response="100" optional="true">
</recv>
<recv response="180" optional="true">
</recv>
<recv response="183" optional="true">
</recv>
<recv response="200" rtd="true">
</recv>
<send>
<![CDATA[
ACK [...]
]]>
</send>
<recv request="MESSAGE" optional="true">
</recv>
<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Content-Length: 0
]]>
</send>
<pause/>
<send retrans="500">
<![CDATA[
BYE [...]
]]>
</send>
<recv response="200" crlf="true">
</recv>
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>
sipp -d 20000 -s *52 X.X.X.X:5060 -r 1 -l 1 -m 1 -trace_msg -trace_err -i
public_ip -sf scenario.xml -inf database.csv
http://sipp.sourceforge.net/doc/reference.html#branching
http://sourceforge.net/p/sipp/mailman/message/9014449/
So for the MESSAGE I think I have to play with the next and label
parameters, but I have tried several combinations and I can't get it to
work.
For the BYE being able to come from UAC if timeout is reached or from UAS
before the timeout is reached is another problem I don't know how to handle.
If there is any more documentation I have missed that can help me figure
this out I would be more than welcome to read it.
All help/comments are appreciated.
Thanks in advance.
Best regards,
Joel.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Sipp-users mailing list
https://lists.sourceforge.net/lists/listinfo/sipp-users
sindelka
2016-01-21 11:39:57 UTC
Permalink
Hi Joel,

I'll follow your idea of subthreads and hope that if someone else needs
to read that conversation, they won't get lost. So my answers are inside
your text.

P.
Post by Joel Serrano
Hi Pavel,
First of all, thank you very much for such a detailed explanation.
I'm separating my answer in blocks so we can keep the
multi-conversation in one thread :)
-----------
** I checked the sip capture, and yes, the messages belong to the
dialog, so they have the same Call-Id, etc. (this is good as it makes
things "easier").
-----------
[...]
<recv request="MESSAGE" optional="true" next="respond_received_MESSAGE"/>
<recv request="BYE" next="respond_received_BYE" timeout="5000"
ontimeout="send_my_own_BYE"/>
[...]
If I get a MESSAGE, it will respond with the OK, and go back to
waiting, so far ok, but after 5 seconds of waiting (the timeout) the
flow doesn't jump to "send_my_own_BYE" and the BYE is not sent, it
stays waiting for ever.
If I force the UAS to send a BYE, it will jump correctly to
"respond_received_BYE" and respond with an OK, so the call ends correctly.
So, as an initial approach, I would only need to figure out why it
waits for the BYE for ever instead of sending it after the timeout
value (in this case, 5 seconds).
When we get this sorted out, I might have to go with 3PCC to avoid the
"failed calls" if we hit the timeout (but that is definitely secondary
at the moment).
Do you know why it can be that it waits for the BYE for ever?
I've checked my older scenarios where I was using the "timeout" and
"ontimeout" attributes and they look the same as above with one
negligible exception: I didn't use the "next" attribute, because it is
not necessary if the "send 200(BYE)" immediately follows the "recv BYE
within a timeout". In the example I've given, I've provided the "next"
attribute only in order to make it more illustrative through use of
self-explaining label names for both possible output branches of the
command.

So as I can see no typo in your command, before digging any deeper, the
first question has to be "what version of SIPp do you use"? The reason
is that
- the timeout and ontimeout attributes have been introduced as late as
in SIPp 3.2 if I'm not mistaken, while label naming (in addition to the
original numbering-only) has been introduced a bit earlier,
- SIPp silently ignores any unrecognized attributes of the commands.

So if you use 3.2 or newer SIPp, send me your complete scenario, leaving
the mailing list out, we'll eventually post the results of the
investigation to the mailing list.

I guess you've identified my copy-paste error and you send Cseq with BYE
in the 200 response to the received BYE (instead of my Cseq with MESSAGE
in the 200 to BYE).
Post by Joel Serrano
-----------
In your second version, the 3PCC, I don't understand quite well how is
the use of the sendCmd and recvCmd or the concept "twin scenario". Can
you please give me more details on how that works?
Do I need to run several instances of sipp with different XMLs to
achieve the "twin scenario" or can I do it with all in one XML? Does
the -3pcc parameter need to be specified in the command?
I've described that in detail in the thread for which I've provided the
link to the mailing list archive, but briefly:
- yes, you need a separate scenario for the "twin" (timer) instance, as
each instance is a separate process bound to its own socket etc., and
you cannot ask the sipp binary to fork into two processes, each running
a different scenario. So your batch file for routine operation would
look like
Post by Joel Serrano
sipp -p 5062 -sf 3pcc_timer.xml -bg -...
sipp -p 5060 -sf main.xml -...
But while debugging, run the timer instance without the -bg in its own
window, and start it before the main instance as well (because, quite
logically, UAS scenarios should be started before UAC scenarios if they
are intended to cooperate).

- the 3pcc_timer scenario should look like
Post by Joel Serrano
<recvCmd/>
<pause/>
<sendCmd>
<![CDATA[
[last_Call-id:]
]]>
</sendCmd>
<pause milliseconds="32000"/>
Written this way, you would control the duration of the first pause (and
thus of those calls which the main scenario would actively terminate)
using the -d parameter of the sipp shell command used to start the timer
instance, while the second pause, whose duration is explicitly stated in
the scenario, is there to let the main instance finish the activity it
has to do after receiving the 3pcc command from the timer instance. I
had some problems with the timer instance (or even a particular call in
it, I don't remember exactly) terminating the twin call of the main
instance if it had nothing more to do itself. But the overall case may
have been slightly different from the one we discuss here - the timer
instance was most likely an UAC one and the main one was UAS, while in
the current case the roles are swapped. So you can try to remove the
last pause from the timer scenario, but I recommend you to do do so only
after debugging the basic idea.

If eventually sipp would complain that it cannot determine whether the
3pcc_timer is a UAC or a UAS scenario, put a fudge <recv
request="INVITE" optional="true"/> before the <recvCmd/>, that should
stop the complaints.
Post by Joel Serrano
-----------
Anyting offtopic is a bad idea on any "spread-the-wisdom" platform like
this mailing list, because no one else can find such off-topic
information they'd be possibly interested in because the thread subject
doesn't give a clue about its presence. We have no "tags" or "keywords"
here to assist in search. Nevertheless, find my answers below the questions.
Post by Joel Serrano
<nop>
<action>
<exec play_pcap_audio="rec1.pcap"/>
<exec play_pcap_audio="rec2.pcap"/>
<exec play_pcap_audio="rec3.pcap"/>
</action>
</nop>
Or do they need to be each "exec" in a unique "action" ? Or maybe even
one "nop" + "action" per "exec"?
You can specify several actions within a single <action> tag, and I'd
say there may even safely be several <exec> actions. But several <exec
play_pcap_audio=.../> actions started in the same <action> make no
sense, so I have never tried it and so I don't know the intensity of the
resulting fireworks. A pcapplay starts replaying an RTP stream from a
single local socket to a single remote socket (as indicated by the
SDPs), so doing so several times in parallel is to no good even if SIPp
would somehow manage to do that.
Post by Joel Serrano
2) If you play a pcap audio, does the execution stop until the play is
complete, or does it continue and therefor you have to add a "pause"
of the pcap length in order for the flow to not continue until the
<nop>
<action>
<exec play_pcap_audio="test.pcap"/>
</action>
</nop>
<pause milliseconds="10000"/>
As written in the documentation, <exec play_pcap_audio=.../> starts a
new internal thread and the scenario execution is not paused until the
replay action ends, so the timing must (and, more important, may) be
provided using additional means. So in your case, you may start
replaying a pcap simultaneously with sending the ACK, and the handling
of the received MESSAGEs will not interrupt the replay. However, an end
of the respective call does stop the replay if I remember right. This is
not the case if you <exec> an external command, though. Once you start
an external command, it lives its own life regardless what happens to
the call which has triggered it.

So chaining several play_pcap_audios is a doggy business if you also
need to use external timing of the call (through received BYE messages
or 3pcc commands). So better merge them into one in advance, which is a
separate topic.
Post by Joel Serrano
3) In the non-3PCC I don't have the <pause/> parameter because the
duration is "hard-coded" to the timeout value when waiting for the
BYE, correct?
Exactly. The "timeout" attribute of <recv> is almost the same as the
"milliseconds" attribute of <pause>, except that the value of the
"timeout" attribute must (currently?) be a constant, so you cannot
calculate it dynamically during call run like you can with
"milliseconds". So if you ever need this, you have to use 3pcc and
deliver the required pause duration to the timer instance, using a
forged header (such as "P-my-pause-duration:") of the <sendCmd> payload
and regexp-based extraction of the value from that header in the
<recvCmd> in the timer scenario.
Post by Joel Serrano
4) In the 3PCC version (although I don't quite understand how that
works yet) where should the <pause/> go to be able to modify the call
duration with the "-d" parameter in the command?
As already detailed above. Any <pause/> without the "milliseconds"
attribute in a scenario has a duration specified by the -d command line
parameter.
Post by Joel Serrano
-----------
Thank you again for your help.
Best regards,
Joel.
Joel Serrano
2016-01-22 00:35:35 UTC
Permalink
Hi Pavel,

* Sorry for the off-topic questions, you are right and they don't belong to
this thread (won't happen again).

* I tried removing the "next" from the <recv> inside non-3pcc scenario, but
still the same issue, it would wait for ever, so I have moved on going
toward the 3pcc way.

* Now that I understand how the 3PCC works, I have a "working" scenario. In
order for it to work, I had to change in the 3pcc_timer.xml two things, you
were right that it requires a fudge INVITE for it to start, otherwise it
complains with: "Unable to determine send mode of the tool (server,
client)". The other change was is the sendCmd, although it was receiving
correctly the msg, it was answering without a caller-id and that was making
the main die because it wouldn't recognize the msg without a caller-id. I
used -trace_msg to see this.

Before:

<sendCmd>
<![CDATA[
[last_Call-ID:]
]]>
</sendCmd>

After:

<sendCmd>
<![CDATA[
Call-ID: [call_id]
]]>
</sendCmd>


Solved that, the scenario works as described initially, but, I have
realized that what I wan't to achieve is not working 100%.

Going back to the explanation:

A-- main sends INVITE
B-- uas sends 100, 180, 183, OK
C-- main sends ACK
D-- main sendCmd to timer
E-- timer counts to X (defined in -d parameter). || main may receive a
MESSAGE or BYE during this timer and it will do what it has to do.
F-- timer reaches X, and sendCmd back to main
G-- main recvCmd and sends BYE to uas. (call ends).

If during the timer, main receives a (or multiple) MESSAGE(s) it will
responde OK, if it receives a BYE it will respond OK and end the call, so
we are good here.

My issue now, is that I need the timer to be reset on every MESSAGE
received.

So te be more specific, I have set the -d timer on the command to 1 minute:

# sipp -sf 3pcc_timer.xml -3pcc localhost:9001 -p 5061 -d 60000 -trace_err
-trace_msg -trace_shortmsg

I run the main with:

# sipp -s test X.X.X.X:6061 -r 1 -l 1 -m 1 -i X.X.X.X -sf main.xml -inf
fields.csv -3pcc localhost:9001 -trace_err -trace_msg -trace_shortmsg

(I'm using latest version to avoid known issues: SIPp
v3.4.1-SCTP-PCAP-RTPSTREAM)

Right now, after 1 minute, the call will end, doesn't matter if it has
processed 0 MESSAGES or 100 MESSAGES. It will only end before the minute if
it receives a BYE from the uas. This is correct and I what I requested in
the first email.

Can I add something so the timer resets if it receives a MESSAGE? So the
idea would be for the call to end 1 minute after the *last* MESSAGE was
received or directly after 1 minute if no MESSAGE is received at all.


I tried changing this:

[...]
<sendCmd>
<![CDATA[
[last_Call-ID:]
]]>
</sendCmd>

<label id="wait_for_BYE_or_MESSAGE"/>

<recv request="MESSAGE" optional="true" next="respond_received_MESSAGE"/>
<recv request="BYE" optional="true" next="respond_received_BYE"/>

<recvCmd next="send_my_own_BYE"/>

<label id="respond_received_BYE"/>
<send next="end_of_call">
<![CDATA[
...
SIP/2.0 200 OK
...
]]>
</send>

<label id="respond_received_MESSAGE"/>
<send next="wait_for_BYE_or_MESSAGE">
<![CDATA[
...
SIP/2.0 200 OK
...
]]>
</send>

<label id="send_my_own_BYE"/>
[...]

to this:

[...]
<label id="wait_for_BYE_or_MESSAGE"/>

<sendCmd>
<![CDATA[
[last_Call-ID:]
]]>
</sendCmd>

<recv request="MESSAGE" optional="true" next="respond_received_MESSAGE"/>
<recv request="BYE" optional="true" next="respond_received_BYE"/>

<recvCmd next="send_my_own_BYE"/>

<label id="respond_received_BYE"/>
<send next="end_of_call">
<![CDATA[
...
SIP/2.0 200 OK
...
]]>
</send>

<label id="respond_received_MESSAGE"/>
<send next="wait_for_BYE_or_MESSAGE">
<![CDATA[
...
SIP/2.0 200 OK
...
]]>
</send>

<label id="send_my_own_BYE"/>
[...]

NOTE: I have moved the <label id="wait_for_BYE_or_MESSAGE"/> before the
sendCmd, and that works partially: on every MESSAGE received, a new sendCmd
is executed and received by the timer, but it doesn't reset, so when the
very first timer ends, it sends back the msg and the main ends the call
even though there maybe 1 o 2 (or whatever) commands still pending to be
processed.

I don't know if I am explaining myself correctly. I didn't note this in my
first email because I have realized this was necessary as a result of
testing with the working 3PCC scenario. My bad, sorry.

Again thank you very much for your help and time.

Best regards,
Joel.
Post by sindelka
Hi Joel,
I'll follow your idea of subthreads and hope that if someone else needs to
read that conversation, they won't get lost. So my answers are inside your
text.
P.
Hi Pavel,
First of all, thank you very much for such a detailed explanation.
I'm separating my answer in blocks so we can keep the multi-conversation
in one thread :)
-----------
** I checked the sip capture, and yes, the messages belong to the dialog,
so they have the same Call-Id, etc. (this is good as it makes things
"easier").
-----------
[...]
<recv request="MESSAGE" optional="true" next="respond_received_MESSAGE"/>
<recv request="BYE" next="respond_received_BYE" timeout="5000"
ontimeout="send_my_own_BYE"/>
[...]
If I get a MESSAGE, it will respond with the OK, and go back to waiting,
so far ok, but after 5 seconds of waiting (the timeout) the flow doesn't
jump to "send_my_own_BYE" and the BYE is not sent, it stays waiting for
ever.
If I force the UAS to send a BYE, it will jump correctly to
"respond_received_BYE" and respond with an OK, so the call ends correctly.
So, as an initial approach, I would only need to figure out why it waits
for the BYE for ever instead of sending it after the timeout value (in this
case, 5 seconds).
When we get this sorted out, I might have to go with 3PCC to avoid the
"failed calls" if we hit the timeout (but that is definitely secondary at
the moment).
Do you know why it can be that it waits for the BYE for ever?
I've checked my older scenarios where I was using the "timeout" and
"ontimeout" attributes and they look the same as above with one negligible
exception: I didn't use the "next" attribute, because it is not necessary
if the "send 200(BYE)" immediately follows the "recv BYE within a timeout".
In the example I've given, I've provided the "next" attribute only in order
to make it more illustrative through use of self-explaining label names for
both possible output branches of the command.
So as I can see no typo in your command, before digging any deeper, the
first question has to be "what version of SIPp do you use"? The reason is
that
- the timeout and ontimeout attributes have been introduced as late as in
SIPp 3.2 if I'm not mistaken, while label naming (in addition to the
original numbering-only) has been introduced a bit earlier,
- SIPp silently ignores any unrecognized attributes of the commands.
So if you use 3.2 or newer SIPp, send me your complete scenario, leaving
the mailing list out, we'll eventually post the results of the
investigation to the mailing list.
I guess you've identified my copy-paste error and you send Cseq with BYE
in the 200 response to the received BYE (instead of my Cseq with MESSAGE in
the 200 to BYE).
-----------
In your second version, the 3PCC, I don't understand quite well how is the
use of the sendCmd and recvCmd or the concept "twin scenario". Can you
please give me more details on how that works?
Do I need to run several instances of sipp with different XMLs to achieve
the "twin scenario" or can I do it with all in one XML? Does the -3pcc
parameter need to be specified in the command?
I've described that in detail in the thread for which I've provided the
- yes, you need a separate scenario for the "twin" (timer) instance, as
each instance is a separate process bound to its own socket etc., and you
cannot ask the sipp binary to fork into two processes, each running a
different scenario. So your batch file for routine operation would look like
sipp -p 5062 -sf 3pcc_timer.xml -bg -...
sipp -p 5060 -sf main.xml -...
But while debugging, run the timer instance without the -bg in its own
window, and start it before the main instance as well (because, quite
logically, UAS scenarios should be started before UAC scenarios if they are
intended to cooperate).
- the 3pcc_timer scenario should look like
<recvCmd/>
<pause/>
<sendCmd>
<![CDATA[
[last_Call-id:]
]]>
</sendCmd>
<pause milliseconds="32000"/>
Written this way, you would control the duration of the first pause (and
thus of those calls which the main scenario would actively terminate) using
the -d parameter of the sipp shell command used to start the timer
instance, while the second pause, whose duration is explicitly stated in
the scenario, is there to let the main instance finish the activity it has
to do after receiving the 3pcc command from the timer instance. I had some
problems with the timer instance (or even a particular call in it, I don't
remember exactly) terminating the twin call of the main instance if it had
nothing more to do itself. But the overall case may have been slightly
different from the one we discuss here - the timer instance was most likely
an UAC one and the main one was UAS, while in the current case the roles
are swapped. So you can try to remove the last pause from the timer
scenario, but I recommend you to do do so only after debugging the basic
idea.
If eventually sipp would complain that it cannot determine whether the
3pcc_timer is a UAC or a UAS scenario, put a fudge <recv request="INVITE"
optional="true"/> before the <recvCmd/>, that should stop the complaints.
-----------
Anyting offtopic is a bad idea on any "spread-the-wisdom" platform like
this mailing list, because no one else can find such off-topic information
they'd be possibly interested in because the thread subject doesn't give a
clue about its presence. We have no "tags" or "keywords" here to assist in
search. Nevertheless, find my answers below the questions.
<nop>
<action>
<exec play_pcap_audio="rec1.pcap"/>
<exec play_pcap_audio="rec2.pcap"/>
<exec play_pcap_audio="rec3.pcap"/>
</action>
</nop>
Or do they need to be each "exec" in a unique "action" ? Or maybe even one
"nop" + "action" per "exec"?
You can specify several actions within a single <action> tag, and I'd say
there may even safely be several <exec> actions. But several <exec
play_pcap_audio=.../> actions started in the same <action> make no sense,
so I have never tried it and so I don't know the intensity of the resulting
fireworks. A pcapplay starts replaying an RTP stream from a single local
socket to a single remote socket (as indicated by the SDPs), so doing so
several times in parallel is to no good even if SIPp would somehow manage
to do that.
2) If you play a pcap audio, does the execution stop until the play is
complete, or does it continue and therefor you have to add a "pause" of the
pcap length in order for the flow to not continue until the play has
<nop>
<action>
<exec play_pcap_audio="test.pcap"/>
</action>
</nop>
<pause milliseconds="10000"/>
As written in the documentation, <exec play_pcap_audio=.../> starts a new
internal thread and the scenario execution is not paused until the replay
action ends, so the timing must (and, more important, may) be provided
using additional means. So in your case, you may start replaying a pcap
simultaneously with sending the ACK, and the handling of the received
MESSAGEs will not interrupt the replay. However, an end of the respective
call does stop the replay if I remember right. This is not the case if you
<exec> an external command, though. Once you start an external command, it
lives its own life regardless what happens to the call which has triggered
it.
So chaining several play_pcap_audios is a doggy business if you also need
to use external timing of the call (through received BYE messages or 3pcc
commands). So better merge them into one in advance, which is a separate
topic.
3) In the non-3PCC I don't have the <pause/> parameter because the
duration is "hard-coded" to the timeout value when waiting for the BYE,
correct?
Exactly. The "timeout" attribute of <recv> is almost the same as the
"milliseconds" attribute of <pause>, except that the value of the "timeout"
attribute must (currently?) be a constant, so you cannot calculate it
dynamically during call run like you can with "milliseconds". So if you
ever need this, you have to use 3pcc and deliver the required pause
duration to the timer instance, using a forged header (such as
"P-my-pause-duration:") of the <sendCmd> payload and regexp-based
extraction of the value from that header in the <recvCmd> in the timer
scenario.
4) In the 3PCC version (although I don't quite understand how that works
yet) where should the <pause/> go to be able to modify the call duration
with the "-d" parameter in the command?
As already detailed above. Any <pause/> without the "milliseconds"
attribute in a scenario has a duration specified by the -d command line
parameter.
-----------
Thank you again for your help.
Best regards,
Joel.
sindelka
2016-01-22 11:49:53 UTC
Permalink
Hi Joel,

so to summarize, what I was considering a drawback of the (timeout,
ontimeout) based handling of the call limiting timer, i.e. that each new
MESSAGE would effectivery restart the timer, is actually the desired
behaviour.

From what you did, i.e. that you moved the sendCmd to the beginning of
the "wait for next incoming request" loop, I can see that you should
urgently read, at the link I've already recommended, the explanation of
the role of call-id as an identifier of a thread (call) ;-)

The sendCmd in the main scenario delivers the call-id to the timer
scenario (sorry for my mistake, I didn't know that Call-ID cannot be
used with [last_*] which works for other headers, or maybe the colon was
an issue?).

The timer scenario is an "UAS" one, so it starts a new thread (call) if
the call-id value in an incoming (SIP) message or (3pcc) Cmd is yet
unknown to it, and from that thread, it sends its own Cmd with still the
same call-id back to the main scenario, so the main scenario knows which
thread should move forward to sending the BYE. But if the main scenario
sends another Cmd from the same thread, i. e. with a call-id which the
timer scenario already knows, the timer scenario doesn't expect such Cmd
to arrive, because a message or a command bearing a known call-id is
matched to the current stage of execution of the scenario in the thread
identified by that call-id. And during a <pause/>, any incoming message
or Cmd is an unexpected one. So instead of the intended restart of the
timer, you should have killed the thread in the timer scenario this way,
and I am quite surprised you haven't (as confirmed by the fact that the
main scenario has received the Cmd from the timer scenario after the
pause has elapsed).

So now as you've reverted the submission (you want a re-triggerable
timer), I'd say the best way is to find out what is wrong with the
(timeout, ontimeout) thing. Can you send your scenario to me so that I
would test it on my SIPp 3.3 on Cygwin where I know for sure that
(timeout, ontimeout) works? Sometimes features may stop working in newer
versions by mistake. I am unable to spend time learning how to compile
SIPp under Cygwin and I cannot bother the colleague who has compiled the
3.3 for me.

There could possibly be ways how to implement a similar behaviour using
other means but I'm afraid they would be much more complex. Plus the
fact that reception of an unexpected message by timer scenario did not
kill it has made me think of a possibility that timeout expiration in
timer scenario could be invisible for the main scenario, so a call which
has ended due to timeout expiration in the timer scenario could still be
counted as a successful one in the main scenario.

However, it only makes sense to continue digging in this direction if
you don't insist on the control of call duration by the -d parameter,
because it only affects the duration of the static pause, not of the
dynamic one defined using the timeout attribute.

P.
Post by Joel Serrano
Hi Pavel,
* Sorry for the off-topic questions, you are right and they don't
belong to this thread (won't happen again).
* I tried removing the "next" from the <recv> inside non-3pcc
scenario, but still the same issue, it would wait for ever, so I have
moved on going toward the 3pcc way.
* Now that I understand how the 3PCC works, I have a "working"
scenario. In order for it to work, I had to change in the
3pcc_timer.xml two things, you were right that it requires a fudge
INVITE for it to start, otherwise it complains with: "Unable to
determine send mode of the tool (server, client)". The other change
was is the sendCmd, although it was receiving correctly the msg, it
was answering without a caller-id and that was making the main die
because it wouldn't recognize the msg without a caller-id. I used
-trace_msg to see this.
<sendCmd>
<![CDATA[
[last_Call-ID:]
]]>
</sendCmd>
<sendCmd>
<![CDATA[
Call-ID: [call_id]
]]>
</sendCmd>
Solved that, the scenario works as described initially, but, I have
realized that what I wan't to achieve is not working 100%.
A-- main sends INVITE
B-- uas sends 100, 180, 183, OK
C-- main sends ACK
D-- main sendCmd to timer
E-- timer counts to X (defined in -d parameter). || main may receive a
MESSAGE or BYE during this timer and it will do what it has to do.
F-- timer reaches X, and sendCmd back to main
G-- main recvCmd and sends BYE to uas. (call ends).
If during the timer, main receives a (or multiple) MESSAGE(s) it will
responde OK, if it receives a BYE it will respond OK and end the call,
so we are good here.
My issue now, is that I need the timer to be reset on every MESSAGE
received.
# sipp -sf 3pcc_timer.xml -3pcc localhost:9001 -p 5061 -d 60000
-trace_err -trace_msg -trace_shortmsg
# sipp -s test X.X.X.X:6061 -r 1 -l 1 -m 1 -i X.X.X.X -sf main.xml
-inf fields.csv -3pcc localhost:9001 -trace_err -trace_msg -trace_shortmsg
(I'm using latest version to avoid known issues: SIPp
v3.4.1-SCTP-PCAP-RTPSTREAM)
Right now, after 1 minute, the call will end, doesn't matter if it has
processed 0 MESSAGES or 100 MESSAGES. It will only end before the
minute if it receives a BYE from the uas. This is correct and I what I
requested in the first email.
Can I add something so the timer resets if it receives a MESSAGE? So
the idea would be for the call to end 1 minute after the _last_
MESSAGE was received or directly after 1 minute if no MESSAGE is
received at all.
[...]
<sendCmd>
<![CDATA[
[last_Call-ID:]
]]>
</sendCmd>
<label id="wait_for_BYE_or_MESSAGE"/>
<recv request="MESSAGE" optional="true"
next="respond_received_MESSAGE"/>
<recv request="BYE" optional="true" next="respond_received_BYE"/>
<recvCmd next="send_my_own_BYE"/>
<label id="respond_received_BYE"/>
<send next="end_of_call">
<![CDATA[
...
SIP/2.0 200 OK
...
]]>
</send>
<label id="respond_received_MESSAGE"/>
<send next="wait_for_BYE_or_MESSAGE">
<![CDATA[
...
SIP/2.0 200 OK
...
]]>
</send>
<label id="send_my_own_BYE"/>
[...]
[...]
<label id="wait_for_BYE_or_MESSAGE"/>
<sendCmd>
<![CDATA[
[last_Call-ID:]
]]>
</sendCmd>
<recv request="MESSAGE" optional="true"
next="respond_received_MESSAGE"/>
<recv request="BYE" optional="true" next="respond_received_BYE"/>
<recvCmd next="send_my_own_BYE"/>
<label id="respond_received_BYE"/>
<send next="end_of_call">
<![CDATA[
...
SIP/2.0 200 OK
...
]]>
</send>
<label id="respond_received_MESSAGE"/>
<send next="wait_for_BYE_or_MESSAGE">
<![CDATA[
...
SIP/2.0 200 OK
...
]]>
</send>
<label id="send_my_own_BYE"/>
[...]
NOTE: I have moved the <label id="wait_for_BYE_or_MESSAGE"/>before the
sendCmd, and that works partially: on every MESSAGE received, a new
sendCmd is executed and received by the timer, but it doesn't reset,
so when the very first timer ends, it sends back the msg and the main
ends the call even though there maybe 1 o 2 (or whatever) commands
still pending to be processed.
I don't know if I am explaining myself correctly. I didn't note this
in my first email because I have realized this was necessary as a
result of testing with the working 3PCC scenario. My bad, sorry.
Again thank you very much for your help and time.
Best regards,
Joel.
Hi Joel,
I'll follow your idea of subthreads and hope that if someone else
needs to read that conversation, they won't get lost. So my
answers are inside your text.
P.
Post by Joel Serrano
Hi Pavel,
First of all, thank you very much for such a detailed explanation.
I'm separating my answer in blocks so we can keep the
multi-conversation in one thread :)
-----------
** I checked the sip capture, and yes, the messages belong to the
dialog, so they have the same Call-Id, etc. (this is good as it
makes things "easier").
-----------
Post by Joel Serrano
[...]
<recv request="MESSAGE" optional="true"
next="respond_received_MESSAGE"/>
<recv request="BYE" next="respond_received_BYE" timeout="5000"
ontimeout="send_my_own_BYE"/>
[...]
If I get a MESSAGE, it will respond with the OK, and go back to
waiting, so far ok, but after 5 seconds of waiting (the timeout)
the flow doesn't jump to "send_my_own_BYE" and the BYE is not
sent, it stays waiting for ever.
If I force the UAS to send a BYE, it will jump correctly to
"respond_received_BYE" and respond with an OK, so the call ends correctly.
So, as an initial approach, I would only need to figure out why
it waits for the BYE for ever instead of sending it after the
timeout value (in this case, 5 seconds).
When we get this sorted out, I might have to go with 3PCC to
avoid the "failed calls" if we hit the timeout (but that is
definitely secondary at the moment).
Do you know why it can be that it waits for the BYE for ever?
I've checked my older scenarios where I was using the "timeout"
and "ontimeout" attributes and they look the same as above with
one negligible exception: I didn't use the "next" attribute,
because it is not necessary if the "send 200(BYE)" immediately
follows the "recv BYE within a timeout". In the example I've
given, I've provided the "next" attribute only in order to make it
more illustrative through use of self-explaining label names for
both possible output branches of the command.
So as I can see no typo in your command, before digging any
deeper, the first question has to be "what version of SIPp do you
use"? The reason is that
- the timeout and ontimeout attributes have been introduced as
late as in SIPp 3.2 if I'm not mistaken, while label naming (in
addition to the original numbering-only) has been introduced a bit
earlier,
- SIPp silently ignores any unrecognized attributes of the commands.
So if you use 3.2 or newer SIPp, send me your complete scenario,
leaving the mailing list out, we'll eventually post the results of
the investigation to the mailing list.
I guess you've identified my copy-paste error and you send Cseq
with BYE in the 200 response to the received BYE (instead of my
Cseq with MESSAGE in the 200 to BYE).
Post by Joel Serrano
-----------
In your second version, the 3PCC, I don't understand quite well
how is the use of the sendCmd and recvCmd or the concept "twin
scenario". Can you please give me more details on how that works?
Do I need to run several instances of sipp with different XMLs to
achieve the "twin scenario" or can I do it with all in one XML?
Does the -3pcc parameter need to be specified in the command?
I've described that in detail in the thread for which I've
- yes, you need a separate scenario for the "twin" (timer)
instance, as each instance is a separate process bound to its own
socket etc., and you cannot ask the sipp binary to fork into two
processes, each running a different scenario. So your batch file
for routine operation would look like
Post by Joel Serrano
sipp -p 5062 -sf 3pcc_timer.xml -bg -...
sipp -p 5060 -sf main.xml -...
But while debugging, run the timer instance without the -bg in its
own window, and start it before the main instance as well
(because, quite logically, UAS scenarios should be started before
UAC scenarios if they are intended to cooperate).
- the 3pcc_timer scenario should look like
Post by Joel Serrano
<recvCmd/>
<pause/>
<sendCmd>
<![CDATA[
[last_Call-id:]
]]>
</sendCmd>
<pause milliseconds="32000"/>
Written this way, you would control the duration of the first
pause (and thus of those calls which the main scenario would
actively terminate) using the -d parameter of the sipp shell
command used to start the timer instance, while the second pause,
whose duration is explicitly stated in the scenario, is there to
let the main instance finish the activity it has to do after
receiving the 3pcc command from the timer instance. I had some
problems with the timer instance (or even a particular call in it,
I don't remember exactly) terminating the twin call of the main
instance if it had nothing more to do itself. But the overall case
may have been slightly different from the one we discuss here -
the timer instance was most likely an UAC one and the main one was
UAS, while in the current case the roles are swapped. So you can
try to remove the last pause from the timer scenario, but I
recommend you to do do so only after debugging the basic idea.
If eventually sipp would complain that it cannot determine whether
the 3pcc_timer is a UAC or a UAS scenario, put a fudge <recv
request="INVITE" optional="true"/> before the <recvCmd/>, that
should stop the complaints.
Post by Joel Serrano
-----------
Anyting offtopic is a bad idea on any "spread-the-wisdom" platform
like this mailing list, because no one else can find such
off-topic information they'd be possibly interested in because the
thread subject doesn't give a clue about its presence. We have no
"tags" or "keywords" here to assist in search. Nevertheless, find
my answers below the questions.
Post by Joel Serrano
<nop>
<action>
<exec play_pcap_audio="rec1.pcap"/>
<exec play_pcap_audio="rec2.pcap"/>
<exec play_pcap_audio="rec3.pcap"/>
</action>
</nop>
Or do they need to be each "exec" in a unique "action" ? Or maybe
even one "nop" + "action" per "exec"?
You can specify several actions within a single <action> tag, and
I'd say there may even safely be several <exec> actions. But
several <exec play_pcap_audio=.../> actions started in the same
<action> make no sense, so I have never tried it and so I don't
know the intensity of the resulting fireworks. A pcapplay starts
replaying an RTP stream from a single local socket to a single
remote socket (as indicated by the SDPs), so doing so several
times in parallel is to no good even if SIPp would somehow manage
to do that.
Post by Joel Serrano
2) If you play a pcap audio, does the execution stop until the
play is complete, or does it continue and therefor you have to
add a "pause" of the pcap length in order for the flow to not
continue until the play has finished? Example of a 10 second
<nop>
<action>
<exec play_pcap_audio="test.pcap"/>
</action>
</nop>
<pause milliseconds="10000"/>
As written in the documentation, <exec play_pcap_audio=.../>
starts a new internal thread and the scenario execution is not
paused until the replay action ends, so the timing must (and, more
important, may) be provided using additional means. So in your
case, you may start replaying a pcap simultaneously with sending
the ACK, and the handling of the received MESSAGEs will not
interrupt the replay. However, an end of the respective call does
stop the replay if I remember right. This is not the case if you
<exec> an external command, though. Once you start an external
command, it lives its own life regardless what happens to the call
which has triggered it.
So chaining several play_pcap_audios is a doggy business if you
also need to use external timing of the call (through received BYE
messages or 3pcc commands). So better merge them into one in
advance, which is a separate topic.
Post by Joel Serrano
3) In the non-3PCC I don't have the <pause/> parameter because
the duration is "hard-coded" to the timeout value when waiting
for the BYE, correct?
Exactly. The "timeout" attribute of <recv> is almost the same as
the "milliseconds" attribute of <pause>, except that the value of
the "timeout" attribute must (currently?) be a constant, so you
cannot calculate it dynamically during call run like you can with
"milliseconds". So if you ever need this, you have to use 3pcc and
deliver the required pause duration to the timer instance, using a
forged header (such as "P-my-pause-duration:") of the <sendCmd>
payload and regexp-based extraction of the value from that header
in the <recvCmd> in the timer scenario.
Post by Joel Serrano
4) In the 3PCC version (although I don't quite understand how
that works yet) where should the <pause/> go to be able to modify
the call duration with the "-d" parameter in the command?
As already detailed above. Any <pause/> without the "milliseconds"
attribute in a scenario has a duration specified by the -d command
line parameter.
Post by Joel Serrano
-----------
Thank you again for your help.
Best regards,
Joel.
Loading...