doubango/trunk/bindings/_common/SipEvent.cxx

70 lines
1.6 KiB
C++

/*
* Copyright (C) 2009 Mamadou Diop.
*
* Contact: Mamadou Diop <diopmamadou@doubango.org>
*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO 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.
*
* DOUBANGO 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 DOUBANGO.
*
*/
#include "SipEvent.h"
#include "SipSession.h"
#include "SipMessage.h"
#include "Common.h"
SipEvent::SipEvent()
: sipevent(tsk_null)
{
}
SipEvent::SipEvent(const tsip_event_t *_sipevent)
{
this->sipevent = _sipevent;
if(_sipevent){
this->sipmessage = new SipMessage(_sipevent->sipmessage);
}
else{
this->sipmessage = tsk_null;
}
}
SipEvent::~SipEvent()
{
if(this->sipmessage){
delete this->sipmessage;
}
}
short SipEvent::getCode() const
{
return this->sipevent->code;
}
const char* SipEvent::getPhrase() const
{
return this->sipevent->phrase;
}
const SipSession* SipEvent::getBaseSession() const
{
return dyn_cast<SipSession*>((SipSession*)tsip_ssession_get_userdata(this->sipevent->ss));
}
const SipMessage* SipEvent::getSipMessage() const
{
return this->sipmessage;
}