Commit 5339fed4 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added test with 200OK without contact header

parent df0e8ea5
......@@ -70,6 +70,24 @@ static FILE *sip_start(const char *senario, const char* dest_username, LinphoneA
return NULL;
#endif
}
static FILE *sip_start_recv(const char *senario) {
#if HAVE_SIPP
char *command;
FILE *file;
//until errors logs are handled correctly and stop breaks output, they will be DISABLED
command = ms_strdup_printf(SIPP_COMMAND" -sf %s -trace_err -trace_msg -rtp_echo -m 1 -d 1000",senario);
ms_message("Starting sipp commad [%s]",command);
file = popen(command, "r");
ms_free(command);
return file;
#else
return NULL;
#endif
}
/*static void dest_server_server_resolved(void *data, const char *name, struct addrinfo *ai_list) {
*(struct addrinfo **)data =ai_list;
}*/
......@@ -286,12 +304,49 @@ static void call_with_multiple_video_mline_in_sdp() {
linphone_core_manager_destroy(mgr);
}
static void call_invite_200ok_without_contact_header() {
LinphoneCoreManager *mgr;
char *identity_char;
char *scen;
FILE * sipp_out;
LinphoneCall *call = NULL;
/*currently we use direct connection because sipp do not properly set ACK request uri*/
mgr= linphone_core_manager_new2("empty_rc", FALSE);
mgr->identity = linphone_core_get_primary_contact_parsed(mgr->lc);
linphone_address_set_username(mgr->identity,"marie");
identity_char = linphone_address_as_string(mgr->identity);
linphone_core_set_primary_contact(mgr->lc,identity_char);
linphone_core_iterate(mgr->lc);
scen = bc_tester_res("sipp/call_invite_200ok_without_contact_header.xml");
sipp_out = sip_start_recv(scen);
if (sipp_out) {
call = linphone_core_invite(mgr->lc, "sipp@127.0.0.1");
BC_ASSERT_PTR_NOT_NULL(call);
BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallOutgoingInit, 1));
BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallOutgoingProgress, 1));
BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallOutgoingRinging, 1));
if (call) {
BC_ASSERT_TRUE(wait_for(mgr->lc, mgr->lc, &mgr->stat.number_of_LinphoneCallStreamsRunning, 1));
check_rtcp(call);
linphone_core_terminate_call(mgr->lc, call);
}
pclose(sipp_out);
}
linphone_core_manager_destroy(mgr);
}
static test_t tests[] = {
{ "SIP UPDATE within incoming reinvite without sdp", sip_update_within_icoming_reinvite_with_no_sdp },
{ "Call with audio mline before video in sdp", call_with_audio_mline_before_video_in_sdp },
{ "Call with video mline before audio in sdp", call_with_video_mline_before_audio_in_sdp },
{ "Call with multiple audio mline in sdp", call_with_multiple_audio_mline_in_sdp },
{ "Call with multiple video mline in sdp", call_with_multiple_video_mline_in_sdp },
{ "Call invite 200ok without contact header", call_invite_200ok_without_contact_header },
};
test_suite_t complex_sip_call_test_suite = {
......
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">
<!-- This program is free software; you can redistribute it and/or -->
<!-- modify it under the terms of the GNU General Public License as -->
<!-- published by the Free Software Foundation; either version 2 of the -->
<!-- License, or (at your option) any later version. -->
<!-- -->
<!-- This program is distributed in the hope that it will be useful, -->
<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
<!-- GNU General Public License for more details. -->
<!-- -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with this program; if not, write to the -->
<!-- Free Software Foundation, Inc., -->
<!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
<!-- -->
<!-- Sipp default 'uas' scenario. -->
<!-- -->
<scenario name="Basic UAS responder">
<!-- By adding rrs="true" (Record Route Sets), the route sets -->
<!-- are saved and used for following messages sent. Useful to test -->
<!-- against stateful SIP proxies/B2BUAs. -->
<recv request="INVITE" crlf="true">
</recv>
<!-- The '[last_*]' keyword is replaced automatically by the -->
<!-- specified header if it was present in the last message received -->
<!-- (except if it was a retransmission). If the header was not -->
<!-- present or if no message has been received, the '[last_*]' -->
<!-- keyword is discarded, and all bytes until the end of the line -->
<!-- are also discarded. -->
<!-- -->
<!-- If the specified header was present several times in the -->
<!-- message, all occurences are concatenated (CRLF seperated) -->
<!-- to be used in place of the '[last_*]' keyword. -->
<send>
<![CDATA[
SIP/2.0 180 Ringing
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>
<send retrans="500">
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:];tag=[call_number]
[last_Call-ID:]
[last_CSeq:]
Content-Type: application/sdp
Content-Length: [len]
v=0
o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
s=-
c=IN IP[media_ip_type] [media_ip]
t=0 0
m=audio [media_port] RTP/AVP 96 97 0 8 101 98
a=rtpmap:96 speex/16000
a=fmtp:96 vbr=on
a=rtpmap:97 speex/8000
a=fmtp:97 vbr=on
a=rtpmap:101 telephone-event/16000
a=rtpmap:98 telephone-event/8000
]]>
</send>
<recv request="ACK"
optional="true"
rtd="true"
crlf="true">
</recv>
<recv request="BYE">
</recv>
<send>
<![CDATA[
SIP/2.0 200 OK
[last_Via:]
[last_From:]
[last_To:]
[last_Call-ID:]
[last_CSeq:]
Contact: <sip:[local_ip]:[local_port];transport=[transport]>
Content-Length: 0
]]>
</send>
<!-- Keep the call open for a while in case the 200 is lost to be -->
<!-- able to retransmit it if we receive the BYE again. -->
<pause milliseconds="1000"/>
<!-- definition of the response time repartition table (unit is ms) -->
<ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
<!-- definition of the call length repartition table (unit is ms) -->
<CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
</scenario>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment