Option to forward provisional messages even after getting an 180 Ringing.

Detection and generation of the special 181 and 182 progressing messages.


git-svn-id: http://voip.null.ro/svn/yate@1180 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2007-01-28 18:32:02 +00:00
parent 8ab94d2d09
commit 4bca01c2d1
2 changed files with 47 additions and 19 deletions

View File

@ -58,6 +58,9 @@
; rtp_start: bool: Start RTP when sending 200 on incoming instead of receiving ACK ; rtp_start: bool: Start RTP when sending 200 on incoming instead of receiving ACK
;rtp_start=disable ;rtp_start=disable
; multi_ringing: bool: Accept provisional (1xx) messages even after 180 Ringing
;multi_ringing=disable
[registrar] [registrar]
; Controls the behaviour when acting as registrar ; Controls the behaviour when acting as registrar

View File

@ -490,6 +490,7 @@ static bool s_info = false;
static bool s_forward_sdp = false; static bool s_forward_sdp = false;
static bool s_start_rtp = false; static bool s_start_rtp = false;
static bool s_auth_register = true; static bool s_auth_register = true;
static bool s_multi_ringing = false;
static int s_expires_min = EXPIRES_MIN; static int s_expires_min = EXPIRES_MIN;
static int s_expires_def = EXPIRES_DEF; static int s_expires_def = EXPIRES_DEF;
@ -2466,25 +2467,39 @@ bool YateSIPConnection::process(SIPEvent* ev)
Engine::enqueue(m); Engine::enqueue(m);
startPendingUpdate(); startPendingUpdate();
} }
if ((m_state < Ringing) && msg->isAnswer()) { if (msg->isAnswer() && (msg->code > 100) && (msg->code < 200)) {
if (msg->code == 180) { if (s_multi_ringing || (m_state < Ringing)) {
setStatus("ringing",Ringing); const char* name = "call.progress";
Message *m = message("call.ringing"); const char* reason = 0;
addRtpParams(*m,natAddr,msg->body); switch (msg->code) {
if (m_rtpAddr.null()) case 180:
m->addParam("earlymedia","false"); name = "call.ringing";
Engine::enqueue(m); setStatus("ringing",Ringing);
break;
case 181:
reason = "forwarded";
setStatus("progressing");
break;
case 182:
reason = "queued";
setStatus("progressing");
break;
case 183:
setStatus("progressing");
break;
// for all others emit a call.progress but don't change status
}
if (name) {
Message* m = message(name);
if (reason)
m->addParam("reason",reason);
addRtpParams(*m,natAddr,msg->body);
if (m_rtpAddr.null())
m->addParam("earlymedia","false");
Engine::enqueue(m);
}
} }
if (msg->code == 183) { emitPRACK(msg);
setStatus("progressing");
Message *m = message("call.progress");
addRtpParams(*m,natAddr,msg->body);
if (m_rtpAddr.null())
m->addParam("earlymedia","false");
Engine::enqueue(m);
}
if ((msg->code > 100) && (msg->code < 200))
emitPRACK(msg);
} }
if (msg->isACK()) { if (msg->isACK()) {
DDebug(this,DebugInfo,"YateSIPConnection got ACK [%p]",this); DDebug(this,DebugInfo,"YateSIPConnection got ACK [%p]",this);
@ -2830,9 +2845,18 @@ void YateSIPConnection::disconnected(bool final, const char *reason)
bool YateSIPConnection::msgProgress(Message& msg) bool YateSIPConnection::msgProgress(Message& msg)
{ {
Channel::msgProgress(msg); Channel::msgProgress(msg);
int code = 183;
const NamedString* reason = msg.getParam("reason");
if (reason) {
// handle the special progress types that have provisional codes
if (*reason == "forwarded")
code = 181;
else if (*reason == "queued")
code = 182;
}
Lock lock(driver()); Lock lock(driver());
if (m_tr && (m_tr->getState() == SIPTransaction::Process)) { if (m_tr && (m_tr->getState() == SIPTransaction::Process)) {
SIPMessage* m = new SIPMessage(m_tr->initialMessage(), 183); SIPMessage* m = new SIPMessage(m_tr->initialMessage(), code);
m->setBody(createProvisionalSDP(msg)); m->setBody(createProvisionalSDP(msg));
m_tr->setResponse(m); m_tr->setResponse(m);
m->deref(); m->deref();
@ -3763,6 +3787,7 @@ void SIPDriver::initialize()
s_info = s_cfg.getBoolValue("general","dtmfinfo",false); s_info = s_cfg.getBoolValue("general","dtmfinfo",false);
s_forward_sdp = s_cfg.getBoolValue("general","forward_sdp",false); s_forward_sdp = s_cfg.getBoolValue("general","forward_sdp",false);
s_start_rtp = s_cfg.getBoolValue("general","rtp_start",false); s_start_rtp = s_cfg.getBoolValue("general","rtp_start",false);
s_multi_ringing = s_cfg.getBoolValue("general","multi_ringing",false);
s_expires_min = s_cfg.getIntValue("registrar","expires_min",EXPIRES_MIN); s_expires_min = s_cfg.getIntValue("registrar","expires_min",EXPIRES_MIN);
s_expires_def = s_cfg.getIntValue("registrar","expires_def",EXPIRES_DEF); s_expires_def = s_cfg.getIntValue("registrar","expires_def",EXPIRES_DEF);
s_expires_max = s_cfg.getIntValue("registrar","expires_max",EXPIRES_MAX); s_expires_max = s_cfg.getIntValue("registrar","expires_max",EXPIRES_MAX);