Finish call test for Kamailio

This commit is contained in:
TeoV
2018-04-24 08:45:57 -04:00
committed by Dan Christian Bogos
parent e82d9f41f8
commit bbc2f5d90a
8 changed files with 12 additions and 6 deletions

View File

@@ -124,6 +124,7 @@ func (kev KamEvent) AsMapStringInterface() (mp map[string]interface{}) {
mp[k] = v
}
}
mp[utils.EVENT_NAME] = utils.KamailioAgent
return
}

View File

@@ -86,7 +86,7 @@
"kamailio_agent": {
"enabled": true,
"evapi_conns":[ // instantiate connections to multiple Kamailio servers
{"address": "192.168.56.203:8448", "reconnects": 5}
{"address": "127.0.0.1:8448", "reconnects": 5}
],
"sessions_conns": [
{"address": "*internal"} // connection towards session service: <*internal>

View File

@@ -61,7 +61,7 @@ loadmodule "outbound.so"
# ----------------- setting module-specific parameters ---------------
modparam("evapi", "bind_addr", "192.168.56.203:8448")
modparam("evapi", "bind_addr", "127.0.0.1:8448")
# ----- tm params -----
modparam("tm", "failure_reply_mode", 3)

View File

@@ -530,9 +530,9 @@ func (rS *ResourceService) processThresholds(r *Resource) (err error) {
// V1ResourcesForEvent returns active resource configs matching the event
func (rS *ResourceService) V1ResourcesForEvent(args utils.ArgRSv1ResourceUsage, reply *Resources) (err error) {
if missing := utils.MissingStructFields(args, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
if missing := utils.MissingStructFields(&args.CGREvent, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
} else if args.CGREvent.Event == nil {
} else if args.Event == nil {
return utils.NewErrMandatoryIeMissing("Event")
}
var mtcRLs Resources

View File

@@ -224,6 +224,7 @@ func testCallCheckResourceBeforeAllocation(t *testing.T) {
args := &utils.ArgRSv1ResourceUsage{
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "ResourceEvent",
Event: map[string]interface{}{
utils.Account: "1001",
utils.Subject: "1001",
@@ -346,6 +347,7 @@ func testCallCheckResourceAllocation(t *testing.T) {
args := &utils.ArgRSv1ResourceUsage{
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "ResourceAllocation",
Event: map[string]interface{}{
utils.Account: "1001",
utils.Subject: "1001",
@@ -456,6 +458,7 @@ func testCallCheckResourceRelease(t *testing.T) {
args := &utils.ArgRSv1ResourceUsage{
CGREvent: utils.CGREvent{
Tenant: "cgrates.org",
ID: "ResourceRelease",
Event: map[string]interface{}{
utils.Account: "1001",
utils.Subject: "1001",

View File

@@ -709,7 +709,7 @@ func (smg *SMGeneric) GetMaxUsage(gev SMGenericEvent) (maxUsage time.Duration, e
return
}
maxUsage = time.Duration(maxDur)
if maxUsage != time.Duration(-1*time.Second) &&
if maxUsage != time.Duration(-1) &&
maxUsage < smg.cgrCfg.SessionSCfg().MinCallDuration {
return 0, errors.New("UNAUTHORIZED_MIN_DURATION")
}

View File

@@ -310,6 +310,7 @@ func (self SMGenericEvent) GetOriginatorIP(fieldName string) string {
}
func (self SMGenericEvent) GetCdrSource() string {
fmt.Printf("Event %+v\n", self)
return utils.SMG + "_" + self.GetName()
}

View File

@@ -794,7 +794,8 @@ func RPCCall(inst interface{}, serviceMethod string, args interface{}, reply int
if len(methodSplit) != 2 {
return rpcclient.ErrUnsupporteServiceMethod
}
method := reflect.ValueOf(inst).MethodByName(methodSplit[0][len(methodSplit[0])-2:] + methodSplit[1])
method := reflect.ValueOf(inst).MethodByName(
strings.ToUpper(methodSplit[0][len(methodSplit[0])-2:]) + methodSplit[1])
if !method.IsValid() {
return rpcclient.ErrUnsupporteServiceMethod
}