[asterisk-dev] i extension does not match on initial context - bug or not?
Nir Simionovich
nir.simionovich at gmail.com
Thu Jan 8 08:35:06 CST 2009
Hi Klaus,
This is not a bug, this is how the i extension is supposed to work.
Technically speaking, the "i" extension is invoked upon reading input
from the user, using the "Background" command, not by dialing into the
context.
The solution you've indicated simply grabs all input, then tries to
do a "Goto" into the context, which is similar to accepting the input
from the "Background" application.
I would suggest that you do the following syntax:
context fromSipPhone {
11 => {
Answer();
Wait(20);
}
i => {
Playback(pbx-invalid);
}
_X. => {
goto fromSipPhone|${EXTEN}|1;
}
}
According to the dialplan pattern match, Asterisk will try to pattern
match anything before the "_X.". If it appears in the end, it's like a
catch all phrase. From the catch all, simply do a Goto in to the same
context, which is will now lead into the "i" extension.
I do something a little different:
context fromSipPhone {
11 => {
Answer();
Wait(20);
}
i => {
Playback(pbx-invalid);
}
_X. => {
goto catchall|fromSipPhone-${EXTEN}|1;
}
}
context catchall{
_fromSipPhone-.,1,Playback(ErrorMessage)
_fromSipPhone-.,n,Goto(whereever your main context is)
_fromAnyOtherContext-.,1,Playback(ErrorMessage)
_fromAnyOtherContext-.,n,Goto(whereever your main context is)
}
In this manner, I can go about and create like an error "catch"
context, that allows me to properly sound off errors and handle the
returns in a normal and civil fashion.
A little self promotion now :-)
I've got an upcoming Asterisk Developer's Guide coming out soon with
PacktPublishing - all of these tips appear in the book ;-)
Klaus Darilion wrote:
> Hi!
>
> I just stumbled about an already known problem:
> http://www.voip-info.org/wiki/view/Asterisk+i+extension
>
> The i extension does not match in the initial context, e.g:
>
> context fromSipPhone {
> 11 => {
> Answer();
> Wait(20);
> }
> i => {
> Playback(pbx-invalid);
> }
> }
>
> In this example, if the SIP phone dials 22, the i extension is not executed.
>
> But in this example:
>
> context fromSipPhone {
> _X. => goto fromSipPhoneWorkaround |${EXTEN}|1;
> }
>
> context fromSipPhoneWorkaround {
> 11 => {
> Answer();
> Wait(20);
> }
> i => {
> Playback(pbx-invalid);
> }
> }
>
> Here, if the SIP phone dials 22, the i extension is executed.
>
> IMO this is inconsistent behavior - and I would consider this a bug.
>
> Thus - should I open a bug report or is there a certain reason for the
> strange behavior?
>
> thanks
> klaus
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-dev
--
Kind Regards,
Nir Simionovich
Asterisk Community Founder and Maintainer - Israel
(e) nir.simionovich at gmail.com
(w) http://www.simionovich.com
More information about the asterisk-dev
mailing list