Adding initial alter_tables_rc5_rc6.sql, various test improvements

This commit is contained in:
DanB
2015-07-17 15:50:25 +02:00
parent 86ec33f0a3
commit 17e469b615
7 changed files with 62 additions and 12 deletions

View File

@@ -13,6 +13,8 @@
"store_cdrs": false, // store cdrs in storDb
"cdr_replication":[ // replicate the rated CDR to a number of servers
{"transport": "*http_jsonrpc", "server": "http://127.0.0.1:12080/jsonrpc"},
//{"transport": "*http_post", "server": "http://127.0.0.1:8000/mycdr"},
],
},

View File

@@ -0,0 +1,49 @@
USE `cgrates`;
ALTER TABLE `cdrs_primary`
CHANGE COLUMN tbid `id` int(11) NOT NULL auto_increment first ,
CHANGE `cgrid` `cgrid` char(40) NOT NULL after `id` ,
ADD COLUMN `pdd` decimal(12,9) NOT NULL after `setup_time` ,
CHANGE `answer_time` `answer_time` datetime NOT NULL after `pdd` ,
ADD COLUMN `supplier` varchar(128) NOT NULL after `usage` ,
ADD COLUMN `disconnect_cause` varchar(64) NOT NULL after `supplier` ,
ADD COLUMN `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP after `disconnect_cause` ,
ADD COLUMN `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' after `created_at` ,
ADD KEY `answer_time_idx`(`answer_time`) ,
ADD KEY `deleted_at_idx`(`deleted_at`) ,
DROP KEY `PRIMARY`, ADD PRIMARY KEY(`id`) ;
ALTER TABLE `cdrs_extra`
CHANGE COLUMN tbid `id` int(11) NOT NULL auto_increment first ,
CHANGE `cgrid` `cgrid` char(40) NOT NULL after `id` ,
ADD COLUMN `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP after `extra_fields` ,
ADD COLUMN `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' after `created_at`,
ADD UNIQUE KEY `cgrid`(`cgrid`) ,
ADD KEY `deleted_at_idx`(`deleted_at`) ,
DROP KEY `PRIMARY`, ADD PRIMARY KEY(`id`) ;
ALTER TABLE `cost_details`
CHANGE COLUMN tbid `id` int(11) NOT NULL auto_increment first ,
CHANGE `cost_source` `cost_source` varchar(64) NOT NULL after `timespans` ,
ADD COLUMN `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP after `cost_source` ,
ADD COLUMN `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' after `created_at` ,
ADD COLUMN `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' after `updated_at` ,
DROP COLUMN `cost_time` ,
ADD KEY `deleted_at_idx`(`deleted_at`) ,
DROP KEY `PRIMARY`, ADD PRIMARY KEY(`id`) ;
ALTER TABLE `rated_cdrs`
CHANGE COLUMN tbid `id` int(11) NOT NULL auto_increment first ,
CHANGE `cgrid` `cgrid` char(40) NOT NULL after `id` ,
CHANGE `category` `category` varchar(32) NOT NULL after `tenant` ,
ADD COLUMN `pdd` decimal(12,9) NOT NULL after `setup_time` ,
CHANGE `answer_time` `answer_time` datetime NOT NULL after `pdd` ,
ADD COLUMN `supplier` varchar(128) NOT NULL after `usage` ,
ADD COLUMN `disconnect_cause` varchar(64) NOT NULL after `supplier` ,
CHANGE `cost` `cost` decimal(20,4) NULL after `disconnect_cause` ,
ADD COLUMN `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP after `extra_info` ,
ADD COLUMN `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' after `created_at` ,
ADD COLUMN `deleted_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' after `updated_at` ,
DROP COLUMN `mediation_time` ,
ADD KEY `deleted_at_idx`(`deleted_at`) ,
DROP KEY `PRIMARY`, ADD PRIMARY KEY(`id`) ;

View File

@@ -69,7 +69,6 @@
"enabled": true, // starts SessionManager service: <true|false>
"rater": "internal", // address where to reach the Rater <""|internal|127.0.0.1:2013>
"cdrs": "internal", // address where to reach CDR Server, empty to disable CDR capturing <""|internal|x.y.z.y:1234>
"create_cdr": true, // create CDR out of events and sends them to CDRS component
"debit_interval": "5s", // interval to perform debits on.
"channel_sync_interval": "10s",
"connections":[ // instantiate connections to multiple FreeSWITCH servers

View File

@@ -121,8 +121,8 @@ type PjsuaAccount struct {
}
// Returns file reference where we can write to control pjsua in terminal
func StartPjsuaListener(acnts []*PjsuaAccount, waitMs int) (*os.File, error) {
cmdArgs := []string{"--local-port=5070", "--null-audio", "--auto-answer=200", "--max-calls=32", "--app-log-level=0"}
func StartPjsuaListener(acnts []*PjsuaAccount, localPort, waitMs int) (*os.File, error) {
cmdArgs := []string{fmt.Sprintf("--local-port=%d", localPort), "--null-audio", "--auto-answer=200", "--max-calls=32", "--app-log-level=0"}
for idx, acnt := range acnts {
if idx != 0 {
cmdArgs = append(cmdArgs, "--next-account")

View File

@@ -187,7 +187,7 @@ func TestTutFsCallsStartPjsuaListener(t *testing.T) {
&engine.PjsuaAccount{Id: "sip:1004@127.0.0.1", Username: "1004", Password: "1234", Realm: "*", Registrar: "sip:127.0.0.1:25060"},
&engine.PjsuaAccount{Id: "sip:1006@127.0.0.1", Username: "1006", Password: "1234", Realm: "*", Registrar: "sip:127.0.0.1:25060"},
&engine.PjsuaAccount{Id: "sip:1007@127.0.0.1", Username: "1007", Password: "1234", Realm: "*", Registrar: "sip:127.0.0.1:25060"}}
if tutFsCallsPjSuaListener, err = engine.StartPjsuaListener(acnts, *waitRater); err != nil {
if tutFsCallsPjSuaListener, err = engine.StartPjsuaListener(acnts, 5070, *waitRater); err != nil {
t.Fatal(err)
}
}
@@ -296,7 +296,7 @@ func TestTutFsCallsCdrs(t *testing.T) {
t.Error("Unexpected number of CDRs returned: ", len(reply))
} else {
cgrId = reply[0].CgrId
if reply[0].CdrSource != "FS_CHANNEL_HANGUP_COMPLETE" {
if reply[0].CdrSource != "freeswitch_json" {
t.Errorf("Unexpected CdrSource for CDR: %+v", reply[0])
}
if reply[0].ReqType != utils.META_PREPAID {
@@ -358,7 +358,7 @@ func TestTutFsCallsCdrs(t *testing.T) {
} else if len(reply) != 1 {
t.Error("Unexpected number of CDRs returned: ", len(reply))
} else {
if reply[0].CdrSource != "FS_CHANNEL_HANGUP_COMPLETE" {
if reply[0].CdrSource != "freeswitch_json" {
t.Errorf("Unexpected CdrSource for CDR: %+v", reply[0])
}
if reply[0].ReqType != utils.META_POSTPAID {
@@ -377,7 +377,7 @@ func TestTutFsCallsCdrs(t *testing.T) {
} else if len(reply) != 1 {
t.Error("Unexpected number of CDRs returned: ", len(reply))
} else {
if reply[0].CdrSource != "FS_CHANNEL_HANGUP_COMPLETE" {
if reply[0].CdrSource != "freeswitch_json" {
t.Errorf("Unexpected CdrSource for CDR: %+v", reply[0])
}
if reply[0].ReqType != utils.META_PSEUDOPREPAID {
@@ -396,7 +396,7 @@ func TestTutFsCallsCdrs(t *testing.T) {
} else if len(reply) != 1 {
t.Error("Unexpected number of CDRs returned: ", len(reply))
} else {
if reply[0].CdrSource != "FS_CHANNEL_HANGUP_COMPLETE" {
if reply[0].CdrSource != "freeswitch_json" {
t.Errorf("Unexpected CdrSource for CDR: %+v", reply[0])
}
if reply[0].ReqType != utils.META_RATED {
@@ -415,7 +415,7 @@ func TestTutFsCallsCdrs(t *testing.T) {
} else if len(reply) != 1 {
t.Error("Unexpected number of CDRs returned: ", len(reply))
} else {
if reply[0].CdrSource != "FS_CHANNEL_HANGUP_COMPLETE" {
if reply[0].CdrSource != "freeswitch_json" {
t.Errorf("Unexpected CdrSource for CDR: %+v", reply[0])
}
if reply[0].ReqType != utils.META_PREPAID {
@@ -437,7 +437,7 @@ func TestTutFsCallsCdrs(t *testing.T) {
} else if len(reply) != 1 {
t.Error("Unexpected number of CDRs returned: ", len(reply))
} else {
if reply[0].CdrSource != "FS_CHANNEL_HANGUP_COMPLETE" {
if reply[0].CdrSource != "freeswitch_json" {
t.Errorf("Unexpected CdrSource for CDR: %+v", reply[0])
}
if reply[0].ReqType != utils.META_PREPAID {

View File

@@ -237,7 +237,7 @@ func TestTutKamCallsStartPjsuaListener(t *testing.T) {
&engine.PjsuaAccount{Id: "sip:1004@127.0.0.1", Username: "1004", Password: "CGRateS.org", Realm: "*", Registrar: "sip:127.0.0.1:5060"},
&engine.PjsuaAccount{Id: "sip:1006@127.0.0.1", Username: "1006", Password: "CGRateS.org", Realm: "*", Registrar: "sip:127.0.0.1:5060"},
&engine.PjsuaAccount{Id: "sip:1007@127.0.0.1", Username: "1007", Password: "CGRateS.org", Realm: "*", Registrar: "sip:127.0.0.1:5060"}}
if tutKamCallsPjSuaListener, err = engine.StartPjsuaListener(acnts, *waitRater); err != nil {
if tutKamCallsPjSuaListener, err = engine.StartPjsuaListener(acnts, 5070, *waitRater); err != nil {
t.Fatal(err)
}
}

View File

@@ -187,7 +187,7 @@ func TestTutOsipsCallsStartPjsuaListener(t *testing.T) {
&engine.PjsuaAccount{Id: "sip:1004@127.0.0.1", Username: "1004", Password: "CGRateS.org", Realm: "*", Registrar: "sip:127.0.0.1:5060"},
&engine.PjsuaAccount{Id: "sip:1006@127.0.0.1", Username: "1006", Password: "CGRateS.org", Realm: "*", Registrar: "sip:127.0.0.1:5060"},
&engine.PjsuaAccount{Id: "sip:1007@127.0.0.1", Username: "1007", Password: "CGRateS.org", Realm: "*", Registrar: "sip:127.0.0.1:5060"}}
if tutOsipsCallsPjSuaListener, err = engine.StartPjsuaListener(acnts, *waitRater); err != nil {
if tutOsipsCallsPjSuaListener, err = engine.StartPjsuaListener(acnts, 5070, *waitRater); err != nil {
t.Fatal(err)
}
}