Skip to content
Snippets Groups Projects
Commit 9e2f95b4 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

add sdpmedia class to encapsulate sdp media attributes

parent ab3df1e1
Branches
Tags
No related merge requests found
...@@ -30,6 +30,7 @@ sflphoned_SOURCES = \ ...@@ -30,6 +30,7 @@ sflphoned_SOURCES = \
account.cpp \ account.cpp \
sipcall.cpp \ sipcall.cpp \
sdp.cpp \ sdp.cpp \
sdpmedia.cpp \
$(IAXSOURCES) $(IAXSOURCES)
sflphoned_CXXFLAGS = \ sflphoned_CXXFLAGS = \
...@@ -69,7 +70,8 @@ noinst_HEADERS = \ ...@@ -69,7 +70,8 @@ noinst_HEADERS = \
sipvoiplink.h \ sipvoiplink.h \
call.h \ call.h \
sipcall.h \ sipcall.h \
sdp.h sdp.h \
sdpmedia.h
libsflphone_la_LIBADD = \ libsflphone_la_LIBADD = \
$(src)/libs/stund/libstun.la \ $(src)/libs/stund/libstun.la \
......
This diff is collapsed.
...@@ -29,74 +29,125 @@ ...@@ -29,74 +29,125 @@
#include <pj/assert.h> #include <pj/assert.h>
#include "audio/codecDescriptor.h" #include "audio/codecDescriptor.h"
#include "sdpmedia.h"
class Sdp { class Sdp {
public: public:
/*
* Class Constructor.
*
* @param ip_addr
*/
Sdp(pj_pool_t *pool); Sdp(pj_pool_t *pool);
/* Class destructor */
~Sdp(); ~Sdp();
/** /*
* Setup incoming call, and verify for errors, before ringing the user. * Read accessor. Get the list of the local media capabilities.
* @param pjsip_rx_data *rdata *
* @param pj_pool_t *pool * @return std::vector<sdpMedia*> the vector containing the different media
* @return bool True on success
* false otherwise
*/ */
bool SIPCallInvite(pjsip_rx_data *rdata); std::vector<sdpMedia*> get_local_media_cap( void ) { return _local_media_cap; }
bool SIPCallAnsweredWithoutHold(pjsip_rx_data *rdata); void set_local_media_cap (void);
/** /*
* Get the local SDP * Read accessor. Get the sdp session information
* @param void *
* @return _localSDP pjmedia_sdp_session * @return pjmedia_sdp_session The structure that describes a SDP session
*/ */
pjmedia_sdp_session* getLocalSDPSession( void ) { return _localSDP; } pjmedia_sdp_session* get_local_sdp_session( void ) { return _local_offer; }
/** /*
* Begin negociation of media information between caller and callee * Write accessor. Set the local IP address that will be used in the sdp session
* @param pj_pool_t *pool
* @return bool True if ok
*/ */
bool startNegociation(); void set_ip_address( std::string ip_addr ) { _ip_addr = ip_addr; }
/** /*
* Create the localSDP, media negociation and codec information * Read accessor. Get the local IP address
* @param pj_pool_t *pool
* @return void
*/ */
bool createInitialOffer(); std::string get_ip_address( void ) { return _ip_addr; }
bool createLocalOffer (); /*
* Build the local SDP offer
*/
int create_local_offer( );
/** /*
* Set internal codec Map: initialization only, not protected * Build the sdp media section
* @param map The codec map * Add rtpmap field if necessary
*
* @param media The media to add to SDP
* @param med The structure to receive the media section
*/ */
void setCodecMap(const CodecDescriptor& map) { _codecMap = map; } void set_media_descriptor_line( sdpMedia* media, pjmedia_sdp_media** p_med );
/** /*
* Save IP Address * On building an invite outside a dialog, build the local offer and create the
* @param ip std::string * SDP negociator instance with it.
* @return void
*/ */
void setIp(std::string ip) {_ipAddr = ip;} int create_initial_offer( );
/** /*
* Get internal codec Map: initialization only, not protected * On receiving an invite outside a dialog, build the local offer and create the
* @return CodecDescriptor The codec map * SDP negociator instance with the remote offer.
*
* @param remote The remote offer
*/ */
CodecDescriptor& getCodecMap(){ return _codecMap; } int receiving_initial_offer( pjmedia_sdp_session* remote );
/*
* Remove all media in the session media vector.
*/
void clean_session_media();
/*
* Return a string description of the media added to the session,
* ie the local media capabilities
*/
std::string media_to_string( void );
/*
* Return the codec of the first media after negociation
*/
AudioCodec* get_session_media( void );
/*
* read accessor. Return the negociated offer
*
* @return pjmedia_sdp_session The negociated offer
*/
pjmedia_sdp_session* get_negociated_offer( void ){
return _negociated_offer;
}
/*
* Start the sdp negociation.
*
* @return pj_status_t 0 on success
* 1 otherwise
*/
pj_status_t start_negociation( void ){
return pjmedia_sdp_neg_negotiate(
_pool, _negociator, 0);
}
/*
* Retrieve the negociated sdp offer from the sip payload.
*
* @param sdp the negociated offer
*/
void set_negociated_offer( const pjmedia_sdp_session *sdp );
///////////////////////////////////////////////////////////////////////////33
void setLocalExternAudioPort(int port){ _localPort = port; } void setLocalExternAudioPort(int port){ _localPort = port; }
int getLocalExternAudioPort (void){ return _localPort; } int getLocalExternAudioPort (void){ return _localPort; }
int receiving_initial_offer( pjmedia_sdp_session* remote );
void toString (void); void toString (void);
AudioCodecType getAudioCodec (void) { return _audioCodec; } AudioCodecType getAudioCodec (void) { return _audioCodec; }
...@@ -125,6 +176,7 @@ class Sdp { ...@@ -125,6 +176,7 @@ class Sdp {
*/ */
const std::string& getRemoteIp() { return _remoteIPAddress; } const std::string& getRemoteIp() { return _remoteIPAddress; }
/////////////////////////////////////////////////////////////////////////
private: private:
/** /**
...@@ -133,73 +185,123 @@ class Sdp { ...@@ -133,73 +185,123 @@ class Sdp {
*/ */
void setAudioCodec(AudioCodecType audioCodec) { _audioCodec = audioCodec; } void setAudioCodec(AudioCodecType audioCodec) { _audioCodec = audioCodec; }
/** Codec pointer */ /** Codec Map */
AudioCodecType _audioCodec; std::vector<sdpMedia*> _local_media_cap;
/* The media that will be used by the session (after the SDP negociation) */
std::vector<sdpMedia*> _session_media;
/** negociator */
pjmedia_sdp_neg *_negociator;
/** IP address */ /** IP address */
std::string _ipAddr; std::string _ip_addr;
int _localPort; /** Local SDP */
pjmedia_sdp_session *_local_offer;
/** Remote's IP address */ /* The negociated SDP offer */
std::string _remoteIPAddress; // Explanation: each endpoint's offer is negociated, and a new sdp offer results from this
// negociation, with the compatible media from each part
pjmedia_sdp_session *_negociated_offer;
/** Remote's audio port */ // The pool to allocate memory
unsigned int _remoteAudioPort; pj_pool_t *_pool;
Sdp(const Sdp&); //No Copy Constructor
Sdp& operator=(const Sdp&); //No Assignment Operator
/** void set_local_media_capabilities ();
* Get a valid remote media
* @param remote_sdp pjmedia_sdp_session* /*
* @return pjmedia_sdp_media*. A valid sdp_media_t or 0 * Mandatory field: Origin ("o=")
* Gives the originator of the session.
* Serves as a globally unique identifier for this version of this session description.
*/ */
pjmedia_sdp_media* getRemoteMedia(pjmedia_sdp_session *remote_sdp); void sdp_add_origin( void );
pjmedia_sdp_session * getRemoteSDPFromRequest (pjsip_rx_data *rdata); /*
* Mandatory field: Protocol version ("v=")
* Add the protocol version in the SDP session description
*/
void sdp_add_protocol( void );
/** /*
* Set Audio Port and Audio IP from Remote SDP Info * Optional field: Connection data ("c=")
* @param remote_med Remote Media info * Contains connection data.
* @param remote_sdp Remote SDP pointer
* @return bool True if everything is set correctly
*/ */
bool setRemoteAudioFromSDP(pjmedia_sdp_session* remote_sdp, pjmedia_sdp_media* remote_med); void sdp_add_connection_info( void );
/** /*
* Set Audio Codec with the remote choice * Mandatory field: Session name ("s=")
* @param remote_med Remote Media info * Add a textual session name.
* @return bool True if everything is set correctly
*/ */
bool setAudioCodecFromSDP(pjmedia_sdp_media* remote_med); void sdp_add_session_name( void );
/** Local SDP */ /*
pjmedia_sdp_session *_localSDP; * Optional field: Session information ("s=")
pjmedia_sdp_session *_negociated_offer; * Provides textual information about the session.
*/
void sdp_add_session_info( void ){}
/** negociator */ /*
pjmedia_sdp_neg *_negociator; * Optional field: Uri ("u=")
* Add a pointer to additional information about the session.
*/
void sdp_add_uri( void ) {}
// The pool to allocate memory /*
pj_pool_t *_pool; * Optional fields: Email address and phone number ("e=" and "p=")
* Add contact information for the person responsible for the conference.
*/
void sdp_add_email( void ) {}
/** Codec Map */ /*
CodecDescriptor _codecMap; * Optional field: Bandwidth ("b=")
* Denotes the proposed bandwidth to be used by the session or the media .
*/
void sdp_add_bandwidth( void ) {}
/** /*
* Set origin information for local SDP * Mandatory field: Timing ("t=")
* Specify the start and the stop time for a session.
*/ */
void sdpAddOrigin( void ); void sdp_add_timing( void );
/** /*
* Set connection information for local SDP * Optional field: Time zones ("z=")
*/ */
void sdpAddConnectionInfo( void ); void sdp_add_time_zone( void ) {}
/**
* Set media information including codec for localSDP /*
* @param pj_pool_t* pool * Optional field: Encryption keys ("k=")
* @return void */
void sdp_add_encryption_key( void ) {}
/*
* Optional field: Attributes ("a=")
*/
void sdp_add_attributes( );
/*
* Mandatory field: Media descriptions ("m=")
*/ */
void sdpAddMediaDescription(); void sdp_add_media_description();
//////////////////////////////////////////////////////////////////3
/** Codec pointer */
AudioCodecType _audioCodec;
int _localPort;
/** Remote's IP address */
std::string _remoteIPAddress;
/** Remote's audio port */
unsigned int _remoteAudioPort;
////////////////////////////////////////////////////////////////////
}; };
......
...@@ -29,6 +29,14 @@ ...@@ -29,6 +29,14 @@
/**************** EXTERN VARIABLES AND FUNCTIONS (callbacks) **************************/ /**************** EXTERN VARIABLES AND FUNCTIONS (callbacks) **************************/
/*
* Retrieve the SDP of the peer contained in the offer
*
* @param rdata The request data
* @param r_sdp The pjmedia_sdp_media to stock the remote SDP
*/
void get_remote_sdp_from_offer( pjsip_rx_data *rdata, pjmedia_sdp_session** r_sdp );
int getModId(); int getModId();
/* /*
...@@ -250,6 +258,21 @@ SIPVoIPLink::terminateOneCall(const CallID& id) ...@@ -250,6 +258,21 @@ SIPVoIPLink::terminateOneCall(const CallID& id)
} }
} }
void get_remote_sdp_from_offer( pjsip_rx_data *rdata, pjmedia_sdp_session** r_sdp ){
pjmedia_sdp_session *sdp;
pjsip_msg *msg;
pjsip_msg_body *body;
// Get the message
msg = rdata->msg_info.msg;
// Get the body message
body = msg->body;
// Parse the remote request to get the sdp session
pjmedia_sdp_parse( rdata->tp_info.pool, (char*)body->data, body->len, &sdp );
*r_sdp = sdp;
}
void void
...@@ -425,14 +448,16 @@ SIPVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl) ...@@ -425,14 +448,16 @@ SIPVoIPLink::newOutgoingCall(const CallID& id, const std::string& toUrl)
delete call; call=0; delete call; call=0;
return call; return call;
} }
//call->setPeerNumber(toUrl);
call->setPeerNumber(getSipTo(toUrl, account->getHostname())); call->setPeerNumber(getSipTo(toUrl, account->getHostname()));
call->initRecFileName(); call->initRecFileName();
_debug("Try to make a call to: %s with call ID: %s\n", toUrl.data(), id.data()); _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... // Building the local SDP offer
call->getLocalSDP()->setCodecMap(Manager::instance().getCodecDescriptorMap()); call->getLocalSDP()->set_ip_address(getLocalIP());
call->getLocalSDP()->create_initial_offer();
if ( SIPOutgoingInvite(call) ) { if ( SIPOutgoingInvite(call) ) {
call->setConnectionState(Call::Progressing); call->setConnectionState(Call::Progressing);
call->setState(Call::Active); call->setState(Call::Active);
...@@ -463,7 +488,7 @@ SIPVoIPLink::answer(const CallID& id) ...@@ -463,7 +488,7 @@ SIPVoIPLink::answer(const CallID& id)
} }
// User answered the incoming call, tell peer this news // User answered the incoming call, tell peer this news
if (call->getLocalSDP()->startNegociation()) { if (call->getLocalSDP()->start_negociation()) {
// Create and send a 200(OK) response // Create and send a 200(OK) response
_debug("SIPVoIPLink::answer:UserAgent: Negociation success! : call %s \n", call->getCallId().c_str()); _debug("SIPVoIPLink::answer:UserAgent: Negociation success! : call %s \n", call->getCallId().c_str());
status = pjsip_inv_answer(call->getInvSession(), PJSIP_SC_OK, NULL, NULL, &tdata); status = pjsip_inv_answer(call->getInvSession(), PJSIP_SC_OK, NULL, NULL, &tdata);
...@@ -581,9 +606,6 @@ SIPVoIPLink::onhold(const CallID& id) ...@@ -581,9 +606,6 @@ SIPVoIPLink::onhold(const CallID& id)
{ {
pj_status_t status; pj_status_t status;
pjsip_tx_data *tdata;
pjmedia_sdp_attr *attr;
pjmedia_sdp_session* local_sdp;
SIPCall* call; SIPCall* call;
call = getSIPCall(id); call = getSIPCall(id);
...@@ -595,43 +617,54 @@ SIPVoIPLink::onhold(const CallID& id) ...@@ -595,43 +617,54 @@ SIPVoIPLink::onhold(const CallID& id)
call->setAudioStart(false); call->setAudioStart(false);
call->setState(Call::Hold); call->setState(Call::Hold);
_debug("* SIP Info: Stopping AudioRTP for onhold action\n"); _debug("* SIP Info: Stopping AudioRTP for onhold action\n");
//_mutexSIP.enterMutex();
_audiortp->closeRtpSession(); _audiortp->closeRtpSession();
//_mutexSIP.leaveMutex();
local_sdp = call->getLocalSDP()->getLocalSDPSession(); /* Create re-INVITE with new offer */
status = inv_session_reinvite (call, "sendonly");
return (status == PJ_SUCCESS);
}
int SIPVoIPLink::inv_session_reinvite (SIPCall *call, std::string direction) {
pj_status_t status;
pjsip_tx_data *tdata;
pjmedia_sdp_session *local_sdp;
pjmedia_sdp_attr *attr;
local_sdp = call->getLocalSDP()->get_local_sdp_session();
if( local_sdp == NULL ){ if( local_sdp == NULL ){
_debug("! SIP Failure: unable to find local_sdp\n"); _debug("! SIP Failure: unable to find local_sdp\n");
return false; return false;
} }
/* Create re-INVITE with new offer */ // reinvite only if connected
// Remove all the attributes with the specified name // Build the local SDP offer
status = call->getLocalSDP()->create_initial_offer( );
pjmedia_sdp_media_remove_all_attr(local_sdp->media[0], "sendrecv"); pjmedia_sdp_media_remove_all_attr(local_sdp->media[0], "sendrecv");
attr = pjmedia_sdp_attr_create(_pool, "sendonly", NULL); attr = pjmedia_sdp_attr_create(_pool, "sendonly", NULL);
pjmedia_sdp_media_add_attr(local_sdp->media[0], attr); pjmedia_sdp_media_add_attr(local_sdp->media[0], attr);
PJ_ASSERT_RETURN( status == PJ_SUCCESS, 1 );
status = pjsip_inv_reinvite( call->getInvSession(), NULL, local_sdp, &tdata); // Build the reinvite request
if( status != PJ_SUCCESS ) status = pjsip_inv_reinvite( call->getInvSession(), NULL,
{ local_sdp, &tdata );
_debug("On hold: creation of the Re-invite request failed\n"); PJ_ASSERT_RETURN( status == PJ_SUCCESS, 1 );
return false;
} // Send it
/* Send the request */
status = pjsip_inv_send_msg( call->getInvSession(), tdata ); status = pjsip_inv_send_msg( call->getInvSession(), tdata );
PJ_ASSERT_RETURN( status == PJ_SUCCESS, 1 );
return (status == PJ_SUCCESS); return PJ_SUCCESS;
} }
bool bool
SIPVoIPLink::offhold(const CallID& id) SIPVoIPLink::offhold(const CallID& id)
{ {
SIPCall *call; SIPCall *call;
pj_status_t status; pj_status_t status;
pjsip_tx_data *tdata;
pjmedia_sdp_attr *attr;
pjmedia_sdp_session* local_sdp;
call = getSIPCall(id); call = getSIPCall(id);
...@@ -640,27 +673,8 @@ SIPVoIPLink::offhold(const CallID& id) ...@@ -640,27 +673,8 @@ SIPVoIPLink::offhold(const CallID& id)
return false; return false;
} }
local_sdp = call->getLocalSDP()->getLocalSDPSession();
if( local_sdp == NULL ){
_debug("! SIP Failure: unable to find local_sdp\n");
return false;
}
/* Create re-INVITE with new offer */ /* Create re-INVITE with new offer */
// Remove all the attributes with the specified name status = inv_session_reinvite (call, "sendonly");
pjmedia_sdp_media_remove_all_attr(local_sdp->media[0], "sendonly");
attr = pjmedia_sdp_attr_create(_pool, "sendrecv", NULL);
pjmedia_sdp_media_add_attr(local_sdp->media[0], attr);
status = pjsip_inv_reinvite( call->getInvSession(), NULL, local_sdp , &tdata);
if( status != PJ_SUCCESS )
{
_debug("Off hold: creation of the Re-invite request failed\n");
return false;
}
/* Send the request */
status = pjsip_inv_send_msg( call->getInvSession(), tdata);
if (status != PJ_SUCCESS) if (status != PJ_SUCCESS)
return false; return false;
...@@ -814,7 +828,7 @@ SIPVoIPLink::getCurrentCodecName() ...@@ -814,7 +828,7 @@ SIPVoIPLink::getCurrentCodecName()
SIPCall *call = getSIPCall(Manager::instance().getCurrentCallId()); SIPCall *call = getSIPCall(Manager::instance().getCurrentCallId());
AudioCodec *ac = call->getLocalSDP()->getCodecMap().getCodec(call->getLocalSDP()->getAudioCodec()); AudioCodec *ac = call->getLocalSDP()->get_session_media();
return ac->getCodecName(); return ac->getCodecName();
} }
...@@ -927,16 +941,10 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject UNUSED) ...@@ -927,16 +941,10 @@ SIPVoIPLink::SIPStartCall(SIPCall* call, const std::string& subject UNUSED)
PJ_ASSERT_RETURN(status == PJ_SUCCESS, false); PJ_ASSERT_RETURN(status == PJ_SUCCESS, false);
setCallAudioLocal(call, getLocalIPAddress(), useStun(), getStunServer()); setCallAudioLocal(call, getLocalIPAddress(), useStun(), getStunServer());
call->getLocalSDP()->setIp(getLocalIP());
// Building the local SDP offer
call->getLocalSDP()->createInitialOffer();
call->getLocalSDP()->toString ();
// Create the invite session for this call // Create the invite session for this call
pjsip_inv_session *inv; pjsip_inv_session *inv;
status = pjsip_inv_create_uac(dialog, call->getLocalSDP()->getLocalSDPSession(), 0, &inv); status = pjsip_inv_create_uac(dialog, call->getLocalSDP()->get_local_sdp_session(), 0, &inv);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, false); PJ_ASSERT_RETURN(status == PJ_SUCCESS, false);
// Set auth information // Set auth information
...@@ -1082,7 +1090,7 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam ...@@ -1082,7 +1090,7 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
if (call->getConnectionState() != Call::Connected) { if (call->getConnectionState() != Call::Connected) {
//call->SIPCallAnswered(event); //call->SIPCallAnswered(event);
call->getLocalSDP()->SIPCallAnsweredWithoutHold(rdata); //call->getLocalSDP()->SIPCallAnsweredWithoutHold(rdata);
call->setConnectionState(Call::Connected); call->setConnectionState(Call::Connected);
call->setState(Call::Active); call->setState(Call::Active);
...@@ -1573,6 +1581,17 @@ void SIPVoIPLink::setStunServer( const std::string &server ) ...@@ -1573,6 +1581,17 @@ void SIPVoIPLink::setStunServer( const std::string &server )
void call_on_media_update( pjsip_inv_session *inv UNUSED, pj_status_t status UNUSED) { void call_on_media_update( pjsip_inv_session *inv UNUSED, pj_status_t status UNUSED) {
_debug("call_on_media_updated\n"); _debug("call_on_media_updated\n");
const pjmedia_sdp_session *r_sdp;
if (status != PJ_SUCCESS) {
return;
}
// Get the new sdp, result of the negociation
pjmedia_sdp_neg_get_active_local( inv->neg, &r_sdp );
// Clean the resulting sdp offer to create a new one (in case of a reinvite)
} }
void call_on_forked(pjsip_inv_session *inv, pjsip_event *e){ void call_on_forked(pjsip_inv_session *inv, pjsip_event *e){
...@@ -1768,6 +1787,8 @@ void SIPVoIPLink::setStunServer( const std::string &server ) ...@@ -1768,6 +1787,8 @@ void SIPVoIPLink::setStunServer( const std::string &server )
SIPVoIPLink *link; SIPVoIPLink *link;
CallID id; CallID id;
SIPCall* call; SIPCall* call;
pjsip_inv_session *inv;
pjmedia_sdp_session *r_sdp;
// voicemail part // voicemail part
std::string method_name; std::string method_name;
...@@ -1862,24 +1883,20 @@ void SIPVoIPLink::setStunServer( const std::string &server ) ...@@ -1862,24 +1883,20 @@ void SIPVoIPLink::setStunServer( const std::string &server )
return false; return false;
} }
// Have to do some stuff with the SDP
// We retrieve the remote sdp offer in the rdata struct to begin the negociation
call->getLocalSDP()->set_ip_address(link->getLocalIPAddress());
get_remote_sdp_from_offer( rdata, &r_sdp );
call->getLocalSDP()->receiving_initial_offer( r_sdp );
// Set the codec map, IP, peer number and so on... for the SIPCall object // Set the codec map, IP, peer number and so on... for the SIPCall object
setCallAudioLocal(call, link->getLocalIPAddress(), link->useStun(), link->getStunServer()); setCallAudioLocal(call, link->getLocalIPAddress(), link->useStun(), link->getStunServer());
call->getLocalSDP()->setCodecMap(Manager::instance().getCodecDescriptorMap());
call->setConnectionState(Call::Progressing); call->setConnectionState(Call::Progressing);
call->getLocalSDP()->setIp(link->getLocalIPAddress());
call->setPeerNumber(peerNumber); call->setPeerNumber(peerNumber);
call->initRecFileName(); call->initRecFileName();
/* Call the SIPCallInvite function to generate the local sdp,
* remote sdp and negociator.
* This function is also used to set the parameters of audio RTP, including:
* local IP and port number
* remote IP and port number
* possilbe audio codec will be used in this call
*/
if (call->getLocalSDP()->SIPCallInvite(rdata)) {
// Notify UI there is an incoming call // Notify UI there is an incoming call
if (Manager::instance().incomingCall(call, account_id)) { if (Manager::instance().incomingCall(call, account_id)) {
// Add this call to the callAccountMap in ManagerImpl // Add this call to the callAccountMap in ManagerImpl
...@@ -1891,13 +1908,7 @@ void SIPVoIPLink::setStunServer( const std::string &server ) ...@@ -1891,13 +1908,7 @@ void SIPVoIPLink::setStunServer( const std::string &server )
_debug("UserAgent: Fail to notify UI!\n"); _debug("UserAgent: Fail to notify UI!\n");
return false; return false;
} }
} else {
// Fail to collect call information
delete call;
call = NULL;
_debug("UserAgent: Call SIPCallInvite failed!\n");
return false;
}
/* Create the local dialog (UAS) */ /* Create the local dialog (UAS) */
status = pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, NULL, &dialog); status = pjsip_dlg_create_uas(pjsip_ua_instance(), rdata, NULL, &dialog);
...@@ -1908,8 +1919,7 @@ void SIPVoIPLink::setStunServer( const std::string &server ) ...@@ -1908,8 +1919,7 @@ void SIPVoIPLink::setStunServer( const std::string &server )
} }
// Specify media capability during invite session creation // Specify media capability during invite session creation
pjsip_inv_session *inv; status = pjsip_inv_create_uas(dialog, rdata, call->getLocalSDP()->get_local_sdp_session(), 0, &inv);
status = pjsip_inv_create_uas(dialog, rdata, call->getLocalSDP()->getLocalSDPSession(), 0, &inv);
PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1);
// Associate the call in the invite session // Associate the call in the invite session
...@@ -2324,7 +2334,6 @@ void SIPVoIPLink::setStunServer( const std::string &server ) ...@@ -2324,7 +2334,6 @@ void SIPVoIPLink::setStunServer( const std::string &server )
void on_rx_offer( pjsip_inv_session *inv, const pjmedia_sdp_session *offer ){ void on_rx_offer( pjsip_inv_session *inv, const pjmedia_sdp_session *offer ){
#ifdef CAN_REINVITE #ifdef CAN_REINVITE
_debug ("reinvite SIP\n"); _debug ("reinvite SIP\n");
SIPCall *call; SIPCall *call;
...@@ -2335,8 +2344,8 @@ void SIPVoIPLink::setStunServer( const std::string &server ) ...@@ -2335,8 +2344,8 @@ void SIPVoIPLink::setStunServer( const std::string &server )
return; return;
call->getLocalSDP()->receiving_initial_offer( (pjmedia_sdp_session*)offer); call->getLocalSDP()->receiving_initial_offer( (pjmedia_sdp_session*)offer);
_debug("audio codec stté dans l'objet call: %i\n", call->getLocalSDP()->getAudioCodec()); _debug("audio codec setté dans l'objet call: %i\n", call->getLocalSDP()->getAudioCodec());
status=pjsip_inv_set_sdp_answer( call->getInvSession(), call->getLocalSDP()->getLocalSDPSession() ); status=pjsip_inv_set_sdp_answer( call->getInvSession(), call->getLocalSDP()->get_local_sdp_session() );
#endif #endif
} }
......
...@@ -303,6 +303,8 @@ class SIPVoIPLink : public VoIPLink ...@@ -303,6 +303,8 @@ class SIPVoIPLink : public VoIPLink
*/ */
std::string getCurrentCodecName(); std::string getCurrentCodecName();
int inv_session_reinvite (SIPCall *call, std::string direction="");
private: private:
/** /**
......
...@@ -45,8 +45,6 @@ ...@@ -45,8 +45,6 @@
#define VOLUME_MICRO "Volume.micro" /** Mic volume */ #define VOLUME_MICRO "Volume.micro" /** Mic volume */
#define RECORD_PATH "Record.path" /** Recording path */ #define RECORD_PATH "Record.path" /** Recording path */
#define VIDEO "Video" /** Section Video */
#define PREFERENCES "Preferences" /** Section Preferences */ #define PREFERENCES "Preferences" /** Section Preferences */
#define CONFIG_DIALPAD "Dialpad.display" /** Display dialpad preferences */ #define CONFIG_DIALPAD "Dialpad.display" /** Display dialpad preferences */
#define CONFIG_SEARCHBAR "Searchbar.display" /** Whether or nor display the search bar */ #define CONFIG_SEARCHBAR "Searchbar.display" /** Whether or nor display the search bar */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment