In call dialog messages can be sent with xsip.generate by specifying an "id" parameter matching the channel id.

git-svn-id: http://yate.null.ro/svn/yate/trunk@2510 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2009-03-04 16:53:26 +00:00
parent c915bfed32
commit b74dbc4717
1 changed files with 37 additions and 7 deletions

View File

@ -207,6 +207,7 @@ protected:
};
class YateSIPEndPoint;
class SipHandler;
class YateSIPEngine : public SIPEngine
{
@ -369,6 +370,7 @@ private:
class YateSIPConnection : public Channel
{
friend class SipHandler;
YCLASS(YateSIPConnection,Channel)
public:
enum {
@ -427,6 +429,8 @@ public:
{ return m_host; }
inline int getPort() const
{ return m_port; }
inline const String& getLine() const
{ return m_line; }
inline const String& getRtpAddr() const
{ return m_externalAddr ? m_externalAddr : m_rtpLocalAddr; }
inline void referTerminated()
@ -4547,6 +4551,7 @@ bool YateSIPLine::update(const Message& msg)
return chg;
}
YateSIPGenerate::YateSIPGenerate(SIPMessage* m)
: m_tr(0), m_code(0)
{
@ -4596,6 +4601,7 @@ void YateSIPGenerate::clearTransaction()
}
}
bool UserHandler::received(Message &msg)
{
String tmp(msg.getValue("protocol"));
@ -4611,11 +4617,25 @@ bool UserHandler::received(Message &msg)
return true;
}
bool SipHandler::received(Message &msg)
{
Debug(&plugin,DebugInfo,"SipHandler::received() [%p]",this);
RefPointer<YateSIPConnection> conn;
String uri;
const char* id = msg.getValue("id");
if (id) {
plugin.lock();
conn = static_cast<YateSIPConnection*>(plugin.find(id));
plugin.unlock();
if (!conn) {
msg.setParam("error","noconn");
return false;
}
uri = conn->m_uri;
}
const char* method = msg.getValue("method");
String uri(msg.getValue("uri"));
uri = msg.getValue("uri",uri);
Regexp r("<\\([^>]\\+\\)>");
if (uri.matches(r))
uri = uri.matchString(1);
@ -4630,13 +4650,22 @@ bool SipHandler::received(Message &msg)
return false;
}
YateSIPLine* line = plugin.findLine(msg.getValue("line"));
if (line && !line->valid()) {
msg.setParam("error","offline");
return false;
SIPMessage* sip = 0;
YateSIPLine* line = 0;
if (conn) {
line = plugin.findLine(conn->getLine());
sip = conn->createDlgMsg(method,uri);
conn = 0;
}
else {
line = plugin.findLine(msg.getValue("line"));
if (line && !line->valid()) {
msg.setParam("error","offline");
return false;
}
sip = new SIPMessage(method,uri);
plugin.ep()->buildParty(sip,msg.getValue("host"),msg.getIntValue("port"),line);
}
SIPMessage* sip = new SIPMessage(method,uri);
plugin.ep()->buildParty(sip,msg.getValue("host"),msg.getIntValue("port"),line);
sip->addHeader("Max-Forwards",String(maxf));
copySipHeaders(*sip,msg,"sip_");
const char* type = msg.getValue("xsip_type");
@ -4660,6 +4689,7 @@ bool SipHandler::received(Message &msg)
return true;
}
YateSIPConnection* SIPDriver::findCall(const String& callid, bool incRef)
{
XDebug(this,DebugAll,"SIPDriver finding call '%s'",callid.c_str());