# There is no existence of 123@testing extension

**URL:** <https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439>\
**Category:** Asterisk Dialplan\
**Created:** [January 17, 2023, 3:03pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439 "2023-01-17T15:03:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![stratoss](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@stratoss](https://community.asterisk.org/u/stratoss)\
**Post date:** [January 17, 2023, 3:03pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/1 "2023-01-17T15:03:26Z")

</div>

I’ve configured Asterisk 20.0.1 as a simple test PBX to use Realtime chan\_pjsip via odbc.

extconfig.conf

> [settings]  
> ps\_endpoints =\> odbc,asterisk  
> ps\_auths =\> odbc,asterisk  
> ps\_aors =\> odbc,asterisk  
> ps\_domain\_aliases =\> odbc,asterisk  
> ps\_endpoint\_id\_ips =\> odbc,asterisk  
> ps\_contacts =\> odbc,asterisk  
> ps\_extensions =\> odbc,asterisk

extensions.conf

> [testing]
> 
> switch =\> Realtime/@

modules.conf

> [modules]  
> autoload = yes

Database table extensions:

 ![Screenshot from 2023-01-17 17-02-47](https://global.discourse-cdn.com/asterisk/original/2X/4/49c37cf8f3a37e331d9ceaddb9169a0e53ea9a75.png)

Test for extension:

> PBX2_CLI\> dialplan show 123@testing  
> Alt. Switch =\> ‘Realtime/@’ [pbx\_config]  
> There is no existence of 123@testing extension  
> Command ‘dialplan show 123@testing’ failed.  
> PBX2_CLI\>

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![Rmcgrath](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/rmcgrath/32/1780_2.png) [@Rmcgrath](https://community.asterisk.org/u/Rmcgrath)\
**Post date:** [January 17, 2023, 7:49pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/2 "2023-01-17T19:49:24Z")

</div>

\_x. exten pattern it means any dial number even 123.

---

<div class="post-metadata">

**Author:** ![stratoss](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@stratoss](https://community.asterisk.org/u/stratoss)\
**Post date:** [January 18, 2023, 9:10am UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/3 "2023-01-18T09:10:12Z")

</div>

I’m aware of that, but as seen from the error, even that pattern doesn’t match the extension 123. I’ve added the 3rd entry just out of curiosity if it’ll match it.

---

<div class="post-metadata">

**Author:** ![Rmcgrath](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/rmcgrath/32/1780_2.png) [@Rmcgrath](https://community.asterisk.org/u/Rmcgrath)\
**Post date:** [January 18, 2023, 12:01pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/4 "2023-01-18T12:01:04Z")

</div>

Paste the cli raw information.  
Dialplan execution it finishes on second stage “Dial” application. If \_x. pattern match with 101 it goes to extension 101, others pattern it will fail and channel will release and stop.  
In both case it will never reach to the third stage.

---

<div class="post-metadata">

**Author:** ![stratoss](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@stratoss](https://community.asterisk.org/u/stratoss)\
**Post date:** [January 18, 2023, 1:18pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/5 "2023-01-18T13:18:05Z")

</div>

The changes in the dialplan are recognized properly now. Seems that the restart of the PBX daemon fixed it.

---

<div class="post-metadata">

**Author:** ![Chano](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/chano/32/3448_2.png) [@Chano](https://community.asterisk.org/u/Chano)\
**Post date:** [January 18, 2023, 3:28pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/6 "2023-01-18T15:28:47Z")

</div>

Asterisk should ALWAYS pick the MOST specific match, when matching extensions in the dialplan, regardless of their order. Unless there’s something I’ve misunderstood.

---

<div class="post-metadata">

**Author:** ![Chano](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/chano/32/3448_2.png) [@Chano](https://community.asterisk.org/u/Chano)\
**Post date:** [January 18, 2023, 3:29pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/7 "2023-01-18T15:29:49Z")

</div>

Perhaps reloading the dialplan would had been enough?

You can reload it by typing the following in the console:

> dialplan reload

---

<div class="post-metadata">

**Author:** ![Rmcgrath](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/rmcgrath/32/1780_2.png) [@Rmcgrath](https://community.asterisk.org/u/Rmcgrath)\
**Post date:** [January 18, 2023, 3:50pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/8 "2023-01-18T15:50:29Z")

</div>

> [@Chano](#):
>
> Asterisk should ALWAYS pick the MOST specific match, when matching extensions in the dialplan, regardless of their order. Unless there’s something I’ve misunderstood.

That’s what I’m saying when I refer to pattern “\_X.”

---

<div class="post-metadata">

**Author:** ![Chano](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/chano/32/3448_2.png) [@Chano](https://community.asterisk.org/u/Chano)\
**Post date:** [January 18, 2023, 4:06pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/9 "2023-01-18T16:06:40Z")

</div>

But if you have the following in your dialplan

```auto
[ctx1]

exten => _X.,1,Log(VERBOSE,Generic destination)
 same => n,Hangup()

exten => 123,1,Log(VERBOSE,123 Extension)
 same => n,Hangup()

```

Asterisk will ONLY go through 123, not \_X.

That’s what I mean when I say picks the MOST specific. \_X. is LESS specific than 123, even though both of them will match.

A dialplan reflecting the above database would look like this:

```auto
[testing]
exten => _X.,1,NoOp(Yeah, test!)
 same => n,Dial(PJSIP/101)

exten => 123,1,NoOp(whatever)

```

I don’t remember if Asterisk has fallthough, but I think they removed that WAY back around 1.2 or 1.4, so let’s assume there’s no fall through.

With the context testing as above, running `dialplan show 123@testing` in the console, should display both the steps for 123 and the steps for \_X., but when actually CALLING 123 only the steps for 123 should be executed. (If I’m remembering wrong and Asterisk DOES fall through, it will first execute the steps in 123, then continue with \_X.)

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [January 19, 2023, 11:41am UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/10 "2023-01-19T11:41:47Z")

</div>

> [@Rmcgrath](#):
>
> \_x. exten pattern it means any dial number even 123

Longer matches, and matches with without wildcards should take precedence, so 123 should match here.

---

<div class="post-metadata">

**Author:** ![Rmcgrath](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/rmcgrath/32/1780_2.png) [@Rmcgrath](https://community.asterisk.org/u/Rmcgrath)\
**Post date:** [January 19, 2023, 11:58am UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/11 "2023-01-19T11:58:33Z")

</div>

> [@Rmcgrath](#):
>
> it means any dial number even 123

Yes, as exten 123 does not have set app it will assume previous as \_x. Dial app.

---

<div class="post-metadata">

**Author:** ![Chano](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/chano/32/3448_2.png) [@Chano](https://community.asterisk.org/u/Chano)\
**Post date:** [January 19, 2023, 12:07pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/12 "2023-01-19T12:07:45Z")

</div>

Extension 123 has 1 line of dialplan…

```auto
exten 123,1,NoOp(whatever)

```

And as such, when dialing 123, this is what should be executed, NOT whatever is defined by \_X.

So with the above dialplan, if you dial 123, the dialplan for \_X. will NEVER be executed.

If you dial anything BUT 123, the dialplan for \_X. will be executed.

A flow in the dialplan does NOT need to use the Dial application at all, I have several flows in my setup, that never runs dial. Some doesn’t even answer the channel.

---

<div class="post-metadata">

**Author:** ![Rmcgrath](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/rmcgrath/32/1780_2.png) [@Rmcgrath](https://community.asterisk.org/u/Rmcgrath)\
**Post date:** [January 19, 2023, 12:17pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/13 "2023-01-19T12:17:19Z")

</div>

That’s true when you have “same =\> n,Hangup()” , but based on original dialplan question, NO.

---

<div class="post-metadata">

**Author:** ![Chano](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/chano/32/3448_2.png) [@Chano](https://community.asterisk.org/u/Chano)\
**Post date:** [January 19, 2023, 12:37pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/14 "2023-01-19T12:37:02Z")

</div>

So… Just setup a simple test… I made this dialplan:

```auto
exten => 111111,1,NoOp(A:${EXTEN})
exten => _11111.,1,NoOp(B:${EXTEN})
exten => _1111.,1,NoOp(C:${EXTEN})
exten => _111.,1,NoOp(D:${EXTEN})
exten => _11.,1,NoOp(E:${EXTEN})
exten => _X.,1,NoOp(F:${EXTEN})

```

Then I dialed 111111, my console output was this:

```auto
    -- Executing [111111@<REDACTED>:1] NoOp("PJSIP/<REDACTED>-00000005", "A:111111") in new stack
    -- Auto fallthrough, channel 'PJSIP/<REDACTED>-00000005' status is 'UNKNOWN'

```

On the SIP level, the call is rejected with a 603 Decline response.

From what I understand you said, this example should result in AT LEAST 111111 and \_X. being executed, and if it’s falling through from most to least specific, all of them, in the order written here, should be executed.

That just isn’t what I observe.

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [January 19, 2023, 12:38pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/15 "2023-01-19T12:38:04Z")

</div>

\_X.,2 (which is what the second exten line equates to) will match the second priority for 123, but \_X.,1 will not match the first priority.

---

<div class="post-metadata">

**Author:** ![Chano](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/chano/32/3448_2.png) [@Chano](https://community.asterisk.org/u/Chano)\
**Post date:** [January 19, 2023, 4:40pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/16 "2023-01-19T16:40:58Z")

</div>

Seriously? Who got that bright idea?

It doesn’t really seem intuitive, that it can continue at a “random” priority for another extension, just because it happens to match the expression. I did not test that variant, but it sounds like something that might very well be true.

Pure luck I haven’t encountered that before.

---

<div class="post-metadata">

**Author:** ![jcolp](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/jcolp/32/8848_2.png) [@jcolp](https://community.asterisk.org/u/jcolp)\
**Post date:** [January 19, 2023, 4:44pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/17 "2023-01-19T16:44:21Z")

</div>

It’s not really random. It goes to the next priority, or the explicit priority if you’re jumping yourself. At that priority the closest match is used.

It’s honestly been that way since before I was part of the project, so the history is probably lost to time.

---

<div class="post-metadata">

**Author:** ![Rmcgrath](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/rmcgrath/32/1780_2.png) [@Rmcgrath](https://community.asterisk.org/u/Rmcgrath)\
**Post date:** [January 19, 2023, 4:55pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/18 "2023-01-19T16:55:57Z")

</div>

> [@Chano](#):
>
> On the SIP level, the call is rejected with a 603 Decline response.
> 
> From what I understand you said, this example should result in AT LEAST 111111 and \_X. being executed, and if it’s falling through from most to least specific, all of them, in the order written here, should be executed.
> 
> That just isn’t what I observe.

NoOp application only prints its line arguments to the console without any process related to the call.

---

<div class="post-metadata">

**Author:** ![Chano](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/chano/32/3448_2.png) [@Chano](https://community.asterisk.org/u/Chano)\
**Post date:** [January 19, 2023, 5:01pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/19 "2023-01-19T17:01:30Z")

</div>

Yeah, i know it’s not truly random, hence the quotes. But if you’re not aware of this behavior, it could easily feel random.

Seems like a case of either “Seemed like a good idea at the time”, “Didn’t think of that as a problem” or “It’s always been like that, better not change it”.

But certainly something worth keeping in mind, when designing dialplans. With all the crazy stuff I’ve made, I guess I’ve just been lucky for this never to interfere with what I’ve made. 😉

---

<div class="post-metadata">

**Author:** ![Chano](https://sea1.discourse-cdn.com/asterisk/user_avatar/community.asterisk.org/chano/32/3448_2.png) [@Chano](https://community.asterisk.org/u/Chano)\
**Post date:** [January 19, 2023, 5:02pm UTC](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439/20 "2023-01-19T17:02:53Z")

</div>

> [@Rmcgrath](#):
>
> NoOp application only prints its line arguments to the console without any process related to the call.

True, but that’s still ALL you need to figure out how the dialplan is processed. But from what others have added, I think I get how it works, even though it makes no sense why it’s implemented like that.

[Next page](https://community.asterisk.org/t/there-is-no-existence-of-123-testing-extension/95439.md?page=2)
