Added configurable call controller location for Q.850 cause.

Diagnostic and location can now be set in release call Q.850 cause.
Merged branch paulc/pstn -r 3478:3480


git-svn-id: http://voip.null.ro/svn/yate@3490 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2010-08-21 18:25:02 +00:00
parent 0abe0e822a
commit 4c94538610
4 changed files with 63 additions and 14 deletions

View File

@ -364,6 +364,19 @@
; If not set calls that request continuity check will be rejected
;continuity=
; location: string: Exchange location to be set when sending Q.850 causes
; Available values are:
; U User
; LPN Private network serving the local user
; LN Public network serving the local user
; TN Transit network
; RLN Public network serving the remote user
; RPN Private network serving the remote user
; INTL International network
; BI Network beyond the interworking point
; A default 'BI' will be used if not set or invalid
;location=
; print-messages: boolean: Print decoded protocol data units to output
; This option is applied on reload
; Defaults to no

View File

@ -1664,19 +1664,22 @@ void SS7MsgISUP::toString(String& dest, const SS7Label& label, bool params,
// @param recvLbl True if the given label is from a received message. If true, a new routing
// label will be created from the received one
// @return Link the message was successfully queued to, negative for error
inline static int transmitREL(SS7ISUP* isup, unsigned int cic, const SS7Label& label, bool recvLbl,
const char* reason)
static int transmitREL(SS7ISUP* isup, unsigned int cic, const SS7Label& label, bool recvLbl,
const char* reason, const char* diagnostic = 0, const char* location = 0)
{
SS7MsgISUP* m = new SS7MsgISUP(SS7MsgISUP::REL,cic);
if (reason)
m->params().addParam("CauseIndicators",reason);
m->params().addParam("CauseIndicators.location",location,false);
m->params().addParam("CauseIndicators.diagnostic",diagnostic,false);
return isup->transmitMessage(m,label,recvLbl);
}
// Push down the protocol stack a RLC (Release Complete) message
// @param msg Optional received message to copy release parameters. Ignored if reason is valid
inline static int transmitRLC(SS7ISUP* isup, unsigned int cic, const SS7Label& label, bool recvLbl,
const char* reason = 0, const SS7MsgISUP* msg = 0)
static int transmitRLC(SS7ISUP* isup, unsigned int cic, const SS7Label& label, bool recvLbl,
const char* reason = 0, const SS7MsgISUP* msg = 0, const char* diagnostic = 0,
const char* location = 0)
{
SS7MsgISUP* m = new SS7MsgISUP(SS7MsgISUP::RLC,cic);
if (reason && *reason)
@ -1685,16 +1688,22 @@ inline static int transmitRLC(SS7ISUP* isup, unsigned int cic, const SS7Label& l
m->params().copyParam(((SS7MsgISUP*)msg)->params(),"CauseIndicators",'.');
else
m->params().addParam("CauseIndicators","normal-clearing");
m->params().addParam("CauseIndicators.location",location,false);
m->params().addParam("CauseIndicators.diagnostic",diagnostic,false);
return isup->transmitMessage(m,label,recvLbl);
}
// Push down the protocol stack a CNF (Confusion) message
inline static int transmitCNF(SS7ISUP* isup, unsigned int cic, const SS7Label& label, bool recvLbl,
const char* reason)
static int transmitCNF(SS7ISUP* isup, unsigned int cic, const SS7Label& label, bool recvLbl,
const char* reason, const char* diagnostic = 0, const char* location = 0)
{
SS7MsgISUP* m = new SS7MsgISUP(SS7MsgISUP::CNF,cic);
if (reason)
m->params().addParam("CauseIndicators",reason);
if (!location)
location = isup->location();
m->params().addParam("CauseIndicators.location",location,false);
m->params().addParam("CauseIndicators.diagnostic",diagnostic,false);
return isup->transmitMessage(m,label,recvLbl);
}
@ -2031,7 +2040,7 @@ SignallingEvent* SS7ISUPCall::releaseComplete(bool final, SS7MsgISUP* msg, const
if (m_state == Released)
return 0;
if (isup() && m_gracefully) {
int sls = transmitRLC(isup(),id(),m_label,false,m_reason);
int sls = transmitRLC(isup(),id(),m_label,false,m_reason,0,0,isup()->location());
if (sls != -1 && m_label.sls() == 255)
m_label.setSls(sls);
}
@ -2125,21 +2134,28 @@ bool SS7ISUPCall::release(SignallingEvent* event)
m_state = Releasing;
if (!isup())
return 0;
int sls = transmitREL(isup(),id(),m_label,false,m_reason);
int sls = transmitREL(isup(),id(),m_label,false,m_reason,m_diagnostic,m_location);
if (sls != -1 && m_label.sls() == 255)
m_label.setSls(sls);
return sls != -1;
}
// Set termination reason from received text or message
void SS7ISUPCall::setReason(const char* reason, SignallingMessage* msg)
void SS7ISUPCall::setReason(const char* reason, SignallingMessage* msg,
const char* diagnostic, const char* location)
{
if (!m_reason.null())
return;
if (reason)
if (reason) {
m_reason = reason;
else if (msg)
m_diagnostic = diagnostic;
m_location = location;
}
else if (msg) {
m_reason = msg->params().getValue("CauseIndicators",msg->params().getValue("reason"));
m_diagnostic = msg->params().getValue("CauseIndicators.diagnostic",diagnostic);
m_location = msg->params().getValue("CauseIndicators.location",location);
}
}
// Accept send/receive messages in current state based on call direction

View File

@ -55,6 +55,8 @@ SignallingCallControl::SignallingCallControl(const NamedList& params,
m_strategy(SignallingCircuitGroup::Increment),
m_exiting(false)
{
// Controller location
m_location = params.getValue("location");
// Strategy
const char* strategy = params.getValue("strategy","increment");
m_strategy = SignallingCircuitGroup::str2strategy(strategy);

View File

@ -914,6 +914,13 @@ public:
*/
virtual ~SignallingCallControl();
/**
* Retrieve Q.850 cause location
* @return Controller location
*/
inline const String& location() const
{ return m_location; }
/**
* Set exiting flag
*/
@ -1101,6 +1108,11 @@ protected:
*/
SignallingTimer m_verifyTimer;
/**
* Controller location used when encoding Q.850 cause
*/
String m_location;
private:
SignallingCircuitGroup* m_circuits; // Circuit group
int m_strategy; // Strategy to allocate circuits for outgoing calls
@ -7014,13 +7026,16 @@ public:
* Set termination flag. Set termination reason if not already set
* @param gracefully True to send RLC on termination, false to destroy the call without notification
* @param reason Termination reason
* @param diagnostic Optional diagnostic data to be sent with termination reason
* @param location Optional release location
*/
inline void setTerminate(bool gracefully, const char* reason = 0)
inline void setTerminate(bool gracefully, const char* reason = 0,
const char* diagnostic = 0, const char* location = 0)
{
Lock lock(this);
m_terminate = true;
m_gracefully = gracefully;
setReason(reason,0);
setReason(reason,0,diagnostic,location);
}
/**
@ -7085,7 +7100,8 @@ private:
// @return True if the message was pushed down the protocol stack
bool release(SignallingEvent* event = 0);
// Set termination reason from message or parameter
void setReason(const char* reason, SignallingMessage* msg);
void setReason(const char* reason, SignallingMessage* msg, const char* diagnostic = 0,
const char* location = 0);
// Accept send/receive messages in current state based on call direction
bool validMsgState(bool send, SS7MsgISUP::Type type);
// Connect the reserved circuit. Return false if it fails. Return true if this call is a signalling only one
@ -7116,6 +7132,8 @@ private:
bool m_inbandAvailable; // Inband data is available
String m_format; // Data format used by the circuit
String m_reason; // Termination reason
String m_diagnostic; // Termination diagnostic
String m_location; // Termination location
SS7MsgISUP* m_iamMsg; // Message with the call parameters for outgoing calls
SS7MsgISUP* m_sgmMsg; // Pending received message with segmentation flag set
// Timers