Skip to content
New issue

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

Add dev docs category overviews #129

Merged
merged 3 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/js/src/Modules/Verto/BaseSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default abstract class BaseSession {
/**
* Attaches an event handler for a specific type of event.
*
* ## Events
* ### Events
* | | |
* |---|---|
* | `telnyx.ready` | The client is authenticated and available to use |
Expand Down
44 changes: 44 additions & 0 deletions packages/js/src/Modules/Verto/webrtc/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@ import { CallOptions } from './interfaces';
import { getDisplayMedia, setMediaElementSinkId } from '../util/webrtc';

/**
* A `Call` is the representation of an audio or video call between
* two browsers, SIP clients or phone numbers. The `call` object is
* created whenever a new call is initiated, either by you or the
* remote caller. You can access and act upon calls initiated by
* a remote caller in a `telnyx.notification` event handler.
*
* @examples
*
* To create a new call, i.e. dial:
*
* ```js
* const call = client.newCall({
* // Destination is required and can be a phone number or SIP URI
* destinationNumber: '18004377950',
* callerNumber: '‬155531234567',
* });
* ```
*
* To answer an incoming call:
*
* ```js
* client.on('telnyx.notification', (notification) => {
* const call = notification.call;
*
* if (notification.type === 'callUpdate' && call.state === 'ringing') {
* call.answer();
* }
* });
* ```
*
* Both the outgoing and incoming call has methods that can be hooked up to your UI.
*
* ```js
* // Hangup or reject an incoming call
* call.hangup();
*
* // Send digits and keypresses
* call.dtmf('1234');
*
* // Call states that can be toggled
* call.hold();
* call.muteAudio();
* ```
*
* @category Call
*/
export default class Call extends BaseCall {
Expand Down
29 changes: 29 additions & 0 deletions packages/js/src/TelnyxRTC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@ import TelnyxRTCClient from './Modules/Verto';
import { ITelnyxRTCOptions } from './Modules/Verto/util/interfaces';

/**
* The `TelnyxRTC` client connects your application to the Telnyx backend,
* enabling you to make outgoing calls and handle incoming calls.
*
* @examples
*
* ```js
* // Initialize the client
* const client = new TelnyxRTC({
* // Use a JWT to authenticate (recommended)
* login_token: login_token,
* // or use your Connection credentials
* // login: username,
* // password: password,
* });
*
* // Attach event listeners
* client
* .on('telnyx.ready', () => console.log('ready to call'))
* .on('telnyx.notification', (notification) => {
* console.log('notification:', notification)
* });
*
* // Connect and login
* client.connect();
*
* // You can disconnect when you're done
* // client.disconnect();
* ```
*
* @category Client
*/
export default class TelnyxRTC extends TelnyxRTCClient {
Expand Down