Skip to main content

ringback

Created by Ryan Harris, last modified on 2018.02.07

ringback

string This addition lets you set artificial ringback on a channel that is waiting for an originated call to be answered. This will specify the audio to play to the A leg on unanswered aka (early media) calls.

Syntax: <action application="set" data="ringback=[data]"/>

Where data is either the full path ((warning) must be full path!) to an audio file or teletone generation markup language.

You may also combine this with the ring_ready application. In this case the caller hears the normal ringback tone for a fraction of a second, then he hears the defined ringback media.

(info) Since r15025 local ringback tone is generated only when there is no early media. To force local ringback despite early media use the ignore_early_media channel variable.

(info) Ringback will not be sent unless the variable is set and there's a ringing indication from the party that is being called. See instant_ringback if you want to fake ringback even when ringing indication hasn't been received yet.

Usage

Using the French ring tone defined in vars.xml:

<action application="set" data="ringback=${fr-ring}"/>

US ring tone:

<action application="set" data="ringback=%(2000,4000,440.0,480.0)"/>

You can send ringback after the call is answered:

def handler(uuid):
session = PySession(uuid)
session.answer()
session.speak("Hello, connecting your call to the first available agent")
session.execute("set","call_timeout=30")
session.execute("set","continue_on_fail=true")
session.execute("set","hangup_after_bridge=true")
session.execute("set","ringback=%(2000,4000,440.0,480.0)")
session.execute("bridge","sofia/foo/bar@test.com,sofia/foo/baz@test2.com:5070")
session.speak("doh!")