[asterisk-dev] question about tests for capturing SIP messages

Joshua C. Colp jcolp at sangoma.com
Thu Sep 29 07:25:09 CDT 2022


On Thu, Sep 29, 2022 at 9:15 AM Henning Westerholt <hw at gilawa.com> wrote:

> Hello,
>
>
>
> as part of working on [1] a test was requested to cover the new
> functionality.
>
>
>
> After figuring out how the basic test suite works (previous e-mail, thanks
> for the fast reply), I have some questions about the best approach going
> forward.
>
>
>
> The basic scenario is this:
>
>
>
>    1. Start Asterisk with pjsip stack
>    2. Start Sipp with a re-INVITE scenario
>    3. Capturing the SIP message flow
>    4. Checking number of returned codecs in 200 OK reply on re-INVITE
>    from Asterisk
>    5. Tear down, Result etc..
>
>
>
> For 1-2 I’ve took some existing test and adapted it, was straightforward.
>
>
>
> For task 3 I’ve found some existing template:
> tests/channels/SIP/pcap_demo, together with lib/python/sip_message.py and
> lib/python/pcap_listener.py.
>
>
>
> Unfortunately, this test seems to be skipped right now due some old issues
> with CentOS 6. So as expected, it’s not working anymore.
>
> I have tried to do some adaptions for python3 in the libraries, but it’s
> still fails. I started to work on this stuff yesterday and therefore I am
> not the best person to fix these dependencies.
>
>
>
> Is this library planned to be updated as well?
>
>
>
> If not, are there other suggestions how to address this PCAP based
> test/check?
>

You don't need to capture the SIP message flow using pcap or anything like
that. There are existing PJSIP tests which cover SDP handling and use SIPp
to do so:

https://github.com/asterisk/testsuite/tree/master/tests/channels/pjsip/sdp_offer_answer

For example this one sets up a call, and also checks the 200 OK from
Asterisk:

https://github.com/asterisk/testsuite/tree/master/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/basic

With the SIPp scenario being this:

https://github.com/asterisk/testsuite/blob/master/tests/channels/pjsip/sdp_offer_answer/incoming/nominal/single-media-stream/audio/basic/sipp/uac-all-codecs.xml

You'd need to add a re-INVITE in but there are also examples of that:

https://github.com/asterisk/testsuite/blob/master/tests/channels/pjsip/connected_line/connected_line_allow/sipp/alice.xml#L67

General flow for such a test I'd expect to be:

1. SIPp scenario sends INVITE to Asterisk
2. Asterisk calls Answer()
3. Asterisk calls Wait(36)
4. SIPp scenario sends re-INVITE to Asterisk
5. Asterisk responds to re-INVITE
6. SIPp scenario checks 200 OK
7. SIPp sends BYE to Asterisk
8. Test automatically ends

Asterisk would also have to have a configured endpoint with your new option.

Cheers,

-- 
Joshua C. Colp
Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20220929/7d073010/attachment-0001.html>


More information about the asterisk-dev mailing list