Commit aae10542 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Implement SIP Re-Invite

parent 15c3df51
......@@ -187,7 +187,7 @@ AudioRtpRTX::initAudioRtpSession (void)
{
try {
if (_ca == 0) { return; }
_audiocodec = Manager::instance().getCodecDescriptorMap().getCodec( _ca->getAudioCodec() );
_audiocodec = Manager::instance().getCodecDescriptorMap().getCodec( _ca->getLocalSDP()->getAudioCodec() );
_codecSampleRate = _audiocodec->getClockRate();
_debug("Init audio RTP session\n");
......
......@@ -22,8 +22,6 @@
Call::Call(const CallID& id, Call::CallType type)
: _callMutex()
, _codecMap()
, _audioCodec()
, _audioStarted(false)
, _localIPAddress("")
, _localAudioPort(0)
......@@ -85,12 +83,6 @@ Call::getState()
return _callState;
}
CodecDescriptor&
Call::getCodecMap()
{
return _codecMap;
}
const std::string&
Call::getLocalIp()
{
......@@ -119,12 +111,6 @@ Call::getRemoteIp()
return _remoteIPAddress;
}
AudioCodecType
Call::getAudioCodec()
{
return _audioCodec;
}
void
Call::setAudioStart(bool start)
{
......
......@@ -23,7 +23,6 @@
#include <cc++/thread.h> // for mutex
#include <sstream>
#include "audio/codecDescriptor.h"
#include "plug-in/audiorecorder/audiorecord.h"
/*
......@@ -145,20 +144,7 @@ class Call{
*/
bool isAudioStarted();
// AUDIO
/**
* Set internal codec Map: initialization only, not protected
* @param map The codec map
*/
void setCodecMap(const CodecDescriptor& map) { _codecMap = map; }
/**
* Get internal codec Map: initialization only, not protected
* @return CodecDescriptor The codec map
*/
CodecDescriptor& getCodecMap();
/**
/**
* Set my IP [not protected]
* @param ip The local IP address
*/
......@@ -206,12 +192,6 @@ class Call{
*/
const std::string& getRemoteIp();
/**
* Return audio codec [mutex protected]
* @return AudioCodecType The payload of the codec
*/
AudioCodecType getAudioCodec();
/**
* @return Return the file name for this call
*/
......@@ -258,18 +238,6 @@ class Call{
*/
void setRemoteAudioPort(unsigned int port) { _remoteAudioPort = port; }
/**
* Set the audio codec used. [not protected]
* @param audioCodec The payload of the codec
*/
void setAudioCodec(AudioCodecType audioCodec) { _audioCodec = audioCodec; }
/** Codec Map */
CodecDescriptor _codecMap;
/** Codec pointer */
AudioCodecType _audioCodec;
bool _audioStarted;
// Informations about call socket / audio
......
......@@ -112,3 +112,16 @@ IAXCall::getFirstMatchingFormat(int needles)
}
return 0;
}
CodecDescriptor& IAXCall::getCodecMap()
{
return _codecMap;
}
AudioCodecType IAXCall::getAudioCodec()
{
return _audioCodec;
}
......@@ -21,6 +21,8 @@
#define IAXCALL_H
#include "call.h"
#include "audio/codecDescriptor.h"
#include <iax2/iax-client.h>
#include <iax2/frame.h>
......@@ -90,11 +92,41 @@ public:
*/
int getFirstMatchingFormat(int needles);
// AUDIO
/**
* Set internal codec Map: initialization only, not protected
* @param map The codec map
*/
void setCodecMap(const CodecDescriptor& map) { _codecMap = map; }
/**
* Get internal codec Map: initialization only, not protected
* @return CodecDescriptor The codec map
*/
CodecDescriptor& getCodecMap();
/**
* Return audio codec [mutex protected]
* @return AudioCodecType The payload of the codec
*/
AudioCodecType getAudioCodec();
private:
/** Each call is associated with an iax_session */
struct iax_session* _session;
/**
* Set the audio codec used. [not protected]
* @param audioCodec The payload of the codec
*/
void setAudioCodec(AudioCodecType audioCodec) { _audioCodec = audioCodec; }
/** Codec Map */
CodecDescriptor _codecMap;
/** Codec pointer */
AudioCodecType _audioCodec;
/**
* Format currently in use in the conversation,
* sent in each outgoing voice packet.
......
......@@ -28,6 +28,7 @@
Sdp::Sdp( pj_pool_t *pool ) : _localSDP(NULL)
, _negociator(NULL)
, _codecMap()
, _audioCodec()
, _ipAddr("")
{
_pool = pool;
......
......@@ -89,7 +89,7 @@ class Sdp {
* Get internal codec Map: initialization only, not protected
* @return CodecDescriptor The codec map
*/
CodecDescriptor& getCodecMap();
CodecDescriptor& getCodecMap(){ return _codecMap; }
void setLocalExternAudioPort(int port){ _localPort = port; }
......@@ -99,6 +99,8 @@ class Sdp {
void toString (void);
AudioCodecType getAudioCodec (void) { return _audioCodec; }
private:
/**
* Set the audio codec used. [not protected]
......
......@@ -431,7 +431,6 @@ SIPVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl)
_debug("Try to make a call to: %s with call ID: %s\n", toUrl.data(), id.data());
// we have to add the codec before using it in SIPOutgoingInvite...
call->setCodecMap(Manager::instance().getCodecDescriptorMap());
call->getLocalSDP()->setCodecMap(Manager::instance().getCodecDescriptorMap());
if ( SIPOutgoingInvite(call) ) {
call->setConnectionState(Call::Progressing);
......@@ -814,7 +813,7 @@ SIPVoIPLink::getCurrentCodecName()
SIPCall *call = getSIPCall(Manager::instance().getCurrentCallId());
AudioCodec *ac = call->getCodecMap().getCodec(call->getAudioCodec());
AudioCodec *ac = call->getLocalSDP()->getCodecMap().getCodec(call->getLocalSDP()->getAudioCodec());
return ac->getCodecName();
}
......@@ -2324,7 +2323,6 @@ void SIPVoIPLink::setStunServer( const std::string &server )
}
void on_rx_offer( pjsip_inv_session *inv, const pjmedia_sdp_session *offer ){
PJ_UNUSED_ARG( inv );
#ifdef CAN_REINVITE
......@@ -2338,6 +2336,7 @@ void SIPVoIPLink::setStunServer( const std::string &server )
return;
call->getLocalSDP()->receiving_initial_offer( (pjmedia_sdp_session*)offer);
_debug("audio codec stté dans l'objet call: %i\n", call->getLocalSDP()->getAudioCodec());
status=pjsip_inv_set_sdp_answer( call->getInvSession(), call->getLocalSDP()->getLocalSDPSession() );
#endif
......
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