mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 15:48:44 +05:00
Processing cgr_ignorepark channel variable for SM-FreeSWITCH
This commit is contained in:
@@ -69,6 +69,7 @@ const (
|
||||
HANGUP_CAUSE = "Hangup-Cause"
|
||||
PDD_MEDIA_MS = "variable_progress_mediamsec"
|
||||
PDD_NOMEDIA_MS = "variable_progressmsec"
|
||||
IGNOREPARK = "variable_cgr_ignorepark"
|
||||
|
||||
VAR_CGR_DISCONNECT_CAUSE = "variable_" + utils.CGR_DISCONNECT_CAUSE
|
||||
)
|
||||
|
||||
@@ -191,19 +191,9 @@ func (sm *FSSessionManager) setCgrLcr(ev engine.Event, connId string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Sends the transfer command to unpark the call to freeswitch
|
||||
func (sm *FSSessionManager) unparkCall(uuid, connId, call_dest_nb, notify string) {
|
||||
_, err := sm.conns[connId].SendApiCmd(fmt.Sprintf("uuid_setvar %s cgr_notify %s\n\n", uuid, notify))
|
||||
if err != nil {
|
||||
engine.Logger.Err(fmt.Sprintf("<SM-FreeSWITCH> Could not send unpark api notification to freeswitch, error: <%s>, connId: %s", err.Error(), connId))
|
||||
}
|
||||
if _, err = sm.conns[connId].SendApiCmd(fmt.Sprintf("uuid_transfer %s %s\n\n", uuid, call_dest_nb)); err != nil {
|
||||
engine.Logger.Err(fmt.Sprintf("<SM-FreeSWITCH> Could not send unpark api call to freeswitch, error: <%s>, connId: %s", err.Error(), connId))
|
||||
}
|
||||
}
|
||||
|
||||
func (sm *FSSessionManager) onChannelPark(ev engine.Event, connId string) {
|
||||
if ev.GetReqType(utils.META_DEFAULT) == utils.META_NONE { // Do not process this request
|
||||
fsev := ev.(FSEvent)
|
||||
if ev.GetReqType(utils.META_DEFAULT) == utils.META_NONE || fsev[IGNOREPARK] == "true" { // Do not process this request
|
||||
return
|
||||
}
|
||||
var maxCallDuration float64 // This will be the maximum duration this channel will be allowed to last
|
||||
@@ -229,6 +219,17 @@ func (sm *FSSessionManager) onChannelPark(ev engine.Event, connId string) {
|
||||
sm.unparkCall(ev.GetUUID(), connId, ev.GetCallDestNr(utils.META_DEFAULT), AUTH_OK)
|
||||
}
|
||||
|
||||
// Sends the transfer command to unpark the call to freeswitch
|
||||
func (sm *FSSessionManager) unparkCall(uuid, connId, call_dest_nb, notify string) {
|
||||
_, err := sm.conns[connId].SendApiCmd(fmt.Sprintf("uuid_setvar %s cgr_notify %s\n\n", uuid, notify))
|
||||
if err != nil {
|
||||
engine.Logger.Err(fmt.Sprintf("<SM-FreeSWITCH> Could not send unpark api notification to freeswitch, error: <%s>, connId: %s", err.Error(), connId))
|
||||
}
|
||||
if _, err = sm.conns[connId].SendApiCmd(fmt.Sprintf("uuid_transfer %s %s\n\n", uuid, call_dest_nb)); err != nil {
|
||||
engine.Logger.Err(fmt.Sprintf("<SM-FreeSWITCH> Could not send unpark api call to freeswitch, error: <%s>, connId: %s", err.Error(), connId))
|
||||
}
|
||||
}
|
||||
|
||||
func (sm *FSSessionManager) onChannelAnswer(ev engine.Event, connId string) {
|
||||
if ev.GetReqType(utils.META_DEFAULT) == utils.META_NONE { // Do not process this request
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user