Skip to content
Snippets Groups Projects
Commit bdf06e7e authored by llea's avatar llea
Browse files

Clean up code

parent 734cefc5
No related branches found
No related tags found
No related merge requests found
...@@ -283,7 +283,7 @@ SipCall::newIncomingCall (eXosip_event_t *event) { ...@@ -283,7 +283,7 @@ SipCall::newIncomingCall (eXosip_event_t *event) {
} }
if (tmp != NULL) { if (tmp != NULL) {
ca->payload = atoi (tmp); ca->payload = atoi (tmp);
_debug("For incoming _payload = %d\n", ca->payload); _debug("For incoming payload = %d\n", ca->payload);
setAudioCodec(_cdv->at(0)->alloc(ca->payload, "")); setAudioCodec(_cdv->at(0)->alloc(ca->payload, ""));
} }
if (tmp != NULL if (tmp != NULL
...@@ -608,7 +608,7 @@ SipCall::answeredCall_without_hold (eXosip_event_t *event) ...@@ -608,7 +608,7 @@ SipCall::answeredCall_without_hold (eXosip_event_t *event)
} }
if (tmp != NULL) { if (tmp != NULL) {
ca->payload = atoi (tmp); ca->payload = atoi (tmp);
_debug("For outgoing call: ca->_payload = %d\n", ca->payload); _debug("For outgoing call: ca->payload = %d\n", ca->payload);
setAudioCodec(_cdv->at(0)->alloc(ca->payload, "")); setAudioCodec(_cdv->at(0)->alloc(ca->payload, ""));
} }
if (tmp != NULL if (tmp != NULL
...@@ -774,26 +774,16 @@ void ...@@ -774,26 +774,16 @@ void
SipCall::alloc(void) { SipCall::alloc(void) {
this->_reason_phrase = new char[50]; this->_reason_phrase = new char[50];
this->_textinfo = new char[256]; this->_textinfo = new char[256];
this->_req_uri = new char[256];
this->_local_uri = new char[256];
this->_remote_uri = new char[256]; this->_remote_uri = new char[256];
this->_subject = new char[256];
this->_remote_sdp_audio_ip = new char[50]; this->_remote_sdp_audio_ip = new char[50];
this->_payload_name = new char[50];
this->_sdp_body = new char[1000];
} }
void void
SipCall::dealloc(void) { SipCall::dealloc(void) {
delete _reason_phrase; delete _reason_phrase;
delete _textinfo; delete _textinfo;
delete _req_uri;
delete _local_uri;
delete _remote_uri; delete _remote_uri;
delete _subject;
delete _remote_sdp_audio_ip; delete _remote_sdp_audio_ip;
delete _payload_name;
delete _sdp_body;
} }
void void
......
...@@ -28,12 +28,13 @@ ...@@ -28,12 +28,13 @@
class CodecDescriptor; class CodecDescriptor;
class AudioCodec; class AudioCodec;
#define NOT_USED 0
#define _SENDRECV 0 #define _SENDRECV 0
#define _SENDONLY 1 #define _SENDONLY 1
#define _RECVONLY 2 #define _RECVONLY 2
using namespace std; using namespace std;
// Vector of CodecDescriptor
typedef vector<CodecDescriptor*, allocator<CodecDescriptor*> > CodecDescriptorVector; typedef vector<CodecDescriptor*, allocator<CodecDescriptor*> > CodecDescriptorVector;
class SipCall { class SipCall {
...@@ -44,14 +45,34 @@ public: ...@@ -44,14 +45,34 @@ public:
int payload; int payload;
int enable_audio; /* 1 started, -1 stopped */ int enable_audio; /* 1 started, -1 stopped */
/*
* Store information about incoming call and negociate payload
*/
int newIncomingCall (eXosip_event_t *); int newIncomingCall (eXosip_event_t *);
/*
* Use to answer to a ONHOLD/OFFHOLD event
*/
int answeredCall (eXosip_event_t *); int answeredCall (eXosip_event_t *);
/*
* Use to answer to an incoming call
*/
void answeredCall_without_hold (eXosip_event_t *); void answeredCall_without_hold (eXosip_event_t *);
int ringingCall (eXosip_event_t *); int ringingCall (eXosip_event_t *);
int receivedAck (eXosip_event_t *); int receivedAck (eXosip_event_t *);
/*
* Manage local audio port for each sipcall
*/
void setLocalAudioPort (int); void setLocalAudioPort (int);
int getLocalAudioPort (void); int getLocalAudioPort (void);
/*
* Manage id, did (dialog-id), cid (call-id) and tid (transaction-id)
* for each sipcall
*/
void setId (short id); void setId (short id);
short getId (void); short getId (void);
void setDid (int did); void setDid (int did);
...@@ -60,13 +81,28 @@ public: ...@@ -60,13 +81,28 @@ public:
int getCid (void); int getCid (void);
void setTid (int tid); void setTid (int tid);
int getTid (void); int getTid (void);
/*
* Manage remote sdp audio port
*/
int getRemoteSdpAudioPort (void); int getRemoteSdpAudioPort (void);
char* getRemoteSdpAudioIp (void); char* getRemoteSdpAudioIp (void);
/*
* Manage audio codec
*/
AudioCodec* getAudioCodec (void); AudioCodec* getAudioCodec (void);
void setAudioCodec (AudioCodec* ac); void setAudioCodec (AudioCodec* ac);
/*
* Accessor to remote-uri
*/
inline char* getRemoteUri (void) { return _remote_uri; } inline char* getRemoteUri (void) { return _remote_uri; }
/*
* To avoid confusion when an incoming call occured in the same time
* that you make an outgoing call
*/
inline void setStandBy (bool standby) { _standby = standby; } inline void setStandBy (bool standby) { _standby = standby; }
inline bool getStandBy (void) { return _standby; } inline bool getStandBy (void) { return _standby; }
...@@ -78,6 +114,9 @@ private: ...@@ -78,6 +114,9 @@ private:
int sdp_complete_message(sdp_message_t * remote_sdp, osip_message_t * msg); int sdp_complete_message(sdp_message_t * remote_sdp, osip_message_t * msg);
int sdp_analyse_attribute (sdp_message_t * sdp, sdp_media_t * med); int sdp_analyse_attribute (sdp_message_t * sdp, sdp_media_t * med);
///////////////////////////
// Private member variables
///////////////////////////
CodecDescriptorVector* _cdv; CodecDescriptorVector* _cdv;
AudioCodec* _audiocodec; AudioCodec* _audiocodec;
...@@ -91,15 +130,9 @@ private: ...@@ -91,15 +130,9 @@ private:
char* _reason_phrase; char* _reason_phrase;
char* _textinfo; char* _textinfo;
char* _req_uri;
char* _local_uri;
char* _remote_uri; char* _remote_uri;
char* _subject;
char* _remote_sdp_audio_ip; char* _remote_sdp_audio_ip;
char* _payload_name;
char* _sdp_body;
int _payload;
int _state; int _state;
int _local_audio_port; int _local_audio_port;
int _remote_sdp_audio_port; int _remote_sdp_audio_port;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment