Skip to content

Commit

Permalink
sipexer: cli option to send cancel request
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Aug 5, 2024
1 parent fb2c482 commit 3650f98
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sipexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ type CLIOptions struct {
subscribe bool
publish bool
notify bool
cancel bool
ruri string
ruser string
fuser string
Expand Down Expand Up @@ -386,6 +387,7 @@ var cliops = CLIOptions{
subscribe: false,
publish: false,
notify: false,
cancel: false,
registerparty: false,
raw: false,
noparse: false,
Expand Down Expand Up @@ -554,6 +556,7 @@ func init() {
flag.BoolVar(&cliops.publish, "publish", cliops.publish, "set method to PUBLISH")
flag.BoolVar(&cliops.subscribe, "subscribe", cliops.subscribe, "set method to SUBSCRIBE")
flag.BoolVar(&cliops.notify, "notify", cliops.notify, "set method to NOTIFY")
flag.BoolVar(&cliops.cancel, "cancel", cliops.cancel, "set method to CANCEL")
flag.BoolVar(&cliops.contactbuild, "contact-build", cliops.contactbuild, "build contact header based on local address")
flag.BoolVar(&cliops.contactbuild, "cb", cliops.contactbuild, "build contact header based on local address")
flag.BoolVar(&cliops.registerparty, "register-party", cliops.registerparty, "register a third party To user")
Expand Down Expand Up @@ -1079,6 +1082,8 @@ func SIPExerPrepareTemplateFields(tplfields map[string]interface{}) int {
tplfields["method"] = "PUBLISH"
} else if cliops.notify {
tplfields["method"] = "NOTIFY"
} else if cliops.cancel {
tplfields["method"] = "CANCEL"
} else if len(cliops.method) > 0 {
tplfields["method"] = strings.ToUpper(cliops.method)
}
Expand Down

0 comments on commit 3650f98

Please sign in to comment.