From f0eb97094361b9b334c8a9503645438fa1fe7cf6 Mon Sep 17 00:00:00 2001 From: DanB Date: Sun, 31 Mar 2013 17:50:20 +0200 Subject: [PATCH] Adding FreeSWITCH config file samples, small bug fixups introduced in FSEvent by me previously --- .../freeswitch/conf/dialplan/cgr_dialplan.xml | 36 +++++++++++++++++++ .../conf/directory/default/1000.xml | 28 +++++++++++++++ sessionmanager/fsevent.go | 7 ++-- sessionmanager/fssessionmanager.go | 2 +- 4 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 data/freeswitch/conf/dialplan/cgr_dialplan.xml create mode 100644 data/freeswitch/conf/directory/default/1000.xml diff --git a/data/freeswitch/conf/dialplan/cgr_dialplan.xml b/data/freeswitch/conf/dialplan/cgr_dialplan.xml new file mode 100644 index 000000000..694accf2c --- /dev/null +++ b/data/freeswitch/conf/dialplan/cgr_dialplan.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/freeswitch/conf/directory/default/1000.xml b/data/freeswitch/conf/directory/default/1000.xml new file mode 100644 index 000000000..d654f0ef3 --- /dev/null +++ b/data/freeswitch/conf/directory/default/1000.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sessionmanager/fsevent.go b/sessionmanager/fsevent.go index edf7f796c..a59e24abb 100644 --- a/sessionmanager/fsevent.go +++ b/sessionmanager/fsevent.go @@ -59,8 +59,7 @@ const ( MISSING_PARAMETER = "-MISSING_PARAMETER" SYSTEM_ERROR = "-SYSTEM_ERROR" MANAGER_REQUEST = "+MANAGER_REQUEST" - USERNAME = "username" - REQ_USER = "sip_req_user" + USERNAME = "Caller-Username" TOR_DEFAULT = "0" CSTMID_DEFAULT = "0" ) @@ -102,13 +101,13 @@ func (fsev *FSEvent) GetDestination() string { return firstNonEmpty( []string{fsev.fields[DESTINATION], fsev.fields[CALL_DEST_NR]} ) } func (fsev *FSEvent) GetTOR() string { - return firstNonEmpty( []string{fsev.fields[TOR], fsev.fields[TOR_DEFAULT]} ) + return firstNonEmpty( []string{fsev.fields[TOR], TOR_DEFAULT} ) } func (fsev *FSEvent) GetUUID() string { return fsev.fields[UUID] } func (fsev *FSEvent) GetTenant() string { - return firstNonEmpty( []string{fsev.fields[CSTMID], fsev.fields[CSTMID_DEFAULT]} ) + return firstNonEmpty( []string{fsev.fields[CSTMID], CSTMID_DEFAULT} ) } func (fsev *FSEvent) GetCallDestNr() string { return fsev.fields[CALL_DEST_NR] diff --git a/sessionmanager/fssessionmanager.go b/sessionmanager/fssessionmanager.go index 29b76d35a..36de7d4a5 100644 --- a/sessionmanager/fssessionmanager.go +++ b/sessionmanager/fssessionmanager.go @@ -311,7 +311,7 @@ func (sm *FSSessionManager) LoopAction(s *Session, cd *rater.CallDescriptor) { } if remainingSeconds == 0 || err != nil { rater.Logger.Info(fmt.Sprintf("No credit left: Disconnect %v", s)) - sm.DisconnectSession(s, DISCONNECT) + sm.DisconnectSession(s, INSUFFICIENT_FUNDS) return } s.CallCosts = append(s.CallCosts, cc)