mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 21:59:53 +05:00
Method to generate NewOsipsEvent
This commit is contained in:
@@ -46,6 +46,10 @@ const (
|
||||
OSIPS_DURATION = "duration"
|
||||
)
|
||||
|
||||
func NewOsipsEvent(osipsDagramEvent *osipsdagram.OsipsEvent) (*OsipsEvent, error) {
|
||||
return &OsipsEvent{osipsEvent: osipsDagramEvent}, nil
|
||||
}
|
||||
|
||||
type OsipsEvent struct {
|
||||
osipsEvent *osipsdagram.OsipsEvent
|
||||
}
|
||||
@@ -182,9 +186,6 @@ func (osipsev *OsipsEvent) GetExtraFields() map[string]string {
|
||||
extraFields[field] = val
|
||||
}
|
||||
}
|
||||
if len(extraFields) == 0 {
|
||||
return nil // No need of populating extra fields if no members defined
|
||||
}
|
||||
return extraFields
|
||||
}
|
||||
func (osipsEv *OsipsEvent) GetOriginatorIP() string {
|
||||
|
||||
@@ -75,6 +75,6 @@ func (osm *OsipsSessionManager) Shutdown() error {
|
||||
func (osm *OsipsSessionManager) OnCdr(cdrDagram *osipsdagram.OsipsEvent) {
|
||||
engine.Logger.Info(fmt.Sprintf("<SM-OpenSIPSr> Received cdr datagram: %+v", cdrDagram))
|
||||
var reply *string
|
||||
osipsEv := &OsipsEvent{osipsEvent: cdrDagram}
|
||||
osipsEv, _ := NewOsipsEvent(cdrDagram)
|
||||
osm.cdrsrv.ProcessCdr(osipsEv.AsStoredCdr(), reply)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user