Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds a dial method and associated spec to initiate a SIP call (#133)
* adds a dial method and associated spec to initiate a SIP call * Ensure dial request has JWT auth header, including test cassette * Ensure the correct mock time is used in the SIP spec tests * Don't specify patch number for ruby version in test matrix
- Loading branch information
1 parent
734b52b
commit 5e230a0
Showing
8 changed files
with
136 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require "opentok/client" | ||
|
||
module OpenTok | ||
class Sip | ||
def dial(session_id, token, sip_uri, opts) | ||
response = @client.dial(session_id, token, sip_uri, opts) | ||
end | ||
|
||
def initialize(client) | ||
@client = client | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require "opentok/opentok" | ||
require "opentok/sip" | ||
require "spec_helper" | ||
|
||
describe OpenTok::Sip do | ||
before(:each) do | ||
now = Time.parse("2017-04-18 20:17:40 +1000") | ||
allow(Time).to receive(:now) { now } | ||
end | ||
|
||
let(:api_key) { "123456" } | ||
let(:api_secret) { "1234567890abcdef1234567890abcdef1234567890" } | ||
let(:session_id) { "SESSIONID" } | ||
let(:expiring_token) { "TOKENID" } | ||
let(:sip_uri) { "sip:+15128675309@acme.pstn.example.com;transport=tls" } | ||
let(:sip_username) { "bob" } | ||
let(:sip_password) { "abc123" } | ||
let(:opentok) { OpenTok::OpenTok.new api_key, api_secret } | ||
let(:sip) { opentok.sip } | ||
subject { sip } | ||
|
||
it "receives a valid response", :vcr => { :erb => { :version => OpenTok::VERSION } } do | ||
opts = { "auth" => { "username" => sip_username, | ||
"password" => sip_password }, | ||
"secure" => "true" | ||
} | ||
response = sip.dial(session_id, expiring_token, sip_uri, opts) | ||
expect(response).not_to be_nil | ||
end | ||
end |