Difference Between Application Set And Function SET?

Home » Asterisk Users » Difference Between Application Set And Function SET?
Asterisk Users 4 Comments

It was only when I ran AsteriskLint over my dialplan that I noticed this:

https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Application_Set https://wiki.asterisk.org/wiki/display/AST/Asterisk+14+Function_SET

Hmmm, they both seem to do the same thing. Or don’t they?

Confused!

4 thoughts on - Difference Between Application Set And Function SET?

  • Yes they both do the same thing which is set a channel variable. However, when they can be invoked is different. The Set application can only be invoked in dialplan. The SET function can be invoked anywhere a function can be invoked and not just in dialplan.

    Richard

  • In some sense they do, but one’s an application, meaning that it’s like a subprogram in a programming-language sense, and the other is a function, which returns a value.

  • OK, thanks. That sort of makes sense. Is it case sensitive?

    Bonus quickie while I’m here (not worth own thread) – Asterisklint complains that:

    H_PAT_NON_CANONICAL: pattern ‘_#’ is not in the canonical form ‘#’

    for the line

    exten => _#,1,Goto(s,1)

    I’m sure I read somewhere it should be _#.

    Am I imagining it?!

  • Is what case sensitive? Function names are case sensitive. Application names have historically been not case sensitive.

    You are declaring an extension line with a pattern but the pattern only has literal characters so it really isn’t a pattern. It takes more CPU to match than the non-pattern form and is more likely an error.

    Richard

    [1] https://wiki.asterisk.org/wiki/display/AST/Pattern+Matching