diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp index 7a1664ec90a38cb9d78c41d2e96ee9a22a2ef787..3f754c8df169c1bbb9fe49e3b79bab666e71c4fc 100644 --- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp +++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp @@ -357,12 +357,17 @@ PulseLayer::stopStream (void) { _info("Audio: Stop audio stream"); + + pa_threaded_mainloop_lock (m); + if(playback) pa_stream_flush (playback->pulseStream(), NULL, NULL); if(record) pa_stream_flush (record->pulseStream(), NULL, NULL); + pa_threaded_mainloop_unlock (m); + disconnectAudioStream(); } diff --git a/sflphone-common/src/audio/sound/Makefile.am b/sflphone-common/src/audio/sound/Makefile.am index 37d7ddc61eb82225f25c86da9c270da8da0dc208..10e9960b7a14c29d2c66d7fb1447f2e18e2bdc1f 100644 --- a/sflphone-common/src/audio/sound/Makefile.am +++ b/sflphone-common/src/audio/sound/Makefile.am @@ -5,14 +5,12 @@ noinst_LTLIBRARIES = libsound.la libsound_la_SOURCES = \ audiofile.cpp \ tone.cpp \ - tonegenerator.cpp \ tonelist.cpp \ dtmf.cpp \ dtmfgenerator.cpp noinst_HEADERS = \ audiofile.h \ - tonegenerator.h \ tone.h \ tonelist.h \ dtmfgenerator.h \ diff --git a/sflphone-common/src/audio/sound/tone.cpp b/sflphone-common/src/audio/sound/tone.cpp index d8849cbf3235ffe1db8b1c0b9daa64f41238b55e..7f60f1ecca749103c8e42fe94f92231f9675677d 100644 --- a/sflphone-common/src/audio/sound/tone.cpp +++ b/sflphone-common/src/audio/sound/tone.cpp @@ -28,8 +28,12 @@ #include <cstdlib> #include <strings.h> -Tone::Tone (const std::string& definition, unsigned int sampleRate) : AudioLoop(), _sampleRate (sampleRate) +#define TABLE_LENGTH 4096 +double TWOPI = 2 * M_PI; + +Tone::Tone (const std::string& definition, unsigned int sampleRate) : AudioLoop(), _sampleRate (sampleRate), _xhigher(0.0), _xlower(0.0) { + fillWavetable(); genBuffer (definition); // allocate memory with definition parameter } @@ -101,6 +105,7 @@ Tone::genBuffer (const std::string& definition) } // Generate SAMPLING_RATE samples of sinus, buffer is the result + _debug("genSin(%d, %d)", freq1, freq2); genSin (bufferPos, freq1, freq2, count); // To concatenate the different buffers for each section. @@ -124,20 +129,70 @@ Tone::genBuffer (const std::string& definition) bufferPos=0; } +void +Tone::fillWavetable() +{ + double tableSize = (double)TABLE_LENGTH; + + for(int i = 0; i < TABLE_LENGTH; i++) { + _wavetable[i] = sin( ((double)i / (tableSize - 1.0)) * TWOPI ); + } +} + +double +Tone::interpolate(double x) +{ + int xi_0, xi_1; + double yi_0, yi_1, A, B; + + xi_0 = (int)x; + xi_1 = xi_0+1; + + yi_0 =_wavetable[xi_0]; + yi_1 = _wavetable[xi_1]; + + A = (x - xi_0); + B = 1.0 - A; + + return A*yi_0 + B*yi_1; +} + void Tone::genSin (SFLDataFormat* buffer, int frequency1, int frequency2, int nb) { + _xhigher = 0.0; + _xlower = 0.0; - double pi2 = 6.28318520; - double var1 = pi2 * (double) frequency1 / (double) _sampleRate; - double var2 = pi2 * (double) frequency2 / (double) _sampleRate; + double sr = (double)_sampleRate; + double tableSize = (double)TABLE_LENGTH; - // softer - double amp = (double) SFLDataAmplitude; + double N_h = sr / (double) (frequency1); + double N_l = sr / (double) (frequency2); - for (int t = 0; t < nb; t++) { - buffer[t] = (SFLDataFormat) (amp * ( (sin (var1 * t) + sin (var2 * t)))); - } + double dx_h = tableSize / N_h; + double dx_l = tableSize / N_l; + + double x_h = _xhigher; + double x_l = _xlower; + + double amp = (double)SFLDataAmplitude; + + for (int t = 0; t < nb; t ++) { + buffer[t] = (int16)(amp*(interpolate(x_h) + interpolate(x_l))); + x_h += dx_h; + x_l += dx_l; + + if(x_h > tableSize) { + x_h -= tableSize; + } + + if(x_l > tableSize) { + x_l -= tableSize; + } + } + + _xhigher = x_h; + _xlower = x_l; } diff --git a/sflphone-common/src/audio/sound/tone.h b/sflphone-common/src/audio/sound/tone.h index a725059dcf20a6d5ca509ffa8d0bc07c4187de28..94be60a0b8ecbe4a9b23465dfeec310231d2eedc 100644 --- a/sflphone-common/src/audio/sound/tone.h +++ b/sflphone-common/src/audio/sound/tone.h @@ -28,6 +28,8 @@ #define TONE_NBTONE 4 #define TONE_NBCOUNTRY 7 +#define TABLE_LENGTH 4096 + /** * @file tone.h * @brief Tone sample (dial, busy, ring, congestion) @@ -65,6 +67,17 @@ public: */ void genSin(SFLDataFormat* buffer, int frequency1, int frequency2, int nb); + /** + * + */ + void fillWavetable(void); + + /** + * + */ + double interpolate(double x); + + private: /** @@ -75,6 +88,11 @@ private: /** Sample rate */ unsigned int _sampleRate; + + double _wavetable[TABLE_LENGTH]; + + double _xhigher; + double _xlower; }; #endif // __TONE_H__ diff --git a/sflphone-common/src/audio/sound/tonegenerator.cpp b/sflphone-common/src/audio/sound/tonegenerator.cpp deleted file mode 100644 index dcdbb6be078724e8792321fb8cebfb829476c016..0000000000000000000000000000000000000000 --- a/sflphone-common/src/audio/sound/tonegenerator.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * 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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <fstream> -#include <math.h> -#include <stdlib.h> - -#include "tonegenerator.h" -#include "global.h" - -int AMPLITUDE = 32767; - -/////////////////////////////////////////////////////////////////////////////// -// ToneGenerator implementation -/////////////////////////////////////////////////////////////////////////////// - -ToneGenerator::ToneGenerator (unsigned int sampleRate) : sample (NULL), freq1(), freq2(), time(), totalbytes(), _sampleRate (sampleRate) -{ -} - -ToneGenerator::~ToneGenerator (void) -{ -} - -/** - * Calculate superposition of 2 sinus - * - */ -void -ToneGenerator::generateSin (int lowerfreq, int higherfreq, int16* ptr, int len) const -{ - double var1, var2; - - var1 = (double) 2 * (double) M_PI * (double) higherfreq / (double) _sampleRate; - var2 = (double) 2 * (double) M_PI * (double) lowerfreq / (double) _sampleRate; - - double amp = (double) (AMPLITUDE >> 2); - - for (int t = 0; t < len; t++) { - ptr[t] = (int16) (amp * ( (sin (var1 * t) + sin (var2 * t)))); - } -} - diff --git a/sflphone-common/src/audio/sound/tonegenerator.h b/sflphone-common/src/audio/sound/tonegenerator.h deleted file mode 100644 index ce1ad56e618ebce339448607027f7b694e686ba1..0000000000000000000000000000000000000000 --- a/sflphone-common/src/audio/sound/tonegenerator.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2004-2006 Savoir-Faire Linux inc. - * Author: Yan Morin <yan.morin@savoirfairelinux.com> - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * 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 3 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __TONE_GENERATOR_H__ -#define __TONE_GENERATOR_H__ - -#include <string> -#include <cc++/thread.h> - -#include "global.h" - -/** - * @file tonegenerator.h - * @brief Sine generator to create tone with string definition - */ - -class ToneGenerator { - public: - /** - * Constructor - * @param sampleRate The sample rate of the generated samples - */ - ToneGenerator (unsigned int sampleRate); - - /** - * Destructor - */ - ~ToneGenerator (void); - - /** - * Calculate sinus with superposition of 2 frequencies - * @param lowerfreq Lower frequency - * @param higherfreq Higher frequency - * @param ptr For result buffer - * @param len The length of the data to be generated - */ - void generateSin (int, int, int16 *, int len) const; - - - /////////////////////////// - // Public members variable - ////////////////////////// - int16 *sample; - int freq1, freq2; - int time; - int totalbytes; - - private: - // Copy Constructor - ToneGenerator(const ToneGenerator& rh); - - // Assignment Operator - ToneGenerator& operator=( const ToneGenerator& rh); - - /* - * Initialisation of the supported tones according to the countries. - */ - void initTone (void); - - int16 _buf[SIZEBUF]; - int _sampleRate; -}; - -#endif // __TONE_GENRATOR_H__ diff --git a/sflphone-common/src/sip/sipvoiplink.cpp b/sflphone-common/src/sip/sipvoiplink.cpp index a7058bbb7bed2735fae67677c1a973fa6ff74cc6..022cdcbe0c2dd16cc5b97e6115570756b9cb7bd6 100644 --- a/sflphone-common/src/sip/sipvoiplink.cpp +++ b/sflphone-common/src/sip/sipvoiplink.cpp @@ -921,6 +921,8 @@ SIPVoIPLink::peerHungup (const CallID& id) pjsip_tx_data *tdata = NULL; SIPCall* call; + _info("SIP: Peer hungup"); + call = getSIPCall (id); if (call==0) { @@ -3476,7 +3478,7 @@ mod_on_rx_request (pjsip_rx_data *rdata) // No need to go any further on incoming ACK if (rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD) { _info("UserAgent: received an ACK"); - return true; + return true; } // Handle the incoming call invite in this function diff --git a/sippxml/account_uac_send_hangup.xml b/sippxml/account_uac_send_hangup.xml index b07251cb2193abf14a4d70dd5351b790976c5dbf..8971769c591c52bbfd1c89cc1e96e46c71fe3860 100644 --- a/sippxml/account_uac_send_hangup.xml +++ b/sippxml/account_uac_send_hangup.xml @@ -19,47 +19,6 @@ <scenario name="accountcall_client"> - <send retrans="500"> - <![CDATA[ - - REGISTER sip:[remote_ip] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] - Max-Forward: 70 - From: <sip:27182@[remote_ip]:[remote_port]>;tag=[call_number] - To: <sip:27182@[remote_ip]:[remote_port]> - Call-ID: REG///[call_id] - CSeq: 1 REGISTER - Contact: <sip:27182@[remote_ip]:[remote_port]> - Content-Length: 0 - Expires: 300 - - ]]> - </send> - - <recv response="401" auth="true"> - </recv> - - <send retrans="500"> - <![CDATA[ - - REGISTER sip:[remote_ip] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] - Max-Forwards: 70 - From: <sip:27182@[remote_ip]:[remote_port]>;tag=[call_number] - To: <sip:27182@[remote_ip]:[remote_port]> - Call-ID: REG///[call_id] - CSeq: 2 REGISTER - Contact: <sip:27182@[remote_ip]:[remote_port]> - Content-Length: 0 - Expires: 300 - [authentication username=27182 password=1234] - - ]]> - </send> - - <recv response="200"> - </recv> - <pause milliseconds="200"/> <send retrans="500"> diff --git a/sippxml/account_uac_send_peer_hungup.xml b/sippxml/account_uac_send_peer_hungup.xml new file mode 100644 index 0000000000000000000000000000000000000000..716da9dd6de55534e79d29e2efa54ad6248ccc5c --- /dev/null +++ b/sippxml/account_uac_send_peer_hungup.xml @@ -0,0 +1,155 @@ +<?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"> + + <pause milliseconds="200"/> + + <send retrans="500"> + <![CDATA[ + + INVITE sip:2000@[remote_ip] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] + From: <sip:27182@[remote_ip]>;tag=[call_number] + To: <sip:2000@[remote_ip]> + Call-ID: [call_id] + CSeq: 3 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="401" auth="true"> + </recv> + + <pause milliseconds="200"/> + + <send> + <![CDATA[ + + ACK sip:27182@[remote_ip] SIP/2.0 + Max-Forwards: 70 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: <sip:27182@[remote_ip]>;tag=[call_number] + To: <sip:2000@[remote_ip]> + Call-ID: [call_id] + CSeq: 4 ACK + Subject: Functional Test + Content-Length: 0 + + ]]> + </send> + + <send retrans="500"> + <![CDATA[ + + INVITE sip:2000@[remote_ip] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] + From: <sip:27182@:[remote_ip]>;tag=[call_number] + To: <sip:2000@[remote_ip]> + Call-ID: [call_id] + CSeq: 5 INVITE + Contact: sip:27182@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Functional Test + Content-Type: application/sdp + Content-Length: [len] + [authentication username=27182 password=1234] + + 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"> + </recv> + + <recv response="180"> + </recv> + + + <recv response="200"> + </recv> + + <send> + <![CDATA[ + + ACK sip:2000@192.168.50.79 SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] + From: <sip:27182@[remote_ip]>;tag=[call_number] + To: <sip:2000@[remote_ip]> + Call-ID: [call_id] + CSeq: 5 ACK + Contact: sip:27182@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Functional Test + Content-Length: 0 + + ]]> + </send> + + <recv request="BYE"> + </recv> + + + <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: [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> + + <pause milliseconds="1000"/> + +</scenario> diff --git a/sippxml/account_uas_receive_transfer.xml b/sippxml/account_uas_receive_transfer.xml new file mode 100644 index 0000000000000000000000000000000000000000..80a875fbf707be6c6f3c03c2484be68c7c255ce4 --- /dev/null +++ b/sippxml/account_uas_receive_transfer.xml @@ -0,0 +1,101 @@ +<?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"> + + <recv request="INVITE"> + </recv> + + <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:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + 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 request="ACK"> + </recv> + + <recv request="INVITE"> + </recv> + + <pause milliseconds="200"> + </recv> + + <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: [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 request="ACK"> + </recv> + + +</scenario> diff --git a/sippxml/account_uas_recv_hangup.xml b/sippxml/account_uas_recv_hangup.xml new file mode 100644 index 0000000000000000000000000000000000000000..101e6f4c97442b091dc86fedc913078353126c63 --- /dev/null +++ b/sippxml/account_uas_recv_hangup.xml @@ -0,0 +1,121 @@ +<?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"> + + <recv request="INVITE"> + </recv> + + <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> + + <pause milliseconds="200"/> + + <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: [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 request="ACK"> + </recv> + + <recv request="INVITE"> + </recv> + + <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: [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 request="ACK"> + </recv> + + <pause milliseconds="500"/> + + <send retrans="500"> + <![CDATA[ + + BYE sip:2000@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:2000@192.168.50.79:[remote_port]> + Call-ID: [call_id] + CSeq: 6 BYE + Contact: sip:27182@[local_ip]:[local_port] + Max-Forwards: 70 + Subject: Functional Test + Content-Length: 0 + + ]]> + </send> + + <recv response="200"> + </recv> + +</scenario> diff --git a/sippxml/account_uas_recv_peer_hungup.xml b/sippxml/account_uas_recv_peer_hungup.xml index cfa9acb151e23f8234f3daf4a35ae21eca05c8dd..c91230c7fc32e2c853d934ec5dbc3f499060d958 100644 --- a/sippxml/account_uas_recv_peer_hungup.xml +++ b/sippxml/account_uas_recv_peer_hungup.xml @@ -19,54 +19,9 @@ <scenario name="accountcall_client"> - <send retrans="500"> - <![CDATA[ - - REGISTER sip:[remote_ip] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] - Max-Forward: 70 - From: <sip:27182@[remote_ip]:[remote_port]>;tag=[call_number] - To: <sip:27182@[remote_ip]:[remote_port]> - Call-ID: REG///[call_id] - CSeq: 1 REGISTER - Contact: <sip:27182@[remote_ip]:[remote_port]> - Content-Length: 0 - Expires: 300 - - ]]> - </send> - - <recv response="401" auth="true"> - </recv> - - <send retrans="500"> - <![CDATA[ - - REGISTER sip:[remote_ip] SIP/2.0 - Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] - Max-Forwards: 70 - From: <sip:27182@[remote_ip]:[remote_port]>;tag=[call_number] - To: <sip:27182@[remote_ip]:[remote_port]> - Call-ID: REG///[call_id] - CSeq: 2 REGISTER - Contact: <sip:27182@[remote_ip]:[remote_port]> - Content-Length: 0 - Expires: 300 - [authentication username=27182 password=1234] - - ]]> - </send> - - <recv response="200"> - </recv> - - <recv request="INVITE"> </recv> - <recv response="401" auth="true"> - </recv> - <send> <![CDATA[ @@ -82,7 +37,38 @@ ]]> </send> - <pause milliseconds="200"/> + <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: [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 request="ACK"> + </recv> + + <recv request="INVITE"> + </recv> + + <pause milliseconds="200"> + </recv> <send retrans="500"> <![CDATA[ diff --git a/sippxml/account_uas_recv_transfered.xml b/sippxml/account_uas_recv_transfered.xml new file mode 100644 index 0000000000000000000000000000000000000000..210f5621b4b5a002adcbbd0a1880756c49b33088 --- /dev/null +++ b/sippxml/account_uas_recv_transfered.xml @@ -0,0 +1,132 @@ +<?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"> + + <recv request="INVITE"> + </recv> + + <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:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + 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 request="ACK"> + </recv> + + <recv request="INVITE"> + </recv> + + <pause milliseconds="200"> + </recv> + + <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: [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 request="ACK"> + </recv> + + + <!-- + + <recv request="BYE"> + </recv> + + <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: [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> + + --> + +</scenario> diff --git a/sippxml/account_uas_register.xml b/sippxml/account_uas_register.xml new file mode 100644 index 0000000000000000000000000000000000000000..e4ebb812276270bd5a3334ecd61a4b4c2825900c --- /dev/null +++ b/sippxml/account_uas_register.xml @@ -0,0 +1,63 @@ +<?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:[remote_ip] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] + Max-Forwards: 70 + From: <sip:27182@[remote_ip]>;tag=[call_number] + To: <sip:27182@[remote_ip]> + Call-ID: REG///[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:[remote_ip] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] + Max-Forwards: 70 + From: <sip:27182@[remote_ip]>;tag=[call_number] + To: <sip:27182@[remote_ip]> + Call-ID: REG///[call_id] + CSeq: 2 REGISTER + Contact: <sip:27182@[local_ip]:[local_port]> + Content-Length: 0 + Expires: 300 + [authentication username=27182 password=1234] + + ]]> + </send> + + <recv response="200"> + </recv> + +</scenario> diff --git a/sippxml/ip2ip_uac_send_hangup.xml b/sippxml/ip2ip_uac_send_hangup.xml index b38cf17361a568261f5441bd8b651639e759c4e2..49cc63fca06e2cd1f2a40f1f65929de436da7d6b 100644 --- a/sippxml/ip2ip_uac_send_hangup.xml +++ b/sippxml/ip2ip_uac_send_hangup.xml @@ -53,15 +53,18 @@ <recv response="200"> + <action> + <ereg regexp="tag=.*" search_in="hdr" header="To:" check_it="true" assign_to="1" /> + </action> </recv> <send> <![CDATA[ - ACK sip:192.168.50.79 SIP/2.0 + ACK sip:[remote_ip] SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[local_ip]:[local_port]>;tag=[call_number] - To: <sip:192.168.50.79:[remote_port]> + To: <sip:[remote_ip]:[remote_port]>;tag=[$1] Call-ID: [call_id] CSeq: 2 ACK Contact: sip:[local_ip]:[local_port] @@ -78,7 +81,7 @@ BYE sip:192.168.50.79 SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[local_ip]:[local_port]>;tag=[call_number] - To: <sip:192.168.50.79:[remote_port]> + To: <sip:[remote_ip]:[remote_port]>;tag=[$1] Call-ID: [call_id] CSeq: 3 BYE Contact: sip:[local_ip]:[local_port] diff --git a/sippxml/ip2ip_uac_send_peer_hungup.xml b/sippxml/ip2ip_uac_send_peer_hungup.xml index 3ffd02a3723285a72ce25cd4b026585b96e4dcef..4e811e38262f10680417f9415e960e33585b26ee 100644 --- a/sippxml/ip2ip_uac_send_peer_hungup.xml +++ b/sippxml/ip2ip_uac_send_peer_hungup.xml @@ -60,7 +60,7 @@ ACK sip:192.168.50.79 SIP/2.0 Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch] From: <sip:[local_ip]:[local_port]>;tag=[call_number] - To: <sip:192.168.50.79:[remote_port]> + To: <sip:[remote_ip]:[remote_port]> Call-ID: [call_id] CSeq: 2 ACK Contact: sip:[local_ip]:[local_port] diff --git a/sippxml/ip2ip_uas_recv_hangup.xml b/sippxml/ip2ip_uas_recv_hangup.xml index 571dda97ccc73d9200591f795d2c3ed08458c91e..4e86b47480bd761e3d4ccdf071dcbe5738f5c5f9 100644 --- a/sippxml/ip2ip_uas_recv_hangup.xml +++ b/sippxml/ip2ip_uas_recv_hangup.xml @@ -16,7 +16,7 @@ [last_To:];tag=[call_number] [last_Call-ID:] [last_CSeq:] - Contact: <sip:127.0.1.1:5062;transport=[transport]> + Contact: <sip:[local_ip]:[local_port];transport=[transport]> Content-Length: 0 ]]> @@ -46,22 +46,27 @@ ]]> </send> + <!-- tag from From: header is required to build the To: header in + -- Bye request. --> - <recv request="ACK"> + <recv request="ACK"> + <action> + <ereg regexp="tag=.*" search_in="hdr" header="From:" check_it="true" assign_to="1" /> + </action> </recv> <pause milliseconds="500"/> - + <send retrans="500"> <![CDATA[ - BYE sip:127.0.0.1:5060;transport=[transport] SIP/2.0 - [last_Via:] - [last_From:] - [last_To:] + BYE sip:[service] SIP/2.0 + Via: SIP/2.0/[transport] [local_ip]:[local_port];rport;branch=[branch] + From: <sip:[local_ip]:[local_port]>;tag=[call_number] + To: <sip:[remote_ip]:[remote_port]>;[$1] [last_Call-ID:] CSeq: [cseq] BYE - Contact: <sip:[local_ip]:[local_port];transport=[transport]> + Contact: <sip:test@[local_ip]:[local_port]> Max-Forwards: 70 Subject: Functional Test Content-Length: 0 diff --git a/sippxml/ip2ip_uas_recv_hold_offhold.xml b/sippxml/ip2ip_uas_recv_hold_offhold.xml new file mode 100644 index 0000000000000000000000000000000000000000..568a97a9e62ddf5bd4a323b920f425f300104273 --- /dev/null +++ b/sippxml/ip2ip_uas_recv_hold_offhold.xml @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE scenario SYSTEM "sipp.dtd"> + + +<scenario name="UAS HOLD/OFFHOLD"> + + <!-- Receive a new call --> + + <recv request="INVITE" crlf="true"> + <action> + <ereg regexp="sendrecv" search_in="body" check_it="true" assign_to="1"/> + <log message="Media is [$1]"/> + </action> + </recv> + + <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:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + 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 request="ACK" optional="true" rtd="true" crlf="true"> + </recv> + + <!-- This call is now on HOLD: sendonly tell to PBX to send music on hold--> + + <recv request="INVITE" crlf="true"> + <action> + <ereg regexp="sendonly" search_in="body" check_it="true" assign_to="2"/> + <log message="Media is [$2]"/> + </action> + </recv> + + <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:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + 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 request="ACK" optional="true" rtd="true" crlf="true"> + </recv> + + <!-- OFFHOLD this call --> + + <recv request="INVITE" crlf="true"> + <action> + <ereg regexp="sendrecv" search_in="body" check_it="true" assign_to="3"/> + <log message="Media is [$3]"/> + </action> + </recv> + + + <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:] + Contact: <sip:[local_ip]:[local_port];transport=[transport]> + 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 request="ACK" optional="true" rtd="true" crlf="true"> + </recv> + + <!-- Hangup this call --> + + <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> + + <pause milliseconds="4000"/> + + + <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/> + + <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/> + +</scenario> diff --git a/sippxml/ip2ip_uas_recv_peer_hungup.xml b/sippxml/ip2ip_uas_recv_peer_hungup.xml index 4b615f216cf96daf1ecfb35cfcf78f2d2f1daade..9f2721f5dc71742819d4d39003fc1279b0cd18db 100644 --- a/sippxml/ip2ip_uas_recv_peer_hungup.xml +++ b/sippxml/ip2ip_uas_recv_peer_hungup.xml @@ -46,10 +46,7 @@ ]]> </send> - <recv request="ACK" - optional="true" - rtd="true" - crlf="true"> + <recv request="ACK" optional="true" rtd="true" crlf="true"> </recv> <recv request="BYE"> diff --git a/sippxml/tempscript.sh b/sippxml/tempscript.sh new file mode 100644 index 0000000000000000000000000000000000000000..090a058ed8491511f8ef33551e260d56237be826 --- /dev/null +++ b/sippxml/tempscript.sh @@ -0,0 +1,5 @@ +SERVERPORT=5064 + +sipp -sf account_uas_register_bis.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1 + +sipp -sf account_uas_receive_transfer.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 \ No newline at end of file diff --git a/sippxml/testsuiteuac.sh b/sippxml/testsuiteuac.sh index c63983c1e0319464254c924542d06b7472860126..be9455244341e1074b25b4fbee1f8cbbf9c28391 100644 --- a/sippxml/testsuiteuac.sh +++ b/sippxml/testsuiteuac.sh @@ -3,10 +3,11 @@ SERVERPORT=5062 +# SCENARIO 1 Test 1 function test_ip2ip_send_hangup { # start sipp server to receive calls from sflphone - sipp -sf ip2ip_uas_recv_peer_hungup.xml -p ${SERVERPORT} + sipp -sf ip2ip_uas_recv_peer_hungup.xml 127.0.0.1:5060 -i 127.0.0.1 -p ${SERVERPORT} # start sflphoned # /usr/lib/sflphone/sflphoned& @@ -21,10 +22,11 @@ function test_ip2ip_send_hangup { # bashtrap } +# SCENARIO 1 Test 2 function test_ip2ip_send_peer_hungup { # start sipp server to receive calls from sflphone and then hangup - sipp -sf ip2ip_uas_recv_hangup.xml -p ${SERVERPORT} + sipp -sf ip2ip_uas_recv_hangup.xml 127.0.0.1:5060 -s 127.0.0.1:5060 -i 127.0.0.1 -p ${SERVERPORT} # start sflphoned # /usr/lib/sflphone/sflphoned& @@ -40,6 +42,7 @@ function test_ip2ip_send_peer_hungup { } +# SCENARIO 1 Test 3 function test_ip2ip_recv_hangup { # start sflphoned @@ -60,6 +63,8 @@ function test_ip2ip_recv_hangup { # bashtrap } + +# SCENARIO 1 Test 4 function test_ip2ip_recv_peer_hungup { # start sflphoned @@ -80,6 +85,7 @@ function test_ip2ip_recv_peer_hungup { # bashtrap } +# SCENARIO 2 Test 1 function test_account_send_hangup { # start sflphoned @@ -93,6 +99,9 @@ function test_account_send_hangup { # wait some time to make sure client is bound # sleep 1; + # process only one registration + sipp -sf account_uas_register.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1 + # start sipp client and send calls sipp -sf account_uas_recv_peer_hungup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 @@ -100,6 +109,55 @@ function test_account_send_hangup { # bashtrap } +# SCENARIO 2 Test 2 +function test_account_send_peer_hungup { + + # start sflphoned + # /usr/lib/sflphone/sflphoned& + + # wait some time to make sure sflphoned is started + # sleep 1; + + # python ../tools/pysflphone/pysflphone_testdbus.py & + + # wait some time to make sure client is bound + # sleep 1; + + # process only one registration + sipp -sf account_uas_register.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1 + + # start sipp client and send calls + sipp -sf account_uas_recv_hangup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 + + # kill every one + # bashtrap +} + +# SCENARIO 2 Test 3 +function test_account_recv_hangup { + + # start sflphoned + # /usr/lib/sflphone/sflphoned& + + # wait some time to make sure sflphoned is started + # sleep 1; + + # python ../tools/pysflphone/pysflphone_testdbus.py & + + # wait some time to make sure client is bound + # sleep 1; + + # process only one registration + sipp -sf account_uas_register.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1 + + # start sipp client and send calls + sipp -sf account_uac_send_peer_hungup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 + + # kill every one + # bashtrap +} + +# SCENARIO 2 Test 4 function test_account_recv_peer_hungup { # start sflphoned @@ -113,6 +171,9 @@ function test_account_recv_peer_hungup { # wait some time to make sure client is bound # sleep 1; + # process only one registration + sipp -sf account_uas_register.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1 + # start sipp client and send calls sipp -sf account_uac_send_hangup.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 @@ -120,6 +181,51 @@ function test_account_recv_peer_hungup { # bashtrap } +# SCENARIO 3 Test 1 +function test_ip2ip_send_hold_offhold { + + # start sflphoned + # /usr/lib/sflphone/sflphoned& + + # wait some time to make sure sflphoned is started + # sleep 1; + + # python ../tools/pysflphone/pysflphone_testdbus.py & + + # wait some time to make sure client is bound + # sleep 1; + + # start sipp client and send calls + sipp -sf ip2ip_uas_recv_hold_offhold.xml 127.0.0.1:5060 -i 127.0.0.1 -p ${SERVERPORT} + # kill every one + # bashtrap +} + +# SCENARIO 4 Test 1 +function test_account_send_transfer { + + # start sflphoned + # /usr/lib/sflphone/sflphoned& + + # wait some time to make sure sflphoned is started + # sleep 1; + + # python ../tools/pysflphone/pysflphone_testdbus.py & + + # wait some time to make sure client is bound + # sleep 1; + + # process only one registration + sipp -sf account_uas_register.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 -m 1 + + # start sipp client and send calls + sipp -sf account_uas_recv_transfered.xml 192.168.50.79 -i 192.168.50.182 -p ${SERVERPORT} -l 1 + + # kill every one + # bashtrap +} + + # function called if CTRL-C detected bashtrap() { @@ -136,6 +242,14 @@ bashtrap() # test_ip2ip_recv_hangup # test_ip2ip_recv_peer_hungup -# SCENARIO X: Normal flow calls (Account) -test_account_send_hangup -# test_account_recv_peer_hungup \ No newline at end of file +# SCENARIO 2: Normal flow calls (Account) +# test_account_send_hangup +# test_account_send_peer_hungup +# test_account_recv_hangup +# test_account_recv_peer_hungup + +# SCENARIO 3: Hold/offHold calls (Account) +# test_ip2ip_send_hold_offhold + +# SCENARIO 4: Transfer calls (Account) +test_account_send_transfer \ No newline at end of file diff --git a/tools/pysflphone/pysflphone_testdbus.py b/tools/pysflphone/pysflphone_testdbus.py index 563b683456ec16685896a661109eba094da578ca..3e7c97f0b03dc2df97dc4f643275e11224d75ce2 100644 --- a/tools/pysflphone/pysflphone_testdbus.py +++ b/tools/pysflphone/pysflphone_testdbus.py @@ -113,6 +113,7 @@ class SflPhoneTests(): # Start Glib mainloop self.sflphone.start() + def test_ip2ip_recv_peer_hungup(self): """Wait for calls, answer, peer hangup""" # Add callback for this test @@ -121,24 +122,49 @@ class SflPhoneTests(): # Start Glib mainloop self.sflphone.start() + def test_account_send_hangup(self): """Send new account call, hangup once peer answered""" - print "test account send hangup" + i = 0 - while(i < 10): + while(i < 1): callid = self.sflphone.Call("27182") - time.sleep(0.5) + time.sleep(1.0) self.sflphone.HangUp(callid) - time.sleep(0.5) + time.sleep(1.0) + + i = i+1 + + # del self.sflphone + + + def test_account_send_peer_hungup(self): + """Send new account call, hangup once peer answered""" + + i = 0 + while(i < 10): + + callid = self.sflphone.Call("27182") + time.sleep(1.0) i = i+1 - print "account hangup done" del self.sflphone - def test_account_recv_call_peer_hungup(self): + + def test_account_recv_hangup(self): + """Register an account and wait for incoming calls""" + + # Add callback for this test + self.sflphone.onIncomingCall_cb = acceptOnIncomingCallHangup + + # Start Glib mainloop + self.sflphone.start() + + + def test_account_recv_peer_hungup(self): """Register an account and wait for incoming calls""" # Add callback for this test @@ -147,24 +173,43 @@ class SflPhoneTests(): # Start Glib mainloop self.sflphone.start() - -# def test_account_send_call_peer_hungup(self): -# """Register an account on a remote server and make several calls""" -# -# self.setAccount("Account:1258495784"); -# time.sleep(3) -# -# i = 0 -# while(i < 50): -# -# callid = self.Call("5000") -# time.sleep(0.4) -# -# self.HangUp(callid) -# time.sleep(0.4) -# -# i = i+1 + def test_ip2ip_send_hold_offhold(self): + """Send new call, hold this call, offhold, hangup""" + i = 0 + while(i < 10): + + callid = self.sflphone.Call("sip:test@127.0.0.1:5062") + time.sleep(0.5) + + self.sflphone.Hold(callid) + time.sleep(0.5) + + self.sflphone.UnHold(callid) + time.sleep(0.5) + + self.sflphone.HangUp(callid) + time.sleep(0.5) + + i = i+1 + + del self.sflphone + + + def test_account_send_transfer(self): + """Send new calls, transfer it to a new instance""" + + i = 0 + while(i < 1): + + callid = self.sflphone.Call("27182") + time.sleep(1.0) + + self.sflphone.Transfer(callid,"14142") + # self.sflphone.HangUp(callid) + # time.sleep(1.0) + + i = i+1 @@ -183,18 +228,52 @@ sflphone.setFirstRegisteredAccount(); # Test 1: - Send an IP2IP call # - Hangup # testsuite.test_ip2ip_send_hangup() + +# Test 2: - Send an IP2IP call +# - Peer Hangup # testsuite.test_ip2ip_send_peer_hungup() + +# Test 3: - Receive an IP2IP call +# - Hangup # testsuite.test_ip2ip_recv_hangup() + +# Test 4: - Receive an IP2IP call +# - Peer Hangup # testsuite.test_ip2ip_recv_peer_hungup() -# SCENARIO 2: IP2IP Normal flow calls +# SCENARIO 2: ACCOUNT Normal flow calls + +# Test 1: - Send an ACCOUNT call +# - Hangup +# testsuite.test_account_send_hangup() + +# Test 2: - Send an ACCOUNT call +# - Peer Hangup +# testsuite.test_account_send_peer_hungup() + +# Test 3: - Receive an ACCOUNT call +# - Hangup +# testsuite.test_account_recv_hangup() -# Test 1: - Create an account on Asterisk -# - Wait for incoming calls -# - Answer -# - Call is hanged up by calle -testsuite.test_account_send_hangup() -# testsuite.test_account_recv_call_peer_hungup() +# Test 4: - Receive an ACCOUNT call +# - Peer Hangup +# testsuite.test_account_recv_peer_hungup() + +# SCENARIO 3: IP2IP Call, HOLD/OFFHOLD + +# Test 1: - Send an IP2IP call +# - Put this call on HOLD +# - Off HOLD this call +# - Hangup +# testsuite.test_ip2ip_send_hold_offhold() + + +# SCENARIO 4: IP2IP Call, HOLD/OFFHOLD + +# Test 1: - Send an IP2IP call +# - Transfer this call to another sipp instance +# - Hangup +testsuite.test_account_send_transfer() diff --git a/tools/pysflphone/sflphonectrlsimple.py b/tools/pysflphone/sflphonectrlsimple.py index a073e6ca04372fe09f1b74203a2ce1251ddb5624..a19d4ab0901f4b28fb2081d3f68fc58a5419b2e1 100755 --- a/tools/pysflphone/sflphonectrlsimple.py +++ b/tools/pysflphone/sflphonectrlsimple.py @@ -518,13 +518,13 @@ class SflPhoneCtrlSimple(Thread): self.callmanager.hangUp(callid) - def Transfert(self, callid, to): + def Transfer(self, callid, to): """Transfert a call identified by a CallID""" - if not self.account: - self.setFirstRegisteredAccount() + # if not self.account: + # self.setFirstRegisteredAccount() - if not self.isAccountRegistered(): - raise SflPhoneError("Can't transfert a call without a registered account") + # if not self.isAccountRegistered(): + # raise SflPhoneError("Can't transfert a call without a registered account") if callid is None or callid == "": raise SflPhoneError("Invalid callID") @@ -562,11 +562,11 @@ class SflPhoneCtrlSimple(Thread): def Hold(self, callid): """Hold a call identified by a CallID""" - if not self.account: - self.setFirstRegisteredAccount() + # if not self.account: + # self.setFirstRegisteredAccount() - if not self.isAccountRegistered(): - raise SflPhoneError("Can't hold a call without a registered account") + # if not self.isAccountRegistered(): + # raise SflPhoneError("Can't hold a call without a registered account") if callid is None or callid == "": raise SflPhoneError("Invalid callID") @@ -576,11 +576,11 @@ class SflPhoneCtrlSimple(Thread): def UnHold(self, callid): """Unhold an incoming call identified by a CallID""" - if not self.account: - self.setFirstRegisteredAccount() + # if not self.account: + # self.setFirstRegisteredAccount() - if not self.isAccountRegistered(): - raise SflPhoneError("Can't unhold a call without a registered account") + # if not self.isAccountRegistered(): + # raise SflPhoneError("Can't unhold a call without a registered account") if callid is None or callid == "": raise SflPhoneError("Invalid callID")