no message

git-svn-id: http://yate.null.ro/svn/yate/trunk@368 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2005-05-20 05:37:58 +00:00
parent 4fef97dee1
commit 20f685a795
3 changed files with 53 additions and 23 deletions

View File

@ -175,7 +175,7 @@ SIPMessage::SIPMessage(const SIPMessage* message, int _code, const char* _reason
SIPMessage::SIPMessage(const SIPMessage* message, bool newtran)
: method("ACK"),
body(), m_ep(0), m_valid(false),
body(0), m_ep(0), m_valid(false),
m_answer(false), m_outgoing(true), m_ack(true), m_cseq(-1)
{
DDebug(DebugAll,"SIPMessage::SIPMessage(%p,%d) [%p]",message,newtran,this);

View File

@ -691,7 +691,7 @@ bool PriChan::call(Message &msg, const char *called)
int layer1 = msg.getIntValue("format",dict_str2law,m_span->layer1());
hangup(PRI_CAUSE_PRE_EMPTED);
setOutgoing(true);
Channel *ch = static_cast<Channel *>(msg.userData());
CallEndpoint *ch = static_cast<CallEndpoint*>(msg.userData());
if (ch) {
openData(lookup(layer1,dict_str2law),msg.getIntValue("cancelecho",dict_numtaps));
connect(ch);
@ -735,23 +735,26 @@ bool PriChan::call(Message &msg, const char *called)
void PriChan::ring(pri_event_ring &ev)
{
q931_call *call = ev.call;
if (call) {
setTimeout(10000000);
setOutgoing(false);
m_call = call;
m_ring = true;
status(chanStatus());
::pri_acknowledge(m_span->pri(),m_call,m_chan,0);
Message *m = message("chan.startup");
m->addParam("span",String(m_span->span()));
m->addParam("channel",String(m_chan));
m->addParam("direction","incoming");
Engine::enqueue(m);
}
else
if (!call) {
hangup(PRI_CAUSE_WRONG_CALL_STATE);
return;
}
Message *m = message("call.route");
setTimeout(10000000);
setOutgoing(false);
m_call = call;
m_ring = true;
status(chanStatus());
::pri_acknowledge(m_span->pri(),m_call,m_chan,0);
Message *m = message("chan.startup");
m->addParam("span",String(m_span->span()));
m->addParam("channel",String(m_chan));
m->addParam("direction","incoming");
Engine::enqueue(m);
openData(lookup(ev.layer1,dict_str2law),0);
m = message("call.route");
if (m_span->overlapped() && !ev.complete && (::strlen(ev.callednum) < m_span->overlapped())) {
::pri_need_more_info(m_span->pri(),m_call,m_chan,!isISDN());
m->addParam("overlapped","yes");

View File

@ -454,6 +454,7 @@ void WpData::run()
}
int rok = 0, rerr = 0;
int wok = 0, werr = 0;
int offs = 0;
while (m_span && m_span->m_data && (m_fd != INVALID_HANDLE_VALUE)) {
Thread::check();
int samp = 0;
@ -466,16 +467,40 @@ void WpData::run()
if ((r % bchans) == 0) {
const unsigned char* dat = buffer + WP_HEADER;
m_span->lock();
for (int n = samp; n > 0; n--)
int p1 = -1;
int p2 = -1;
for (int n = samp; n > 0; n--) {
for (b = 0; b < bchans; b++) {
if (*dat != 0xff)
Debug(&__plugin,DebugAll,"got %02x on %d",*dat,b);
WpSource *s = m_chans[b]->m_wp_s;
if (s)
if (*dat != 0xff) {
//Debug(&__plugin,DebugAll,"got %02x on %d",*dat,b);
if (p1 >= -1) {
if (p1 < 0)
p1 = b;
else if (p1 != b)
p1 = -2;
}
}
int b2 = (b + offs) % bchans;
WpSource *s = m_chans[b2]->m_wp_s;
if (s) {
s->put(PriDriver::bitswap(*dat));
if (p2 >= -1) {
if (p2 < 0)
p2 = b;
else if (p2 != b)
p2 = -2;
}
}
dat++;
}
}
m_span->unlock();
if ((p1 >= 0) && (p2 >= 0) && (p1 != p2)) {
offs = p2 - p1;
if (offs < 0)
offs += bchans;
Debug(&__plugin,DebugAll,"got data on %d and source on %d, new offset %d",p1,p2,offs);
}
++rok;
}
else
@ -487,7 +512,8 @@ void WpData::run()
m_span->lock();
for (int n = samp; n > 0; n--) {
for (b = 0; b < bchans; b++) {
WpConsumer *c = m_chans[b]->m_wp_c;
int b2 = (b + bchans - offs) % bchans;
WpConsumer *c = m_chans[b2]->m_wp_c;
*dat++ = PriDriver::bitswap(c ? c->get() : 0xff);
}
}
@ -519,6 +545,7 @@ WpChan::~WpChan()
bool WpChan::openData(const char* format, int echoTaps)
{
Debug(this,DebugAll,"WpChan::openData(%s,%d) [%p]",format,echoTaps,this);
if (echoTaps)
Debug(DebugWarn,"Echo cancellation requested but not available in wanpipe");
m_span->lock();