doubango/trunk/bindings/_common/SipEvent.cxx

70 lines
1.6 KiB
C++
Raw Normal View History

2010-05-14 02:05:29 +00:00
/*
* Copyright (C) 2009 Mamadou Diop.
*
2010-05-14 11:53:20 +00:00
* Contact: Mamadou Diop <diopmamadou@doubango.org>
2010-05-14 02:05:29 +00:00
*
* 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"
2010-05-26 00:48:33 +00:00
#include "SipMessage.h"
2010-05-14 02:05:29 +00:00
2010-05-16 22:24:06 +00:00
#include "Common.h"
2010-05-14 02:05:29 +00:00
SipEvent::SipEvent()
2010-05-26 00:48:33 +00:00
: sipevent(tsk_null)
2010-05-14 02:05:29 +00:00
{
}
2010-05-16 22:24:06 +00:00
SipEvent::SipEvent(const tsip_event_t *_sipevent)
2010-05-14 02:05:29 +00:00
{
2010-05-16 22:24:06 +00:00
this->sipevent = _sipevent;
2010-05-26 00:48:33 +00:00
if(_sipevent){
this->sipmessage = new SipMessage(_sipevent->sipmessage);
}
else{
this->sipmessage = tsk_null;
}
2010-05-14 02:05:29 +00:00
}
2010-05-16 22:24:06 +00:00
SipEvent::~SipEvent()
{
2010-05-26 00:48:33 +00:00
if(this->sipmessage){
delete this->sipmessage;
}
2010-05-16 22:24:06 +00:00
}
2010-05-14 02:05:29 +00:00
2010-05-14 11:53:20 +00:00
short SipEvent::getCode() const
2010-05-14 02:05:29 +00:00
{
2010-05-16 22:24:06 +00:00
return this->sipevent->code;
2010-05-14 02:05:29 +00:00
}
2010-05-14 11:53:20 +00:00
const char* SipEvent::getPhrase() const
2010-05-14 02:05:29 +00:00
{
2010-05-16 22:24:06 +00:00
return this->sipevent->phrase;
2010-05-14 02:05:29 +00:00
}
2010-05-14 11:53:20 +00:00
const SipSession* SipEvent::getBaseSession() const
2010-05-14 02:05:29 +00:00
{
2010-05-16 22:24:06 +00:00
return dyn_cast<SipSession*>((SipSession*)tsip_ssession_get_userdata(this->sipevent->ss));
2010-05-14 02:05:29 +00:00
}
2010-05-26 00:48:33 +00:00
const SipMessage* SipEvent::getSipMessage() const
{
return this->sipmessage;
}