diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index b22e053aca8f0f0d1805a5d1883d56de13b7e6d0..a7058bbb7bed2735fae67677c1a973fa6ff74cc6 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -2404,7 +2404,10 @@ int SIPVoIPLink::createUdpTransport (AccountID id) } - + if(listeningAddress == "" || listeningPort == 0) { + _error("UserAgent: Error invalid address for new udp transport"); + return !PJ_SUCCESS; + } //strcpy (tmpIP, listeningAddress.data()); /* Init published name */ pj_bzero (&a_name, sizeof (pjsip_host_port)); diff --git a/sippxml/accountcalluac.xml b/sippxml/accountcalluac.xml new file mode 100644 index 0000000000000000000000000000000000000000..2d43c03840e0f721f8abda4f3d7df9217d5fe0e9 --- /dev/null +++ b/sippxml/accountcalluac.xml @@ -0,0 +1,161 @@ +<?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 --> + + +<scenario name="accountcall_client"> + + <send retrans="500"> + <![CDATA[ + + REGISTER sip:192.168.50.79 SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] + Max-Forward: 70 + From: <sip:27182@[local_ip]:[local_port]>;tag=[call_number] + To: <sip:27182@192.168.50.79:[local_port]> + Call-ID: [call_id] + CSeq: 1 REGISTER + Contact: <sip:27182@[local_ip]:[local_port]> + Content-Length: 0 + Expires: 300 + + ]]> + </send> + + <recv response="401" auth="true"> + </recv> + + <send retrans="500"> + <![CDATA[ + + REGISTER sip:192.168.50.79 SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] + Max-Forwards: 70 + From: <sip:27182@[local_ip]:[local_port]>;tag=[call_number] + To: <sip:27182@192.168.50.79:[local_port]> + Call-ID: [call_id] + CSeq: 1 REGISTER + Contact: <sip:27182@[local_ip]:[local_port]> + Content-Length: 0 + Expires: 300 + [authentication username=27182 password=1234] + + ]]> + </send> + + <recv response="200"> + </recv> + + + <send retrans="500"> + <![CDATA[ + + INVITE sip:31416@192.168.50.79 SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: <sip:27182@[local_ip]:[local_port]>;tag=[call_number] + To: <sip:31416@192.168.50.79:[remote_port]> + Call-ID: [call_id] + CSeq: 1 INVITE + Contact: sip:27182@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Functional Test + 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 0 + a=rtpmap:0 PCMU/8000 + + ]]> + </send> + + <recv response="100" optional="true"> + </recv> + + <recv response="180" optional="true"> + </recv> + + + <!-- Do something different on an optional receive --> + <recv response="403" optional="true" next="1"> + </recv> + + <recv response="200"> + <action> + <ereg regexp="ua25" + search_in="hdr" + header="From: " + assign_to="8"/> + </action> + </recv> + + <!-- set variable 8 above on 25th call, send the ACK but skip the pause for it --> + <send next="1" test="8"> + <![CDATA[ + + ACK sip:31416@192.168.50.79 SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: <sip:27182@[local_ip]:[local_port]>;tag=[call_number] + To: <sip:31416@192.168.50.79:[remote_port]> + Call-ID: [call_id] + CSeq: 1 ACK + Contact: sip:27182@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Functional Test + Content-Length: 0 + + ]]> + </send> + + <pause milliseconds="5000"/> + + <label id="1"/> + + <send retrans="500"> + <![CDATA[ + + BYE sip:31416@192.168.50.79 SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: <sip:27182@[local_ip]:[local_port]>;tag=[call_number] + To: <sip:31416@192.168.50.79:[remote_port]> + Call-ID: [call_id] + CSeq: 2 BYE + Contact: sip:27182@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Functional Test + Content-Length: 0 + + ]]> + </send> + + <recv response="200" crlf="true"> + </recv> + + <pause milliseconds="4000"/> + + + <!-- 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> diff --git a/sippxml/accountcalluas.xml b/sippxml/accountcalluas.xml new file mode 100644 index 0000000000000000000000000000000000000000..82158ef0a5c0fd85053aa9232d387d55e2ed219c --- /dev/null +++ b/sippxml/accountcalluas.xml @@ -0,0 +1,159 @@ +<?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 --> + + +<scenario name="branch_server"> + <recv request="REGISTER"> + </recv> + + <send> + <![CDATA[ + + SIP/2.0 200 OK + [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 + Expires: 300 + + ]]> + </send> + + <!-- Set variable 3 if the ua is of the form ua2... --> + <recv request="INVITE" crlf="true"> + <action> + <ereg regexp="ua2" + search_in="hdr" + header="From: " + assign_to="3"/> + </action> + </recv> + + <!-- send 180 then trying if variable 3 is set --> + <send next="1" test="3"> + <![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> + + <!-- if not, send a 403 error then skip to wait for a BYE --> + <send next="2"> + <![CDATA[ + + SIP/2.0 403 Error + [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> + + <label id="1"/> + + <send> + <![CDATA[ + + SIP/2.0 100 Trying + [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:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + Content-Type: application/sdp + Content-Length: 136 + + v=0 + o=user1 53655765 2353687637 IN IP4 127.0.0.1 + s=- + t=0 0 + c=IN IP4 [media_ip] + m=audio [media_port] RTP/AVP 0 + a=rtpmap:0 PCMU/8000 + + ]]> + </send> + + <recv request="ACK" + optional="true" + rtd="true" + crlf="true"> + </recv> + + <label id="2"/> + + <recv request="BYE"> + </recv> + + <send> + <![CDATA[ + + SIP/2.0 200 OK + [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> + + <!-- 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="4000"/> + + <!-- 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> diff --git a/sippxml/simpleuac.xml b/sippxml/ip2ipcalluac.xml similarity index 100% rename from sippxml/simpleuac.xml rename to sippxml/ip2ipcalluac.xml diff --git a/sippxml/simpleuas.xml b/sippxml/ip2ipcalluas.xml similarity index 100% rename from sippxml/simpleuas.xml rename to sippxml/ip2ipcalluas.xml diff --git a/sippxml/testsuiteuac.sh b/sippxml/testsuiteuac.sh index 9188b130ce8e2f86f45dddeba9f82ba6d7516384..9864f1303c107ba60cb723e4d4b4a1ff9f653baf 100644 --- a/sippxml/testsuiteuac.sh +++ b/sippxml/testsuiteuac.sh @@ -3,25 +3,39 @@ SERVERPORT=5062 -#start sipp server to receive calls from sflphone -sipp -sf simpleuas.xml -p ${SERVERPORT} & +function test_ip2ipcall { -#start sflphoned -/usr/lib/sflphone/sflphoned& + #start sipp server to receive calls from sflphone + sipp -sf ip2ipcalluas.xml -p ${SERVERPORT} & -#wait some time to make sure sflphone is started -sleep 2; + #start sflphoned + /usr/lib/sflphone/sflphoned& -#run python client and associated script -python ../tools/pysflphone/pysflphone_testdbus.py + #wait some time to make sure sflphone is started + sleep 2; -#kill every one -killall sipp -killall sflphoned + #run python client and associated script + python ../tools/pysflphone/pysflphone_testdbus.py + + #kill every one + killall sipp + killall sflphoned +} + +function test_accountcall { + + sipp -sf accountcalluac.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} + +} # function called if CTRL-C detected bashtrap() { killall sipp killall sflphoned -} \ No newline at end of file +} + + +# Here Start the Test suite + +test_ip2ipcall \ No newline at end of file diff --git a/tools/pysflphone/pysflphone_testdbus.py b/tools/pysflphone/pysflphone_testdbus.py index bf2598881455dbaf2e9cbda066374f31b5d40843..47183d6454dcc0221b3ae5a9eeaa27d1564d6214 100644 --- a/tools/pysflphone/pysflphone_testdbus.py +++ b/tools/pysflphone/pysflphone_testdbus.py @@ -9,6 +9,7 @@ from sflphonectrlsimple import SflPhoneCtrlSimple class SflPhoneTests(SflPhoneCtrlSimple): + def test_get_allaccounts_methods(self): for account in self.getAllAccounts(): @@ -55,7 +56,7 @@ class SflPhoneTests(SflPhoneCtrlSimple): def test_create_account(self): - """Create a new sip fake account and remove it""" + """Create a new sip account""" CONFIG_ACCOUNT_TYPE = "Account.type" CONFIG_ACCOUNT_ALIAS = "Account.alias" @@ -63,25 +64,34 @@ class SflPhoneTests(SflPhoneCtrlSimple): USERNAME = "username" PASSWORD = "password" - accDetails = {CONFIG_ACCOUNT_TYPE:"SIP", CONFIG_ACCOUNT_ALIAS:"myNewAccount", - HOSTNAME:"192.168.50.3", USERNAME:"431", - PASSWORD:"alexandre"} + accDetails = {CONFIG_ACCOUNT_TYPE:"SIP", CONFIG_ACCOUNT_ALIAS:"testsuiteaccount", + HOSTNAME:"192.168.50.79", USERNAME:"31416", + PASSWORD:"1234"} accountID = self.addAccount(accDetails) print "New Account ID " + accountID - time.sleep(3) + + return accountID + + + def test_remove_account(self, accountID): + """Remove test account""" self.removeAccount(accountID) print "Account with ID " + accountID + " removed" +# Open sflphone and connect to sflphoned through dbus sflphone = SflPhoneTests() -# sflphone.test_get_allaccounts_methods() +# Test 1: Makke approximately one IP2IP call per second +# to a sipp uas on local addrress +#sflphone.test_make_iptoip_call() -sflphone.test_make_iptoip_call() +# Test 2: +accountID = sflphone.test_create_account() # sflphone.test_make_account_call() - -# sflphone.test_create_account() +time.sleep(0.3) +# sflphone.test_remove_account(accountID)