*** empty log message ***
git-svn-id: http://yate.null.ro/svn/yate/trunk@153 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
8070422181
commit
da59d91965
|
@ -197,7 +197,7 @@ SIPTransaction* SIPEngine::addMessage(SIPMessage* message)
|
|||
return 0;
|
||||
}
|
||||
message->complete(this);
|
||||
return new SIPTransaction(message,this,false);
|
||||
return new SIPTransaction(message,this,message->isOutgoing());
|
||||
}
|
||||
|
||||
bool SIPEngine::process()
|
||||
|
@ -232,6 +232,13 @@ void SIPEngine::processEvent(SIPEvent *event)
|
|||
{
|
||||
Lock lock(m_mutex);
|
||||
if (event) {
|
||||
const char* type = "unknown";
|
||||
if (event->isOutgoing())
|
||||
type = "outgoing";
|
||||
if (event->isIncoming())
|
||||
type = "incoming";
|
||||
Debug("SIPEngine",DebugAll,"Processing %s event %p message %p [%p]",
|
||||
type,event,event->getMessage(),this);
|
||||
if (event->isOutgoing() && event->getParty())
|
||||
event->getParty()->transmit(event);
|
||||
if (event->isIncoming() && (event->getState() == SIPTransaction::Trying) &&
|
||||
|
|
|
@ -128,7 +128,8 @@ SIPMessage::SIPMessage(const char* _method, const char* _uri, const char* _versi
|
|||
body(0), m_ep(0), m_valid(true),
|
||||
m_answer(false), m_outgoing(true), m_ack(false), m_cseq(-1)
|
||||
{
|
||||
Debug(DebugAll,"SIPMessage::SIPMessage() [%p]",this);
|
||||
Debug(DebugAll,"SIPMessage::SIPMessage('%s','%s','%s') [%p]",
|
||||
_method,_uri,_version,this);
|
||||
}
|
||||
|
||||
SIPMessage::SIPMessage(SIPParty* ep, const char *buf, int len)
|
||||
|
@ -222,7 +223,7 @@ void SIPMessage::complete(SIPEngine* engine, const char* user, const char* domai
|
|||
if (!user)
|
||||
user = "anonymous";
|
||||
if (!domain)
|
||||
domain = "localhost";
|
||||
domain = getParty()->getLocalAddr();
|
||||
|
||||
HeaderLine* hl = const_cast<HeaderLine*>(getLastHeader("Via"));
|
||||
if (!hl) {
|
||||
|
@ -232,7 +233,7 @@ void SIPMessage::complete(SIPEngine* engine, const char* user, const char* domai
|
|||
hl = new HeaderLine("Via",tmp);
|
||||
header.append(hl);
|
||||
}
|
||||
if (!hl->getParam("branch")) {
|
||||
if (!(isAnswer() || hl->getParam("branch"))) {
|
||||
String tmp("z9hG4bK");
|
||||
tmp << (int)::random();
|
||||
hl->setParam("branch",tmp);
|
||||
|
@ -249,7 +250,7 @@ void SIPMessage::complete(SIPEngine* engine, const char* user, const char* domai
|
|||
hl = new HeaderLine("From",tmp);
|
||||
header.append(hl);
|
||||
}
|
||||
if (!hl->getParam("tag"))
|
||||
if (!(isAnswer() || hl->getParam("tag")))
|
||||
hl->setParam("tag",String((int)::random()));
|
||||
|
||||
hl = const_cast<HeaderLine*>(getHeader("To"));
|
||||
|
|
|
@ -34,7 +34,8 @@ SIPTransaction::SIPTransaction(SIPMessage* message, SIPEngine* engine, bool outg
|
|||
: m_outgoing(outgoing), m_invite(false), m_transmit(false), m_state(Invalid), m_timeout(0),
|
||||
m_firstMessage(message), m_lastMessage(0), m_pending(0), m_engine(engine), m_private(0)
|
||||
{
|
||||
Debug(DebugAll,"SIPTransaction::SIPTransaction(%p,%p) [%p]",message,engine,this);
|
||||
Debug(DebugAll,"SIPTransaction::SIPTransaction(%p,%p,%d) [%p]",
|
||||
message,engine,outgoing,this);
|
||||
if (m_firstMessage) {
|
||||
m_firstMessage->ref();
|
||||
const NamedString* ns = message->getParam("Via","branch");
|
||||
|
@ -48,7 +49,7 @@ SIPTransaction::SIPTransaction(SIPMessage* message, SIPEngine* engine, bool outg
|
|||
const HeaderLine* hl = message->getHeader("Call-ID");
|
||||
if (hl)
|
||||
m_callid = *hl;
|
||||
if (m_firstMessage->getParty()) {
|
||||
if (!m_outgoing && m_firstMessage->getParty()) {
|
||||
hl = message->getHeader("Contact");
|
||||
if (hl) {
|
||||
URI uri(*hl);
|
||||
|
@ -241,6 +242,10 @@ void SIPTransaction::setResponse(int code, const char* reason)
|
|||
|
||||
bool SIPTransaction::processMessage(SIPMessage* message, const String& branch)
|
||||
{
|
||||
if (!message)
|
||||
return false;
|
||||
if (isOutgoing() != message->isAnswer())
|
||||
return false;
|
||||
DDebug("SIPTransaction",DebugAll,"processMessage(%p,'%s') [%p]",
|
||||
message,branch.c_str(),this);
|
||||
if (branch) {
|
||||
|
@ -297,9 +302,8 @@ void SIPTransaction::processClientMessage(SIPMessage* message, int state)
|
|||
setTimeout();
|
||||
changeState(isInvite() ? Finish : Cleared);
|
||||
}
|
||||
else {
|
||||
else
|
||||
changeState(Process);
|
||||
}
|
||||
break;
|
||||
case Process:
|
||||
if (message->code > 100)
|
||||
|
@ -379,8 +383,14 @@ SIPEvent* SIPTransaction::getServerEvent(int state, int timeout)
|
|||
setResponse(100, "Trying");
|
||||
changeState(Trying);
|
||||
}
|
||||
else
|
||||
else {
|
||||
setResponse(405, "Method Not Allowed");
|
||||
e = new SIPEvent(m_lastMessage,this);
|
||||
m_transmit = false;
|
||||
changeState(Invalid);
|
||||
// remove from list and dereference
|
||||
m_engine->TransList.remove(this);
|
||||
}
|
||||
break;
|
||||
case Trying:
|
||||
e = new SIPEvent(m_firstMessage,this);
|
||||
|
|
|
@ -538,8 +538,9 @@ void YateSIPEndPoint::invite(SIPEvent* e, SIPTransaction* t)
|
|||
if (e->getMessage()->body && e->getMessage()->body->isSDP()) {
|
||||
String addr,port,formats;
|
||||
parseSDP(static_cast<SDPBody*>(e->getMessage()->body),addr,port,formats);
|
||||
m->addParam("rtp.addr",addr);
|
||||
m->addParam("rtp.port",port);
|
||||
m->addParam("rtp_forward","possible");
|
||||
m->addParam("rtp_addr",addr);
|
||||
m->addParam("rtp_port",port);
|
||||
m->addParam("formats",formats);
|
||||
}
|
||||
SipMsgThread *thr = new SipMsgThread(t,m);
|
||||
|
@ -571,8 +572,8 @@ YateSIPConnection::YateSIPConnection(Message& msg, SIPTransaction* tr)
|
|||
m_tr->setUserData(this);
|
||||
s_calls.append(this);
|
||||
s_mutex.unlock();
|
||||
m_rtpAddr = msg.getValue("rtp.addr");
|
||||
m_rtpPort = msg.getValue("rtp.port");
|
||||
m_rtpAddr = msg.getValue("rtp_addr");
|
||||
m_rtpPort = msg.getValue("rtp_port");
|
||||
m_formats = msg.getValue("formats");
|
||||
int q = m_formats.find(',');
|
||||
m_rtpFormat = m_formats.substr(0,q);
|
||||
|
@ -632,14 +633,19 @@ void YateSIPConnection::hangup()
|
|||
// Creates a SDP from RTP address data present in message
|
||||
SDPBody* YateSIPConnection::createPasstroughSDP(Message &msg)
|
||||
{
|
||||
String tmp = msg.getValue("rtp.forward");
|
||||
String tmp = msg.getValue("rtp_forward");
|
||||
msg.clearParam("rtp_forward");
|
||||
if (!tmp.toBoolean())
|
||||
return 0;
|
||||
tmp = msg.getValue("rtp.port");
|
||||
tmp = msg.getValue("rtp_port");
|
||||
int port = tmp.toInteger();
|
||||
String addr(msg.getValue("rtp.addr"));
|
||||
if (port && addr)
|
||||
return createSDP(addr,tmp,msg.getValue("formats"));
|
||||
String addr(msg.getValue("rtp_addr"));
|
||||
if (port && addr) {
|
||||
SDPBody* sdp = createSDP(addr,tmp,msg.getValue("formats"));
|
||||
if (sdp)
|
||||
msg.setParam("rtp_forward","accepted");
|
||||
return sdp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue