TokBox Developer Evangelist here.
The OpenTok SIP Interconnect feature allows you dial out to a SIP address (uri). With the Plivo sample, you would have to create an application on their website and configure the Plivo application with the appropriate webhooks so when that when you dial out to the Plivo SIP uri from OpenTok, you will get events on the webhook which will allow you to connect the OpenTok session with the PSTN user.
You can also leverage Nexmo or other SIP providers to dial out and connect an OpenTok session with a PSTN user. For example, if you use Nexmo, you can dial directly to a phone number by constructing the SIP properties in the OpenTok Java SDK like so:
String nexmoApiKey = "";
String nexmoApiSecret = "";
String sessionId = "";
String token = "";
SipProperties properties = new SipProperties.Builder()
.sipUri("sip:15555555555@sip.nexmo.com")
.from("from@example.com")
.headersJsonStartingWithXDash(headerJson)
.userName(nexmoApiKey)
.password(nexmoApiSecret)
.secure(false)
.build();
Sip sip = opentok.dial(sessionId, token, properties);
Please note that you would have to configure the phoneNumber
, sessionId
, token
, and credentials - I've just added a sample number along with empty strings as the credentials.