mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
SMGeneric returning SESSION_NOT_FOUND on init/update/terminate without session started, configuration updates for opensips_native tutorial
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
// Copyright (C) ITsysCOM GmbH
|
||||
|
||||
"general": {
|
||||
"default_request_type": "*prepaid",
|
||||
// "default_request_type": "*prepaid",
|
||||
},
|
||||
|
||||
"stor_db": {
|
||||
@@ -137,6 +137,7 @@
|
||||
|
||||
"sm_generic": {
|
||||
"enabled": true,
|
||||
"debit_interval": "10s",
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
# OpenSIPS-CGRateS out of residential configuration script
|
||||
# by OpenSIPS Solutions <team@opensips-solutions.com>
|
||||
#
|
||||
# This script was generated via "make menuconfig", from
|
||||
# the "Residential" scenario.
|
||||
# You can enable / disable more features / functionalities by
|
||||
# re-generating the scenario with different options.#
|
||||
#
|
||||
# Please refer to the Core CookBook at:
|
||||
# http://www.opensips.org/Resources/DocsCookbooks
|
||||
@@ -83,17 +79,6 @@ loadmodule "cgrates.so"
|
||||
modparam("cgrates", "cgrates_engine", "127.0.0.1:2012")
|
||||
|
||||
|
||||
#### ACCounting module
|
||||
loadmodule "acc.so"
|
||||
/* what special events should be accounted ? */
|
||||
modparam("acc", "early_media", 0)
|
||||
modparam("acc", "report_cancels", 0)
|
||||
/* by default we do not adjust the direct of the sequential requests.
|
||||
if you enable this parameter, be sure the enable "append_fromtag"
|
||||
in "rr" module */
|
||||
modparam("acc", "detect_direction", 0)
|
||||
|
||||
|
||||
#### UDP protocol
|
||||
loadmodule "proto_udp.so"
|
||||
|
||||
@@ -112,10 +97,7 @@ route{
|
||||
# take the path determined by record-routing
|
||||
if (loose_route()) {
|
||||
|
||||
if (is_method("BYE")) {
|
||||
# do accunting, even if the transaction fails
|
||||
do_accounting("log","failed");
|
||||
} else if (is_method("INVITE")) {
|
||||
if (is_method("INVITE")) {
|
||||
# even if in most of the cases is useless, do RR for
|
||||
# re-INVITEs alos, as some buggy clients do change route set
|
||||
# during the dialog.
|
||||
@@ -178,11 +160,6 @@ route{
|
||||
if (!is_method("REGISTER|MESSAGE"))
|
||||
record_route();
|
||||
|
||||
# account only INVITEs
|
||||
if (is_method("INVITE")) {
|
||||
do_accounting("log");
|
||||
}
|
||||
|
||||
if (!uri==myself) {
|
||||
route(relay);
|
||||
}
|
||||
@@ -214,6 +191,8 @@ route{
|
||||
}
|
||||
|
||||
# check auth with CGRateS
|
||||
#$cgr(Tenant) = $fd;
|
||||
#$cgr(RequestType) = "*prepaid";
|
||||
if (!async(cgrates_auth("$fU", "$rU"), resume_cgr_auth)) {
|
||||
sl_send_reply("503", "Service Unavailable");
|
||||
exit;
|
||||
@@ -236,6 +215,11 @@ route[relay] {
|
||||
}
|
||||
|
||||
route [resume_cgr_auth] {
|
||||
if ($rc < 0) {
|
||||
xlog("Call not authorized: code=$cgrret!\n");
|
||||
send_reply("403", "Forbidden");
|
||||
exit;
|
||||
}
|
||||
cgrates_acc("cdr|missed", "$fU", "$rU");
|
||||
route(relay);
|
||||
}
|
||||
|
||||
@@ -1042,13 +1042,16 @@ func (smg *SMGeneric) BiRPCV1GetLCRSuppliers(clnt rpcclient.RpcClientConnection,
|
||||
}
|
||||
|
||||
// Called on session start, returns the maximum number of seconds the session can last
|
||||
func (smg *SMGeneric) BiRPCV1InitiateSession(clnt rpcclient.RpcClientConnection, ev SMGenericEvent, maxUsage *float64) error {
|
||||
if minMaxUsage, err := smg.InitiateSession(ev, clnt); err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
func (smg *SMGeneric) BiRPCV1InitiateSession(clnt rpcclient.RpcClientConnection, ev SMGenericEvent, maxUsage *float64) (err error) {
|
||||
var minMaxUsage time.Duration
|
||||
if minMaxUsage, err = smg.InitiateSession(ev, clnt); err != nil {
|
||||
if err != rpcclient.ErrSessionNotFound {
|
||||
err = utils.NewErrServerError(err)
|
||||
}
|
||||
} else {
|
||||
*maxUsage = minMaxUsage.Seconds()
|
||||
}
|
||||
return nil
|
||||
return
|
||||
}
|
||||
|
||||
// Interim updates, returns remaining duration from the RALs
|
||||
|
||||
Reference in New Issue
Block a user