1234567891011121314151617181920212223242526272829303132 |
- package action
- import (
- "errors"
- "fmt"
- "strings"
- )
- func PlaybackPacu(filename string, count int, delay int, PaType string) (err error) {
- Para := fmt.Sprintf("count=%d,filename=%s,delay=%d,priority=%s", count, strings.Replace(filename, ".wav", "", -1), delay, PaType)
- Chan := "Local/0500" //paging pacu
- action := map[string]string{
- "Action": "Originate",
- "Channel": Chan,
- "Exten": "000",
- "CallerID": PaType,
- "Context": "broadcast-playfile",
- "Priority": "1",
- "Variable": Para,
- }
- res, _, err := AminInstance.Send(action)
- if err != nil {
- return err
- }
- if res["Response"] != "Success" {
- return errors.New(res["Message"])
- }
- return nil
- }
|