Commit 440694ba authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Merge branch 'master' of...

Merge branch 'master' of git+ssh://repos-sflphone-git@git.sflphone.org/var/repos/sflphone/git/sflphone
parents 31ccaded 5fd75db9
......@@ -357,7 +357,7 @@ AC_DEFINE([HAVE_SPEEX], test "x$with_speex" = "xyes", [Define if you have libspe
AM_CONDITIONAL(ENABLE_SPEEXDSP, test $HAVE_SPEEXDSP = yes)
dnl Check for celt. Compile it only if a recent enough version is found
LIBCELT_MIN_VERSION=0.5.1
LIBCELT_MIN_VERSION=0.7.1
PKG_CHECK_MODULES(CELT, celt >= ${LIBCELT_MIN_VERSION}, AM_CONDITIONAL(BUILD_CELT, test 1 = 1 ), AM_CONDITIONAL(BUILD_CELT, test 0 = 1 ))
dnl Check for IAX
......
......@@ -94,8 +94,11 @@ class Celt : public AudioCodec
_dec = celt_decoder_create (_mode, _channel, &error);
celt_encoder_ctl (_enc, CELT_SET_COMPLEXITY (10));
celt_decoder_ctl(_dec, CELT_SET_COMPLEXITY (10));
celt_encoder_ctl (_enc, CELT_SET_COMPLEXITY (2));
celt_decoder_ctl(_dec, CELT_SET_COMPLEXITY (2));
celt_encoder_ctl (_enc, CELT_SET_PREDICTION(2));
celt_decoder_ctl(_dec, CELT_SET_PREDICTION(2));
}
......@@ -119,7 +122,7 @@ class Celt : public AudioCodec
virtual int codecEncode (unsigned char *dst, short *src, unsigned int size) {
int len = 0;
len = celt_encode (_enc, (celt_int16*) src, (celt_int16 *) src, dst, 512);
len = celt_encode (_enc, (celt_int16*) src, (celt_int16 *) src, dst, 40);
// returns the number of bytes writen
return len;
}
......
......@@ -1430,19 +1430,18 @@ bool ManagerImpl::saveConfig (void) {
//THREAD=Main
bool ManagerImpl::sendDtmf (const CallID& id, char code) {
AccountID accountid = getAccountFromCall(id);
if (accountid == AccountNULL) {
playDtmf(code);
return false;
}
int sendType = getConfigInt(SIGNALISATION, SEND_DTMF_AS);
AccountID accountid = getAccountFromCall(id);
bool returnValue = false;
playDtmf(code);
returnValue = getAccountLink(accountid)->carryingDTMFdigits(id, code);
CallAccountMap::iterator iter = _callAccountMap.find(id);
// Make sure the call exist before sending DTMF, ths could be simply call dialing
if(iter != _callAccountMap.end())
returnValue = getAccountLink(accountid)->carryingDTMFdigits(id, code);
return returnValue;
}
......
......@@ -97,9 +97,16 @@ void Sdp::set_media_descriptor_line (sdpMedia *media, pjmedia_sdp_media** p_med)
// connection, the rtpmap attribute will be useful to specify for which codec it is applicable
rtpmap.pt = med->desc.fmt[i];
rtpmap.enc_name = pj_str ( (char*) codec->getCodecName().c_str());
rtpmap.clock_rate = codec->getClockRate();
// Add the channel number only if different from 1
// G722 require G722/8000 media description even if it is 16000 codec
if(codec->getPayload () == 9) {
rtpmap.clock_rate = 8000;
}
else {
rtpmap.clock_rate = codec->getClockRate();
}
// Add the channel number only if different from 1
if (codec->getChannel() > 1)
rtpmap.param = pj_str ( (char*) codec->getChannel());
else
......@@ -204,6 +211,10 @@ int Sdp::receiving_initial_offer (pjmedia_sdp_session* remote, CodecOrder select
pj_status_t status;
if (!remote) {
return !PJ_SUCCESS;
}
// Create the SDP negociator instance by calling
// pjmedia_sdp_neg_create_w_remote_offer with the remote offer, and by providing the local offer ( optional )
......@@ -524,6 +535,19 @@ AudioCodec* Sdp::get_session_media (void)
}
pj_status_t Sdp::start_negociation()
{
pj_status_t status;
if (_negociator) {
status = pjmedia_sdp_neg_negotiate(_pool, _negociator, 0);
}
else {
status = !PJ_SUCCESS;
}
return status;
}
void Sdp::toString (void)
{
......@@ -641,6 +665,9 @@ void Sdp::set_media_transport_info_from_remote_sdp (const pjmedia_sdp_session *r
_info ("SDP: Fetching media from sdp");
if(!remote_sdp)
return;
pjmedia_sdp_media *r_media;
this->get_remote_sdp_media_from_offer (remote_sdp, &r_media);
......@@ -660,6 +687,9 @@ void Sdp::get_remote_sdp_media_from_offer (const pjmedia_sdp_session* remote_sdp
{
int count, i;
if(!remote_sdp)
return;
count = remote_sdp->media_count;
*r_media = NULL;
......
......@@ -166,10 +166,7 @@ class Sdp {
* @return pj_status_t 0 on success
* 1 otherwise
*/
pj_status_t start_negociation( void ){
return pjmedia_sdp_neg_negotiate(
_pool, _negociator, 0);
}
pj_status_t start_negociation( void );
/*
* Retrieve the negociated sdp offer from the sip payload.
......@@ -221,7 +218,7 @@ class Sdp {
std::vector<sdpMedia*> get_session_media_list (void) { return _session_media; }
void get_remote_sdp_crypto_from_offer (const pjmedia_sdp_session* remote_sdp, CryptoOffer& crypto_offer);
void get_remote_sdp_crypto_from_offer (const pjmedia_sdp_session* remote_sdp, CryptoOffer& crypto_offer);
private:
/** Codec Map */
......@@ -253,13 +250,13 @@ class Sdp {
/** Local audio port */
int _local_extern_audio_port;
/** Remote's audio port */
/** Remote audio port */
unsigned int _remote_audio_port;
std::string _zrtp_hello_hash;
/** "a=crypto" sdes local attributes obtained from AudioSrtpSession */
std::vector<std::string> _srtp_crypto;
/** "a=crypto" sdes local attributes obtained from AudioSrtpSession */
std::vector<std::string> _srtp_crypto;
Sdp(const Sdp&); //No Copy Constructor
Sdp& operator=(const Sdp&); //No Assignment Operator
......@@ -350,12 +347,12 @@ class Sdp {
void get_remote_sdp_media_from_offer (const pjmedia_sdp_session* r_sdp, pjmedia_sdp_media** r_media);
/*
/*
* Adds a sdes attribute to the given media section.
*
* @param media The media to add the srtp attribute to
*/
void sdp_add_sdes_attribute(std::vector<std::string>& crypto);
*/
void sdp_add_sdes_attribute(std::vector<std::string>& crypto);
/*
* Adds a zrtp-hash attribute to
......
This diff is collapsed.
......@@ -422,7 +422,7 @@ class SIPVoIPLink : public VoIPLink
* General Sip transport creation method according to the
* transport type specified in account settings
* @param id The account id for which a transport must
* be created.
* be created.
*/
bool createSipTransport(AccountID id);
......@@ -436,48 +436,49 @@ class SIPVoIPLink : public VoIPLink
*/
bool addTransportToMap(std::string key, pjsip_transport* transport);
/**
/**
* Create SIP UDP transport from account's setting
* @param id The account id for which a transport must
* be created.
* be created.
* @return pj_status_t PJ_SUCCESS on success
*/
int createUdpTransport (AccountID = "");
/**
* Create a TLS transport from the default TLS listener from
* @param id The account id for which a transport must
* be created.
* @return pj_status_t PJ_SUCCESS on success
*/
pj_status_t createTlsTransport(const AccountID& id, std::string remoteAddr);
/**
* Create a TLS transport from the default TLS listener from
* @param id The account id for which a transport must
* be created.
* @return pj_status_t PJ_SUCCESS on success
*/
pj_status_t createTlsTransport(const AccountID& id, std::string remoteAddr);
/**
* Create a UDP transport using stun server to resove public address
* @param id The account id for which a transport must
* be created.
* @return pj_status_t PJ_SUCCESS on success
*/
* Create a UDP transport using stun server to resove public address
* @param id The account id for which a transport must
* be created.
* @return pj_status_t PJ_SUCCESS on success
*/
pj_status_t createAlternateUdpTransport (AccountID id);
/**
* UDP Transports are stored in this map in order to retreive them in case
* several accounts would share the same port number.
*/
SipTransportMap _transportMap;
/** For registration use only */
int _regPort;
/** For registration use only */
int _regPort;
/** Threading object */
EventThread* _evThread;
ost::Mutex _mutexSIP;
/** Threading object */
EventThread* _evThread;
ost::Mutex _mutexSIP;
/* Number of SIP accounts connected to the link */
int _clients;
/* Number of SIP accounts connected to the link */
int _clients;
/*
* Get the correct address to use (ie advertised) from
/*
* Get the correct address to use (ie advertised) from
* a uri. The corresponding transport that should be used
* with that uri will be discovered.
*
......
......@@ -78,7 +78,7 @@
<send retrans="500">
<![CDATA[
BYE sip:192.168.50.79 SIP/2.0
BYE 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:[remote_ip]:[remote_port]>;tag=[$1]
......
......@@ -62,12 +62,35 @@ function test_ip2ip_recv_hangup {
# sleep 1;
# start sipp client and send calls
sipp -sf ip2ip_uac_send_peer_hungup.xmlip2ip_uac_send_hangup.xml ${REMOTEADDR_lo} -i ${LOCALIP_lo} -p ${LOCALPORT} -l 1 -m 10
sipp -sf ip2ip_uac_send_peer_hungup.xml ${REMOTEADDR_lo} -i ${LOCALIP_lo} -p ${LOCALPORT} -l 1 -m 10
# kill every one
# bashtrap
}
# SCENARIO 1 Test 4
function test_ip2ip_recv_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;
# start sipp client and send calls
sipp -sf ip2ip_uac_send_hangup.xml ${REMOTEADDR_lo} -i ${LOCALIP_lo} -p ${LOCALPORT} -l 1 -m 10
# kill every one
# bashtrap
}
# SCENARIO 2 Test 1
function test_account_send_hangup {
......@@ -276,7 +299,7 @@ bashtrap()
# Test 4: - Receive an ACCOUNT call
# - Peer Hangup
# test_account_recv_peer_hungup
test_account_recv_peer_hungup
......@@ -302,4 +325,4 @@ bashtrap()
# Test 1: - Receive a call
# - Refuse (hangup without answer)
test_ip2ip_send_refused
\ No newline at end of file
# test_ip2ip_send_refused
\ No newline at end of file
......@@ -300,7 +300,7 @@ sflphone.setFirstRegisteredAccount();
# Test 4: - Receive an ACCOUNT call
# - Peer Hangup
# testsuite.test_account_recv_peer_hungup()
testsuite.test_account_recv_peer_hungup()
......@@ -327,4 +327,4 @@ sflphone.setFirstRegisteredAccount();
# Test 1: - Receive an incoming call
# - Hangup without answer
testsuite.test_ip2ip_recv_refuse()
# testsuite.test_ip2ip_recv_refuse()
Supports Markdown
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