mirror of
				https://github.com/matrix-org/gomatrix
				synced 2025-11-04 06:18:05 +00:00 
			
		
		
		
	Merge pull request #29 from t3chguy/t3chguy/add_GET_voip_turnServer
add `GET /_matrix/client/r0/voip/turnServer`
This commit is contained in:
		
						commit
						1ed3413986
					
				
					 2 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -652,6 +652,14 @@ func (cli *Client) Messages(roomID, from, to string, dir rune, limit int) (resp
 | 
			
		|||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TurnServer returns turn server details and credentials for the client to use when initiating calls.
 | 
			
		||||
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-voip-turnserver
 | 
			
		||||
func (cli *Client) TurnServer() (resp *RespTurnServer, err error) {
 | 
			
		||||
	urlPath := cli.BuildURL("voip", "turnServer")
 | 
			
		||||
	_, err = cli.MakeRequest("GET", urlPath, nil, &resp)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func txnID() string {
 | 
			
		||||
	return "go" + strconv.FormatInt(time.Now().UnixNano(), 10)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -162,3 +162,10 @@ type RespSync struct {
 | 
			
		|||
		} `json:"invite"`
 | 
			
		||||
	} `json:"rooms"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type RespTurnServer struct {
 | 
			
		||||
	Username string   `json:"username"`
 | 
			
		||||
	Password string   `json:"password"`
 | 
			
		||||
	TTL      int      `json:"ttl"`
 | 
			
		||||
	URIs     []string `json:"uris"`
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue