Realtime and extensions selection

Hi,

I’ve got a strange problem, just configuring my realtime like this :

switch => Realtime/SBC@extensions

Storage in my table (name is extensions) is :

id;context;exten ;priority;app ;appdata
1 ;SBC ;0970271010;1 ;DIAL;SIP/0970271010

When I trying a call, the Asterisk’s query is :

SELECT * FROM extensions WHERE exten = ‘s’ AND context = ‘SBC’ AND priority = ‘1’

Why asterisk is looking for an exten “start” instead of my phone number ?

Asterisk query should be :SELECT * FROM extensions WHERE exten = ‘0970271010’ AND context = ‘SBC’ AND priority = ‘1’, no ?

Many thanks and Regards,

Can you show console to make sure extensions 0970271010 is the extensions sent to Asterisk on the incoming call

Yes it is !
If I write a simple rule :
exten => 0970271010,1,Dial(SIP/${EXTEN)) it works perfectly !

Hummm. My realtime seems to work in an other context.

So does ‘Switch => Realtime’ command line must to be alone in a [Context]

Yet hummm…

Switch => 'Realtime’ don’t must to be alone, but the prority is less than other rules, even if Switch line is before the others rules

In this example ;

[SBC]
switch => Realtime/SBC@extensions

exten => _X.,1,Noop(Default route)

Default route is prefered !!!

Yes, that’s how it works[1].

[1] Contexts, Extensions, and Priorities - Asterisk Project - Asterisk Project Wiki

Yes I know that but why I wrote :

[SBC]
switch => Realtime/SBC@extensions

exten => _X.,1,Noop(Default route)

I have :

*CLI> dialplan show SBC
‘_X.’ => 1. Noop(${EXTEN}) [pbx_config]
Alt. Switch => ‘Realtime/SBC@extensions’ [pbx_config]

How can I put my Switch Realtime before my default rule ?

You can’t. The order is defined according to the order I linked.

You didn’t understand, this is not for the same extension !

I have rules for one extension in Realtime and I have a default route and many others for others extensions.

Your link explain me the priority rules on ONE extension.

I have differents extensions. This is not a priority problem on ONE extension, this a priority problems of extension matching !

I don’t know what you mean by “same extension”. The order applies for all extensions, and are evaluated at each priority. If a pattern match that matches is in extensions.conf in the context, then it would be used before the switch.

If a pattern match that matches is in extensions.conf in the context, then it would be used before the switch.

Totally agree with this, but this is not the case !!!

[SBC]
switch => Realtime/SBC@extensions (With a better matching pattern inside !!!)

exten => _X.,1,Noop(Default route)

*CLI> dialplan show SBC
‘_X.’ => 1. Noop(${EXTEN}) [pbx_config]
Alt. Switch => ‘Realtime/SBC@extensions’ [pbx_config]

The switch is not a pattern match in the dialplan. It’s a switch. A switch has lower priority than the “_X.”.

Ok, so how can I make a better priority for my switch ?

The order is what it says on the wiki, so you have to respect the order and make it work for what you want.

Yes but in my case I need a final default route because of many extension.
And I need a Switch before the default to have a DIAL on special extension maintained in SQL database.

It may be possible to do this by adding another layer of context, so that it includes contexts with just the realtime switch and just the explicit dialplan.

Hummm… I see !!! Thanks you for your help !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.