Javascript DTMF Callback Function

From FreeSWITCH Wiki

Jump to: navigation, search

Contents

Description

Respond to a DTMF digit

Synopsis

This callback function is passed as a parameter to such functions as session.RecordFile, and session.StreamFile

function <dtmf_callback> ( session, type, obj, user_data ) {
   .. do something ..
   return <value>;
}

type is an "event" object dtmf is a dtmf object

dtmf.digit and dtmf.duration are part of the dtmf object so you can not only get the digit but the duration that it was pressed.

This callback function should return one of the values below.

Return Values

Recording

  • true - keep recording
  • false - stop
  • "pause"
  • "restart"

Playing Back

  • true - keep going, do not interrupt the current operation
  • false - stop, and exit the current operation
  • "seek:[+/-][value]" in milliseconds
  • "speed:[+/-][value]" in some unknown unit
    Relative:
    • return("speed:+");
    • return("speed:-");
    • return("speed:+5");
    • return("speed:-5");
    Absolute:
    • return("speed:0");
    • return("speed:5");
  • "pause" (sending a second pause will unpause)
  • "restart"

Bridging

  • true - keep going, do not interrupt the current operation
  • false - stop, and exit the current operation

The special session global will be set to the Session object that the event was generated by.

Other

  • true - keep going, do not interrupt the current operation
  • false - stop, and exit the current operation

See Also

Personal tools
Community