Commit ccae4c34 by usual2970

增加取消通话功能,并将接口转为正式环境

parent 5eeb914f
......@@ -10,7 +10,7 @@ func main() {
tel := tel.NewTel("15000000000", "15000000000")
//var resp request.Resp
resp,err:=tel.Dial()
resp,err:=tel.Cancel("4aba567dff569ea3bf51e977d3907256")
if err!=nil{
fmt.Println(err)
}
......
......@@ -25,6 +25,7 @@ type Resp struct {
Code string `json:"code"`
Description string `json:"description"`
Sessionid string `json:"sessionid"`
Status string `json:"status"`
}
func (clt *Client) AppKey() string {
......
......@@ -5,9 +5,10 @@ var AppSecret = "7b90b109fc059f03"
var DispayNumber = "+8657156150625"
var CallbackUrl = "aHR0cDovL2gueWlkaWFubGluZy5jb20vbGlzdGVuL2NiLWNt"
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 DiaHost="aep.test.sdp.com"
var DiaHost="aep.sdp.com"
func GetAppKey() string{
return AppKey
......
......@@ -16,6 +16,12 @@ type Params struct {
StatusURL string `json:"statusURL"`
}
type CancelParams struct{
DeveloperCDR string `json:"developerCDR"`
Sessionid string `json:"sessionid"`
}
type Tel struct {
SessionId string
Params *Params
......@@ -50,8 +56,20 @@ func (t *Tel) Dial() (resp request.Resp,err error) {
return
}
func (t *Tel) Cancel() interface{} {
return ""
func (t *Tel) Cancel(sessionid string) (resp request.Resp,err error) {
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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment