mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add & improve priority of DlgList variables for Kamailio
This commit is contained in:
committed by
Dan Christian Bogos
parent
44b144ff02
commit
10443b4251
@@ -251,11 +251,25 @@ func (ka *KamailioAgent) onDlgList(evData []byte, connIdx int) {
|
||||
return
|
||||
}
|
||||
var sIDs []*sessions.SessionID
|
||||
// FixMe: find way to add OriginHost from event also, to be compatible with above implementation
|
||||
for _, dlgInfo := range kamDlgRpl.Jsonrpl_body.Result {
|
||||
var originHost, originID string
|
||||
for _, variable := range dlgInfo.Variables {
|
||||
if variable.CgrOriginHost != "" {
|
||||
originHost = variable.CgrOriginHost
|
||||
}
|
||||
if variable.CgrOriginID != "" {
|
||||
originID = variable.CgrOriginID
|
||||
}
|
||||
}
|
||||
if originHost == utils.EmptyString {
|
||||
originHost = ka.conns[connIdx].RemoteAddr().String()
|
||||
}
|
||||
if originID == utils.EmptyString {
|
||||
originID = dlgInfo.CallId + ";" + dlgInfo.Caller.Tag
|
||||
}
|
||||
sIDs = append(sIDs, &sessions.SessionID{
|
||||
OriginHost: ka.conns[connIdx].RemoteAddr().String(),
|
||||
OriginID: dlgInfo.CallId + ";" + dlgInfo.Caller.Tag,
|
||||
OriginHost: originHost,
|
||||
OriginID: originID,
|
||||
})
|
||||
}
|
||||
ka.activeSessionIDs <- sIDs
|
||||
|
||||
@@ -434,8 +434,12 @@ type kamJsonDlgBody struct {
|
||||
}
|
||||
|
||||
type kamDlgInfo struct {
|
||||
CallId string `json:"call-id"`
|
||||
Caller *kamCallerDlg
|
||||
CallId string `json:"call-id"`
|
||||
Caller *kamCallerDlg
|
||||
Variables []struct {
|
||||
CgrOriginID string `json:"cgrOriginID,omitempty"`
|
||||
CgrOriginHost string `json:"cgrOriginHost,omitempty"`
|
||||
} `json:"variables"`
|
||||
}
|
||||
|
||||
type kamCallerDlg struct {
|
||||
|
||||
@@ -161,6 +161,7 @@ route[CGR_CALL_START] {
|
||||
\"h_id\":\"$dlg(h_id)\",
|
||||
\"cgr_flags\":\"*attributes;*accounts;*resources;*thresholds\",
|
||||
\"OriginID\":\"$dlg_var(cgrOriginID)\",
|
||||
\"OriginHost\":\"$dlg_var(cgrOriginHost)\",
|
||||
\"RequestType\":\"$dlg_var(cgrReqType)\",
|
||||
\"Tenant\":\"$dlg_var(cgrTenant)\",
|
||||
\"Account\":\"$dlg_var(cgrAccount)\",
|
||||
@@ -180,6 +181,7 @@ route[CGR_CALL_END] {
|
||||
evapi_relay("{\"event\":\"CGR_CALL_END\",
|
||||
\"cgr_flags\":\"*accounts;*resources\",
|
||||
\"OriginID\":\"$dlg_var(cgrOriginID)\",
|
||||
\"OriginHost\":\"$dlg_var(cgrOriginHost)\",
|
||||
\"RequestType\":\"$dlg_var(cgrReqType)\",
|
||||
\"Tenant\":\"$dlg_var(cgrTenant)\",
|
||||
\"Account\":\"$dlg_var(cgrAccount)\",
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
debug=2
|
||||
log_stderror=no
|
||||
|
||||
listen=udp:enp0s3:5060
|
||||
listen=udp:enp0s8:5060
|
||||
listen=udp:127.0.0.1:5080
|
||||
listen=udp:127.0.0.1:5060
|
||||
listen=udp:enp0s3:5080
|
||||
listen=udp:enp0s8:5080
|
||||
|
||||
memdbg=5
|
||||
memlog=5
|
||||
@@ -210,7 +210,8 @@ route[CGRATES_SESSIONAUTH_REPLY] {
|
||||
# cannot initialize the dialog sooner due to AUTH
|
||||
dlg_manage();
|
||||
$dlg_var(SetupTime) = $TS;
|
||||
$dlg_var(cgrOriginID) = $dlg(callid) + ";" + $dlg(from_tag);
|
||||
$dlg_var(cgrOriginID) = $dlg(callid);
|
||||
$dlg_var(cgrOriginHost) = "127.0.0.1";
|
||||
$dlg_var(cgrTenant) = "cgrates.org";
|
||||
$dlg_var(cgrReqType) = $avp(RequestType);
|
||||
$dlg_var(cgrAccount) = $fU;
|
||||
|
||||
@@ -210,7 +210,7 @@ route[CGRATES_SESSIONAUTH_REPLY] {
|
||||
# cannot initialize the dialog sooner due to AUTH
|
||||
dlg_manage();
|
||||
$dlg_var(SetupTime) = $TS;
|
||||
$dlg_var(cgrOriginID) = $dlg(callid) + ";" + $dlg(from_tag);
|
||||
$dlg_var(cgrOriginID) = $dlg(callid);
|
||||
$dlg_var(cgrTenant) = "cgrates.org";
|
||||
$dlg_var(cgrReqType) = $avp(RequestType);
|
||||
$dlg_var(cgrAccount) = $fU;
|
||||
|
||||
Reference in New Issue
Block a user