Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

Class: OpenTok::Sip

Inherits:
Object
Defined in:
lib/opentok/sip.rb

Instance Method Summary

Constructor Details

#initialize(client) ⇒ Sip

Returns a new instance of Sip.

Instance Method Details

#dial(session_id, token, sip_uri, opts) ⇒ Object

Dials a SIP gateway to input an audio-only stream into your OpenTok session. See the / OpenTok SIP developer guide.

video (​true​) or not (​false​, the default). With video included, the SIP client's video is included in the OpenTok stream that is sent to the OpenTok session. The SIP client will receive a single composed video of the published streams in the OpenTok session. observes force mute moderation (true) or not (false, the default).

Examples:

opts = { "from" => "14155550101@example.com",
  "auth" => { "username" => sip_username,
    "password" => sip_password },
  "headers" => { "X-KEY1" => "value1",
    "X-KEY1" => "value2" },
  "secure" => "true",
  "video" => "true",
  "observe_force_mute" => "true"
}
response = opentok.sip.dial(session_id, token, "sip:+15128675309@acme.pstn.example.com;transport=tls", opts)

Parameters:

  • session_id (String)

    The session ID corresponding to the session to which the SIP gateway will connect.

  • token (String)

    The token for the session ID with which the SIP user will use to connect.

  • sip_uri (String)

    The SIP URI the OpenTok SIP gateway will dial.

  • opts (Hash)

    A hash defining options for the SIP call. For example:

Options Hash (opts):

  • :from (String)

    The number or string that will be sent to the final SIP number as the caller. It must be a string in the form of “from@example.com”, where from can be a string or a number. If from is set to a number (for example, “14155550101@example.com”), it will show up as the incoming number on PSTN phones. If from is undefined or set to a string (for example, “joe@example.com”), +00000000 will show up as the incoming number on PSTN phones.

  • :headers (Hash)

    This hash defines custom headers to be added to the SIP ​INVITE​ request initiated from OpenTok to the your SIP platform.

  • :auth (Hash)

    This object contains the username and password to be used in the the SIP INVITE​ request for HTTP digest authentication, if it is required by your SIP platform.

  • :secure (true, false)

    Whether the media must be transmitted encrypted (​true​) or not (​false​, the default).

  • :video (true, false)

    Whether the SIP call will include

  • :observe_force_mute (true, false)

    Whether the SIP end point

#play_dtmf_to_connection(session_id, connection_id, dtmf_digits) ⇒ Object

Sends DTMF digits to a specific client connected to an OpnTok session.

the DTMF signal is being sent to. A p indicates a pause of 500ms (if you need to add a delay in sending the digits).

Parameters:

  • session_id (String)

    The session ID.

  • connection_id (String)

    The connection ID of the specific connection that

  • dtmf_digits (String)

    The DTMF digits to send. This can include 0-9, “*”, “#”, and “p”.

Raises:

  • (ArgumentError)

#play_dtmf_to_session(session_id, dtmf_digits) ⇒ Object

Sends DTMF digits to all clients connected to an OpnTok session.

A p indicates a pause of 500ms (if you need to add a delay in sending the digits).

Parameters:

  • session_id (String)

    The session ID.

  • dtmf_digits (String)

    The DTMF digits to send. This can include 0-9, “*”, “#”, and “p”.

Raises:

  • (ArgumentError)