Fixing an old bug related to extension “s” – feedback wanted

Home » Asterisk Users » Fixing an old bug related to extension “s” – feedback wanted
Asterisk Users 3 Comments

Friends,

While working with the manager interface, I noticed that an originate action to a non-existing extension had a strange behaviour. Instead of generating an error, which would happen in most VoIP channels and Dahdi, Asterisk started looking for extension “s” as a “fallback”.

For as long as I’ve worked with Asterisk, the definition of extension “s” has been that it is used when *NO EXTENSION* has been given (and in the macro command). There are two good examples – immediate answer in Dahdi and calling a SIP domain without a username part – like “sip:digium.com”. In my trainings I always repeat (with a loud voice) that extension “s” is *NOT* a wildcard.

Obviously this behaviour is a bug. It’s been around for a long time and has been hidden by most apps and channel drivers that handle a bad extension in a correct way and report errors before the PBX is started in order to handle the channel.

The question is – how do we fix this? There might be applications out there that depend on this buggy behaviour.

What I’ve proposed are two separate fixes:

1) Change the manager Originate action
================================

In Asterisk 1.8, there will be a warning if an extension given doesn’t exist, but the behaviour will not change. A flag in Asterisk.conf [compat] section will be implemented so that you can change this behaviour and get an error response in manager if the extension does not exist.
In Asterisk 10 the error response will be the default behaviour. If an application using AMI needs a fallback, it needs to be controlled by the application. It needs to know that an extension does not exist and that the call can’t be fulfilled.

2) Change the PBX core
===================

The bug actually exists in the PBX core, in ast_pbx_start(). We will not change this in Asterisk 1.8.

In Asterisk 10, the core pbx will report that the extension does not exist and no longer fall back to s in current context or s@default. This will, as we see it now, not affect most channel drivers and thus most dialplans. If you rely heavily on the originate function (AMI, CLI and dialplan) and use the fallback behaviour, you will need to modify your dialplans.

Final question
===========

My question now is what you think about these changes. Do you need a flag for Asterisk 10 to revert to the old behaviour? Is this bug something you actually rely on in your application?

Thanks for your response!

/O

3 thoughts on - Fixing an old bug related to extension “s” – feedback wanted

  • 20 sep 2011 kl. 15:34 skrev Danny Nicholas:

    I am sorry that the “Original Asterisk” book was wrong and do hope that they corrected that part in later editions.

    I don’t think any official docs have pointed out that “s” was anything else than a default extension for situations where there is no extension given.

    Using “start” makes your dialplans much easier to read 🙂 and makes them more secure as no app will end up there by accident, which may happen in your current systems.

    /O

  • No, that extension ‘start’ (literal) has no special meaning. You
    absolutely could call it cow, fish, pig, or farmer_john. How you get
    there is by implicitly calling it.

    exten => s… on the other hand has always had special meaning as Olle
    has pointed out, and typically has meant “start” (for analog lines).
    Outside of that you shouldn’t really be using the ‘s’ extension as your
    default extensions. The ‘s’ extension has never been a “catch-all”
    extension. Olle has found a situation where the ‘s’ extension is being
    used as a fallback, which is not right, and is suggesting we make
    Asterisk consistent in it’s usage of ‘s’. I agree with his proposal.

    But because this functionality (bug) has been around for quite some
    time, he is asking the community for feedback on who may have
    inadvertently used the functionality in their dialplans.

    Apologies for anyone who may have read some documentation that appeared
    to imply that the ‘s’ extension was a catch-all. In the first and second
    editions of Asterisk: The Future of Telephony we were mostly using
    analog lines, and thus the usage of the extension ‘s’ was fairly
    prominent. There are many other single letter extensions that have extra
    meaning, such as ‘i’, ‘t’, etc…, but we never intended to imply that
    ‘s’ was a catch-all extension.