Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
util
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘旋尧
util
Commits
ccae4c34
Commit
ccae4c34
authored
Jul 21, 2016
by
usual2970
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加取消通话功能,并将接口转为正式环境
parent
5eeb914f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
5 deletions
+25
-5
main.go
main.go
+1
-1
client.go
request/client.go
+1
-0
conf.go
tel/conf.go
+3
-2
tel.go
tel/tel.go
+20
-2
No files found.
main.go
View file @
ccae4c34
...
@@ -10,7 +10,7 @@ func main() {
...
@@ -10,7 +10,7 @@ func main() {
tel
:=
tel
.
NewTel
(
"15000000000"
,
"15000000000"
)
tel
:=
tel
.
NewTel
(
"15000000000"
,
"15000000000"
)
//var resp request.Resp
//var resp request.Resp
resp
,
err
:=
tel
.
Dial
(
)
resp
,
err
:=
tel
.
Cancel
(
"4aba567dff569ea3bf51e977d3907256"
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
err
)
fmt
.
Println
(
err
)
}
}
...
...
request/client.go
View file @
ccae4c34
...
@@ -25,6 +25,7 @@ type Resp struct {
...
@@ -25,6 +25,7 @@ type Resp struct {
Code
string
`json:"code"`
Code
string
`json:"code"`
Description
string
`json:"description"`
Description
string
`json:"description"`
Sessionid
string
`json:"sessionid"`
Sessionid
string
`json:"sessionid"`
Status
string
`json:"status"`
}
}
func
(
clt
*
Client
)
AppKey
()
string
{
func
(
clt
*
Client
)
AppKey
()
string
{
...
...
tel/conf.go
View file @
ccae4c34
...
@@ -5,9 +5,10 @@ var AppSecret = "7b90b109fc059f03"
...
@@ -5,9 +5,10 @@ var AppSecret = "7b90b109fc059f03"
var
DispayNumber
=
"+8657156150625"
var
DispayNumber
=
"+8657156150625"
var
CallbackUrl
=
"aHR0cDovL2gueWlkaWFubGluZy5jb20vbGlzdGVuL2NiLWNt"
var
CallbackUrl
=
"aHR0cDovL2gueWlkaWFubGluZy5jb20vbGlzdGVuL2NiLWNt"
var
CerPath
=
"/var/www/yidianling/common/components/yunxun/iSimularClient.pem"
var
CerPath
=
"/var/www/yidianling/common/components/yunxun/iSimularClient.pem"
var
DialUrl
=
"https://aep.test.sdp.com:1101/tropo/click2CallEx/v1"
var
DialUrl
=
"https://aep.sdp.com:1101/tropo/click2CallEx/v1"
var
CancelUrl
=
"https://aep.sdp.com:1101/tropo/callStopEx/v1"
//var DialUrl="http://h.yidianling.com"
//var DialUrl="http://h.yidianling.com"
var
DiaHost
=
"aep.
test.
sdp.com"
var
DiaHost
=
"aep.sdp.com"
func
GetAppKey
()
string
{
func
GetAppKey
()
string
{
return
AppKey
return
AppKey
...
...
tel/tel.go
View file @
ccae4c34
...
@@ -16,6 +16,12 @@ type Params struct {
...
@@ -16,6 +16,12 @@ type Params struct {
StatusURL
string
`json:"statusURL"`
StatusURL
string
`json:"statusURL"`
}
}
type
CancelParams
struct
{
DeveloperCDR
string
`json:"developerCDR"`
Sessionid
string
`json:"sessionid"`
}
type
Tel
struct
{
type
Tel
struct
{
SessionId
string
SessionId
string
Params
*
Params
Params
*
Params
...
@@ -50,8 +56,20 @@ func (t *Tel) Dial() (resp request.Resp,err error) {
...
@@ -50,8 +56,20 @@ func (t *Tel) Dial() (resp request.Resp,err error) {
return
return
}
}
func
(
t
*
Tel
)
Cancel
()
interface
{}
{
func
(
t
*
Tel
)
Cancel
(
sessionid
string
)
(
resp
request
.
Resp
,
err
error
)
{
return
""
tlsClient
,
err
:=
request
.
NewTLSHttpClientSingle
(
CerPath
)
if
err
!=
nil
{
return
}
cancelParams
:=
CancelParams
{
"yidianlingTelCancel"
,
sessionid
}
client
:=
request
.
NewClient
(
AppKey
,
AppSecret
,
tlsClient
)
if
resp
,
err
=
client
.
Post
(
CancelUrl
,
cancelParams
);
err
!=
nil
{
fmt
.
Println
(
err
)
}
return
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment