-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move UserAgent setting to SipStack, and add original recipient to ses…
…sion.makeRequest.
- Loading branch information
1 parent
e97754f
commit 0c1b23c
Showing
7 changed files
with
64 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,10 @@ func createUdp() *rtp.RtpUDPStream { | |
func main() { | ||
stop := make(chan os.Signal, 1) | ||
signal.Notify(stop, syscall.SIGTERM, syscall.SIGINT) | ||
stack := stack.NewSipStack(&stack.SipStackConfig{Extensions: []string{"replaces", "outbound"}, Dns: "8.8.8.8"}, logger) | ||
stack := stack.NewSipStack(&stack.SipStackConfig{ | ||
UserAgent: "Go Sip Client/example-client", | ||
Extensions: []string{"replaces", "outbound"}, | ||
Dns: "8.8.8.8"}, logger) | ||
|
||
listen := "0.0.0.0:5080" | ||
logger.Infof("Listen => %s", listen) | ||
|
@@ -62,8 +65,7 @@ func main() { | |
} | ||
|
||
ua := ua.NewUserAgent(&ua.UserAgentConfig{ | ||
UserAgent: "Go Sip Client/1.0.0", | ||
SipStack: stack, | ||
SipStack: stack, | ||
}, logger) | ||
|
||
ua.InviteStateHandler = func(sess *session.Session, req *sip.Request, resp *sip.Response, state session.Status) { | ||
|
@@ -94,7 +96,7 @@ func main() { | |
logger.Error(err) | ||
} | ||
|
||
profile := account.NewProfile(uri.Clone(), "goSIP", | ||
profile := account.NewProfile(uri.Clone(), "goSIP/example-client", | ||
&account.AuthInfo{ | ||
AuthUser: "100", | ||
Password: "100", | ||
|
@@ -104,7 +106,7 @@ func main() { | |
stack, | ||
) | ||
|
||
recipient, err := parser.ParseSipUri("sip:[email protected]:5060;transport=udp") | ||
recipient, err := parser.ParseSipUri("sip:[email protected]:5081;transport=wss") | ||
if err != nil { | ||
logger.Error(err) | ||
} | ||
|
@@ -121,10 +123,11 @@ func main() { | |
logger.Error(err) | ||
} | ||
|
||
recipient, err = parser.ParseSipUri("sip:[email protected]:5060;transport=udp") | ||
recipient, err = parser.ParseSipUri("sip:[email protected]:5081;transport=wss") | ||
if err != nil { | ||
logger.Error(err) | ||
} | ||
|
||
go ua.Invite(profile, called, recipient, &sdp) | ||
|
||
<-stop | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters