Adding FreeSWITCH config file samples, small bug fixups introduced in FSEvent by me previously

This commit is contained in:
DanB
2013-03-31 17:50:20 +02:00
parent cbff5d5e90
commit f0eb970943
4 changed files with 68 additions and 5 deletions

View File

@@ -0,0 +1,36 @@
<!--
CGRateS config sample.
Add the bellow defined extensions to your own context before bridge application,
ignoring include and context defined here.
-->
<include>
<context name="cgrates">
<extension name="CGRateS_AuthPrepaid">
<condition field="${cgr_reqtype}" expression="^prepaid$" />
<condition field="${cgr_notify}" expression="^$">
<action application="park"/>
</condition>
</extension>
<extension name="CGRateS_AuthForbidden">
<condition field="${cgr_reqtype}" expression="prepaid" />
<condition field="${cgr_notify}" expression="^-INSUFFICIENT_FUNDS$">
<action application="playback" data="tone_stream://path=$${sounds_dir}/insufficient_funds.wav"/>
<action application="set" data="proto_specific_hangup_cause=sip:403"/>
</condition>
</extension>
<extension name="CGRateS_Error">
<condition field="${cgr_reqtype}" expression="^prepaid$" />
<condition field="${cgr_notify}" expression="^-SYSTEM_ERROR$">
<action application="set" data="proto_specific_hangup_cause=sip:503"/>
</condition>
</extension>
</context>
</include>

View File

@@ -0,0 +1,28 @@
<!--
CGRateS config sample.
Make default 1000 user prepaid by adding cgr_reqtype variable to your user.
-->
<include>
<user id="1000">
<!-- CGRateS config sample.
Make default 1000 user prepaid by adding cgr_reqtype variable to your user -->
<params>
<param name="password" value="$${default_password}"/>
<param name="vm-password" value="1000"/>
</params>
<variables>
<variable name="toll_allow" value="domestic,international,local"/>
<variable name="accountcode" value="1000"/>
<variable name="user_context" value="default"/>
<variable name="effective_caller_id_name" value="Extension 1000"/>
<variable name="effective_caller_id_number" value="1000"/>
<variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
<variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
<variable name="callgroup" value="techsupport"/>
<variable name="cgr_reqtype" value="prepaid"/>
</variables>
</user>
</include>

View File

@@ -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]

View File

@@ -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)