Commit 0ea08973 authored by jehan's avatar jehan

add more test for presence

parent c0a2eaad
......@@ -48,7 +48,7 @@ void check_rtcp(LinphoneCall *call) {
linphone_call_unref(call);
}
static FILE *sip_start(const char *senario, const char* dest_username, LinphoneAddress* dest_addres) {
FILE *sip_start(const char *senario, const char* dest_username, LinphoneAddress* dest_addres) {
#if HAVE_SIPP
char *dest;
char *command;
......
......@@ -884,6 +884,81 @@ static void dos_module_trigger(void) {
linphone_core_manager_destroy(pauline);
}
#define USE_PRESENCE_SERVER 1
#if USE_PRESENCE_SERVER
static void test_subscribe_notify_with_sipp_publisher(void) {
char *scen;
FILE * sipp_out;
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
/*just to get an identity*/
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LpConfig *pauline_lp = linphone_core_get_config(pauline->lc);
char* lf_identity=linphone_address_as_string_uri_only(marie->identity);
LinphoneFriend *lf = linphone_core_create_friend_with_address(pauline->lc,lf_identity);
ms_free(lf_identity);
lp_config_set_int(pauline_lp,"sip","subscribe_expires",5);
linphone_core_add_friend(pauline->lc,lf);
/*wait for subscribe acknowledgment*/
wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,1,2000);
BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d");
scen = bc_tester_res("sipp/simple_publish.xml");
sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), marie->identity);
if (TRUE/*sipp_out*/) {
/*wait for marie status*/
wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,2,3000);
BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d");
pclose(sipp_out);
}
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void test_subscribe_notify_with_sipp_publisher_double_publish(void) {
char *scen;
FILE * sipp_out;
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
/*just to get an identity*/
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LpConfig *pauline_lp = linphone_core_get_config(pauline->lc);
char* lf_identity=linphone_address_as_string_uri_only(marie->identity);
LinphoneFriend *lf = linphone_core_create_friend_with_address(pauline->lc,lf_identity);
ms_free(lf_identity);
lp_config_set_int(pauline_lp,"sip","subscribe_expires",5);
linphone_core_add_friend(pauline->lc,lf);
/*wait for subscribe acknowledgment*/
wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,1,2000);
BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d");
scen = bc_tester_res("sipp/double_publish_with_error.xml");
sipp_out = sip_start(scen, linphone_address_get_username(marie->identity), marie->identity);
if (TRUE/*sipp_out*/) {
/*wait for marie status*/
wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyReceived,2,3000);
BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d");
pclose(sipp_out);
BC_ASSERT_EQUAL(pauline->stat.number_of_NotifyReceived,2,int, "%d");
}
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
#endif
test_t flexisip_tests[] = {
{ "Subscribe forking", subscribe_forking },
{ "Message forking", message_forking },
......@@ -901,6 +976,10 @@ test_t flexisip_tests[] = {
{ "Call with sips", call_with_sips },
{ "Call with sips not achievable", call_with_sips_not_achievable },
{ "Call with ipv6", call_with_ipv6 },
#if USE_PRESENCE_SERVER
{ "Subscribe Notify with sipp publisher", test_subscribe_notify_with_sipp_publisher },
{ "Subscribe Notify with sipp double publish", test_subscribe_notify_with_sipp_publisher_double_publish },
#endif
{ "File transfer message rcs to external body client", file_transfer_message_rcs_to_external_body_client },
{ "File transfer message external body to rcs client", file_transfer_message_external_body_to_rcs_client },
{ "File transfer message external body to external body client", file_transfer_message_external_body_to_external_body_client },
......
......@@ -352,6 +352,10 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph
extern const char *liblinphone_tester_mire_id;
FILE *sip_start(const char *senario, const char* dest_username, LinphoneAddress* dest_addres);
#ifdef __cplusplus
};
......
......@@ -429,7 +429,7 @@ static void subscribe_presence_expired(void){
}
#define USE_PRESENCE_SERVER 0
#define USE_PRESENCE_SERVER 1
#if USE_PRESENCE_SERVER
static void test_subscribe_notify_publish(void) {
......
<?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 'uac' scenario. -->
<!-- -->
<scenario name="Basic Sipstone publish">
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
<!-- generated by sipp. To do so, use [call_id] keyword. -->
<send retrans="500">
<![CDATA[
PUBLISH sip:[service]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[service]@sip.example.org>;tag=[pid]SIPpTag00[call_number]
To: sipp <sip:[service]@sip.example.org>
Call-ID: [call_id]
CSeq: 1 PUBLISH
Max-Forwards: 70
Expire: 60
Event: presence
Content-Type: application/pidf+xml
Content-Length: [len]
<?xml version="1.0" encoding="UTF-8"?>
<presence xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" entity="sip:[service]@sip.example.org" xmlns="urn:ietf:params:xml:ns:pidf">
<tuple id="jjlson">
<status>
<basic>open</basic>
</status>
<contact priority="0.8">sip:[service]@[local_ip]:[local_port]</contact>
<timestamp>2015-09-28T15:49:00Z</timestamp>
</tuple>
</presence>
]]>
</send>
<recv response="100"
optional="true">
</recv>
<!-- 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 response="200" rrs="true">
</recv>
<send retrans="500">
<![CDATA[
PUBLISH sip:[service]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[service]@sip.example.org>;tag=[pid]SIPpTag00[call_number]
To: sipp <sip:[service]-2@sip.example.org>
Call-ID: [call_id]-2
CSeq: 1 PUBLISH
Max-Forwards: 70
Expire: 60
Event: presence
Content-Type: application/pidf+xml
Content-Length: [len]
<?xml version="1.0" encoding="UTF-8"?>
<presence xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" entity="sip:[service]@sip.example.org" xmlns="urn:ietf:params:xml:ns:pidf">
<tuple id="jjlson">
<status>
<basic>open</basic>
</status>
<contact priority="0.8">sip:[service]@[local_ip]:[local_port]</contact>
<timestamp>2015-09-28T15:49:00Z</timestamp>
</tuple>
</presence>
]]>
</send>
<recv response="100"
optional="true">
</recv>
<!-- 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 response="200" rrs="true">
</recv>
<!-- definition of the response time repartition table (unit is ms) -->
<!-- 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>
<?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 'uac' scenario. -->
<!-- -->
<scenario name="Basic Sipstone publish">
<!-- In client mode (sipp placing calls), the Call-ID MUST be -->
<!-- generated by sipp. To do so, use [call_id] keyword. -->
<send retrans="500">
<![CDATA[
PUBLISH sip:[service]@[remote_ip]:[remote_port] SIP/2.0
Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
From: sipp <sip:[service]@sip.example.org>;tag=[pid]SIPpTag00[call_number]
To: sipp <sip:[service]@sip.example.org>
Call-ID: [call_id]
CSeq: 1 PUBLISH
Max-Forwards: 70
Expire: 60
Event: presence
Content-Type: application/pidf+xml
Content-Length: [len]
<?xml version="1.0" encoding="UTF-8"?>
<presence xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" entity="sip:[service]@sip.example.org" xmlns="urn:ietf:params:xml:ns:pidf">
<tuple id="jjlson">
<status>
<basic>open</basic>
</status>
<contact priority="0.8">sip:[service]@[local_ip]:[local_port]</contact>
<timestamp>2015-09-28T15:49:00Z</timestamp>
</tuple>
</presence>
]]>
</send>
<recv response="100"
optional="true">
</recv>
<!-- 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 response="200" rrs="true">
</recv>
<!-- 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>
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