How to add a function to dialplan ?

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

How to add a function to dialplan ?

Postby nwcoaster6 » Thu Jan 21, 2016 5:41 am

// for examples :

// extensions.conf

[test]
exten => 123,1,Answer()
exten =>123,n,Fnn()
exten =>123,n,Hangup()


// end


If I add a Fnn function , I want the function execute .

How to do ?


Any help ?
nwcoaster6
Newsterisk
 
Posts: 6
Joined: Tue Jan 05, 2016 1:41 am

Re: How to add a function to dialplan ?

Postby stuartalt » Thu Jan 21, 2016 8:34 am

Actually, if you are doing like you wrote, you'll be executing an application.

Take a look at the following documentation to help you clarify your mind.

Applications:
http://www.voip-info.org/wiki/view/Aste ... n+commands

Functions:
http://www.voip-info.org/wiki/view/Asterisk+functions

Dialplan functions have the following basic syntax:
FUNCTION_NAME(argument)
You reference a function’s name the same way as a variable’s name, but you reference a
function’s value with the addition of a dollar sign, an opening curly brace, and a closing
curly brace:
${FUNCTION_NAME(argument)}
Functions can also encapsulate other functions, like so:
${FUNCTION_NAME(${FUNCTION_NAME(argument)})}

Example:
exten => 123,1,NoOp()
same => n,Set(TEST=example)
same => n,Playback(silence/1)
same => n,SayNumber(${LEN(${TEST})})
stuartalt
Newsterisk
 
Posts: 11
Joined: Thu Dec 10, 2015 2:29 pm


Return to Asterisk Support

Who is online

Users browsing this forum: No registered users and 1 guest