Added support for delivering Caller ID over analog FXS MGCP gateways.
git-svn-id: http://voip.null.ro/svn/yate@4188 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
f265f745f3
commit
1fd0dc1670
|
@ -4,6 +4,12 @@
|
||||||
; priority: int: Priority of the chan.rtp message handler
|
; priority: int: Priority of the chan.rtp message handler
|
||||||
;priority=80
|
;priority=80
|
||||||
|
|
||||||
|
; tzoffset: int: Timezone offset from GMT in seconds for sending Caller ID
|
||||||
|
; Positive to go East, negative to go West
|
||||||
|
; Examples: CET=3600, EST=-18000
|
||||||
|
; This parameter is reloadable
|
||||||
|
;tzoffset=0
|
||||||
|
|
||||||
|
|
||||||
[engine]
|
[engine]
|
||||||
; These parameters are used to initialize the MGCP Engine
|
; These parameters are used to initialize the MGCP Engine
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
const char* called = 0)
|
const char* called = 0)
|
||||||
{ m_caller = caller; m_callerName = callername; m_called = called; }
|
{ m_caller = caller; m_callerName = callername; m_called = called; }
|
||||||
// Set the caller, callername and called parameters
|
// Set the caller, callername and called parameters
|
||||||
void copyCall(Message& dest, bool privacy = false);
|
void copyCall(NamedList& dest, bool privacy = false);
|
||||||
// Fill a string with line status parameters
|
// Fill a string with line status parameters
|
||||||
void statusParams(String& str);
|
void statusParams(String& str);
|
||||||
// Fill a string with line status detail parameters
|
// Fill a string with line status detail parameters
|
||||||
|
@ -680,7 +680,7 @@ void ModuleLine::processNotify(Message& msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the caller, callername and called parameters
|
// Set the caller, callername and called parameters
|
||||||
void ModuleLine::copyCall(Message& dest, bool privacy)
|
void ModuleLine::copyCall(NamedList& dest, bool privacy)
|
||||||
{
|
{
|
||||||
if (privacy)
|
if (privacy)
|
||||||
dest.addParam("callerpres","restricted");
|
dest.addParam("callerpres","restricted");
|
||||||
|
@ -1409,7 +1409,15 @@ AnalogChannel::AnalogChannel(ModuleLine* line, Message* msg, RecordTrigger recor
|
||||||
m_privacy = getPrivacy(*msg);
|
m_privacy = getPrivacy(*msg);
|
||||||
if (m_callsetup == AnalogLine::Before)
|
if (m_callsetup == AnalogLine::Before)
|
||||||
m_line->sendCallSetup(m_privacy);
|
m_line->sendCallSetup(m_privacy);
|
||||||
m_line->sendEvent(SignallingCircuitEvent::RingBegin,AnalogLine::Dialing);
|
{
|
||||||
|
NamedList* params = 0;
|
||||||
|
NamedList callerId("");
|
||||||
|
if (m_callsetup != AnalogLine::NoCallSetup) {
|
||||||
|
params = &callerId;
|
||||||
|
m_line->copyCall(callerId,m_privacy);
|
||||||
|
}
|
||||||
|
m_line->sendEvent(SignallingCircuitEvent::RingBegin,AnalogLine::Dialing,params);
|
||||||
|
}
|
||||||
if (m_callsetup == AnalogLine::After)
|
if (m_callsetup == AnalogLine::After)
|
||||||
m_dialTimer.interval(500);
|
m_dialTimer.interval(500);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
using namespace TelEngine;
|
using namespace TelEngine;
|
||||||
namespace { // anonymous
|
namespace { // anonymous
|
||||||
|
@ -300,6 +301,7 @@ YSIGFACTORY2(MGCPSpan);
|
||||||
static YMGCPEngine* s_engine = 0;
|
static YMGCPEngine* s_engine = 0;
|
||||||
static MGCPEndpoint* s_endpoint = 0;
|
static MGCPEndpoint* s_endpoint = 0;
|
||||||
static String s_defaultEp;
|
static String s_defaultEp;
|
||||||
|
static int s_tzOffset = 0;
|
||||||
|
|
||||||
static MGCPPlugin splugin;
|
static MGCPPlugin splugin;
|
||||||
static ObjList s_wrappers;
|
static ObjList s_wrappers;
|
||||||
|
@ -1696,7 +1698,27 @@ bool MGCPCircuit::sendEvent(SignallingCircuitEvent::Type type, NamedList* params
|
||||||
setParams(*params);
|
setParams(*params);
|
||||||
return status(Connected,!params || params->getBoolValue("sync",true));
|
return status(Connected,!params || params->getBoolValue("sync",true));
|
||||||
case SignallingCircuitEvent::RingBegin:
|
case SignallingCircuitEvent::RingBegin:
|
||||||
return fxs() && sendPending("L/rg");
|
if (fxs()) {
|
||||||
|
String s("L/rg");
|
||||||
|
if (params) {
|
||||||
|
String number = params->getValue("caller");
|
||||||
|
String name = params->getValue("callername");
|
||||||
|
if (number || name) {
|
||||||
|
MimeHeaderLine::addQuotes(number);
|
||||||
|
MimeHeaderLine::addQuotes(name);
|
||||||
|
int year;
|
||||||
|
unsigned int month,day,hour,minutes,seconds;
|
||||||
|
int tzo = params->getIntValue("tzoffset",s_tzOffset);
|
||||||
|
Time::toDateTime(Time::secNow()+tzo,year,month,day,hour,minutes,seconds);
|
||||||
|
char buf[16];
|
||||||
|
::snprintf(buf,sizeof(buf),"%02u/%02u/%02u/%02u",month,day,hour,minutes);
|
||||||
|
buf[sizeof(buf)-1] = '\0';
|
||||||
|
s << ",L/ci(" << buf << "," << number << "," << name << ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sendPending(s);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
case SignallingCircuitEvent::RingEnd:
|
case SignallingCircuitEvent::RingEnd:
|
||||||
return sendPending();
|
return sendPending();
|
||||||
case SignallingCircuitEvent::Polarity:
|
case SignallingCircuitEvent::Polarity:
|
||||||
|
@ -1956,6 +1978,7 @@ void MGCPPlugin::initialize()
|
||||||
Output("Initializing module MGCP Call Agent");
|
Output("Initializing module MGCP Call Agent");
|
||||||
Configuration cfg(Engine::configFile("mgcpca"));
|
Configuration cfg(Engine::configFile("mgcpca"));
|
||||||
setup();
|
setup();
|
||||||
|
s_tzOffset = cfg.getIntValue("general","tzoffset",0);
|
||||||
NamedList* engSect = cfg.getSection("engine");
|
NamedList* engSect = cfg.getSection("engine");
|
||||||
if (s_engine && engSect)
|
if (s_engine && engSect)
|
||||||
s_engine->initialize(*engSect);
|
s_engine->initialize(*engSect);
|
||||||
|
|
Loading…
Reference in New Issue