We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
# 用途: # 查询阿里云语音服务返回的 CallId 140624706211^127376251211 # 看看返回什么数据 # 如何运行: # rails runner ./test/aliyun_call_id.rb require "aliyun-rails" # 实例化对象 client = RPCClient.new( endpoint: "http://dyvmsapi.aliyuncs.com", api_version: "2017-05-25", access_key_id: ENV['ACCESS_KEY_ID'], access_key_secret: ENV['ACCESS_KEY_SECRET'], security_token: 'TOKEN_KEY' ) current_time = Time.now time_24_hours_ago = current_time - (24 * 60 * 60) timestamp_ms_24_hours_ago = (time_24_hours_ago.to_f * 1000).to_i # 请求接口查询 params = { CallId: '140623874256^127375419257', # 通话的唯一识别ID。 ProdId: "11000000300006", # 产品ID。取值:11000000300006:语音通知。 QueryDate: timestamp_ms_24_hours_ago # 查询指定通话发生的时间。格式为Unix时间戳,单位:毫秒 # 查询指定时间点对应的24小时的记录。例如您输入2022.11.21 20:00:01,系统会查询2022.11.21 20:00:01~2022.11.22 20:00:01时间段内指定callid的呼叫记录。 } request_option = { method: 'POST', timeout: 15000 } response = client.request( action: 'QueryCallDetailByCallId', params: params, opts: request_option ) # puts response # {"Message"=>"OK", "RequestId"=>"7D1CB54D-E084-5B4D-B710-92B8552A40CE", "Data"=>"{\"callId\":\"140624706211^127376251211\",\"endDate\":\"2024-02-23 23:45:25\",\"stateDesc\":\"用户接听\",\"callee\":\"13556136684\",\"bStartTime\":\"2024-02-23 23:45:11\",\"gmtCreate\":\"2024-02-23 23:45:03\",\"duration\":14,\"calleeShowNumber\":\"057199900007\",\"bRingTime\":\"2024-02-23 23:45:04\",\"bEndTime\":\"2024-02-23 23:45:25\",\"state\":\"200000\",\"startDate\":\"2024-02-23 23:45:11\",\"hangupDirection\":0}", "Code"=>"OK"} data = JSON.parse(response["Data"]) puts JSON.pretty_generate(data) # 查询 CallId 140624706211^127376251211 的返回值: =begin { "callId": "140624706211^127376251211", "endDate": "2024-02-23 23:45:25", # 通话结束时间。 "stateDesc": "用户接听", # 通话状态描述。 "callee": "13556136684", # 被叫号码。 "bStartTime": "2024-02-23 23:45:11", "gmtCreate": "2024-02-23 23:45:03", "duration": 14, # duration:通话时长。单位:秒。0:用户未接通。 "calleeShowNumber": "057199900007", "bRingTime": "2024-02-23 23:45:04", "bEndTime": "2024-02-23 23:45:25", "state": "200000", # 通话状态。通话状态是运营商实时返回的,更多状态信息,请参见运营商回执错误码。 "startDate": "2024-02-23 23:45:11", # startDate:通话开始时间。 "hangupDirection": 0 } # 查询 CallId 140623874256^127375419257 的返回值: { "callId": "140623874256^127375419257", "duration": 0, "calleeShowNumber": "057199900007", "endDate": "2024-02-23 23:55:10", "stateDesc": "用户无法接通", "bRingTime": "2024-02-23 23:55:10", "callee": "13556136684", "bEndTime": "2024-02-23 23:55:10", "state": "200005", "gmtCreate": "2024-02-23 23:55:10", "startDate": "" } =end
The text was updated successfully, but these errors were encountered:
用途是展示给读者,如何调用 QueryCallDetailByCallId https://help.aliyun.com/zh/vms/developer-reference/api-dyvmsapi-2017-05-25-querycalldetailbycallid?spm=a2c4g.11186623.0.0.e0a34e9ci0FxxI
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: