[Asterisk-Users] Having trouble with extensions in an include file and retrieve_extensions_from_mysql.pl

Andrew Thompson asteriskuser at aktzero.com
Thu Feb 17 07:30:32 MST 2005


beonice wrote:
> The resulting extensions_from_mysql.conf file looks
> something like this:
> [vp_context]
> exten => 1000,1,Record(/tmp/rec:gsm)    ;
> exten => 1000,2,Playback(/tmp/rec)      ;
> exten => 1000,3,Background(goodbye)     ;
> exten => 1000,4,Hangup()    ;
> 
> I decided to #include this in my main extensions.conf,
> like so:
> 
> [main_vp_context]
> exten => s,1,Answer
> #include <extensions_from_mysql.conf>
> exten => #,1,Background(goodbye)   ; Notify caller
> exten => #,2,Hangup()     ; Hang up
> exten => t,1,Hangup()     ; Hang up if timeout
> exten => i,1,Playback(invalid) ; Play "invalid
>                                ; extension" if caller
>                                ; misdials an extension
> 
<snip>
> Anyone see a possible reason for the problem? Do you
> have any ideas how to use an include file which
> contains multiple contexts? Or will I have to generate
> multiple include files, one per included context,
> without the context lines in these files?

The only thing that seems out of place to me is your #include in 
[main_vp_context]. It looks to me like you intend for the s, #, t, and i 
extensions to be in [main_vp_context]. The way you layed out this 
example, that's not what is happenning.

I think you wanted this:

Your extensions_from_mysql.conf should still look like:

[vp_context]
exten => 1000,1,Record(/tmp/rec:gsm)    ;
exten => 1000,2,Playback(/tmp/rec)      ;
exten => 1000,3,Background(goodbye)     ;
exten => 1000,4,Hangup()    ;


Then, in extensions.conf:

#include <extensions_from_mysql.conf>

[main_vp_context]
exten => s,1,Answer
exten => #,1,Background(goodbye)   ; Notify caller
exten => #,2,Hangup()     ; Hang up
exten => t,1,Hangup()     ; Hang up if timeout
exten => i,1,Playback(invalid) ; Play "invalid
                                ; extension" if caller
                                ; misdials an extension
include => vp_context

This way, you define both contexts, and include the extensions that were 
defined in [vp_context] into [main_vp_context].

I don't know if this will resolve your other problem, but I believe this 
is the dialplan you were trying to build.

-- 
Andrew Thompson
http://aktzero.com/
http://dev.asteriskdocs.org/



More information about the asterisk-users mailing list