Skip to main content

Py_Session_SetDTMFCallback

About

This document covers information about Session.

Example

from freeswitch import *

def dtmf_handler(input, itype, funcargs):
console_log("INFO","\n\nDTMF input: %s\n" % input)
if input == "5":
return "pause"
if input == "3":
return "seek:+60000" # 1 min
if input == "1":
return "seek:-60000"
if input == "4":
return "seek:-120000"
if input == "6":
return "seek:+120000"
if input == "7":
return "seek:-360000"
if input == "9":
return "seek:+360000"
if input == "0":
return "stop"
return None # will make the streamfile audio stop

def handler(uuid):
session = PySession(uuid)
session.answer()
session.setDTMFCallback(dtmf_handler, "")