Change Language By extension

I would like to preface this post by saying that I have only been playing with Asterisk for 3 days now so please forgive me if I ask an inappropriate question or don’t provide enough information.

I am having some issues setting a language based on the extension. I added the following line to extensions.conf but when ivr.php is executed, the system is using the default language set in misdn.conf:

Any assistance is be appreciated.

Hi shawndowns!

You can try this:

Thanks for answering my call for help. That didn’t work but I wonder if the issue is where I am calling the language variable in ivr.php. Basically, I just wrote a simply dump from the init() function of cpt_getParameter( ‘agi_language’ ). Is that correct?

[code] function init() {

      //$this->properties = new Properties();
      //$this->properties->load( '/var/lib/asterisk/agi-bin/devdb/ivr.conf' );

            // Get the unique ID from Asterisk.  We'll associate a callID with it later, but
            // for now, we need the ID to idenitfy log records
            $this->uniqueId = cpt_getParameter( 'agi_uniqueid' );
            $this->callerId = cpt_getParameter( 'agi_callerid' );
            $this->callerIdName = cpt_getParameter( 'agi_calleridname' );
            createLogger( $this->properties->props, $this->uniqueId );

            // Shawn's Data Dump
            $myFile = "/home/my_user/flow.log";
            $fh = fopen($myFile, 'a') or die("can't open file");
            $stringData = "init - " . cpt_getParameter( 'agi_language' )  . " - \n";
            fwrite($fh, $stringData);

Also, here’s what I have in extenstions.conf now:

Why don’t you set the language in sip.conf?

Easiest would be to put this in sip.conf

[general] ... ... language=es ...
But I thought he wanted to have the opportunity to change the language in the dialplan!

Nypon is correct. I need to be able to change the language by extension using a dialplan. If my understanding of the system is correct, changing it in sip.conf would set the language globally. We already assume the user speaks en but they are asked if they want to change to es. That works fine for most numbers but now we now have the need for a specific number or extension to start in es. From what I gather, extensions.conf is the place to do that. I do have a new question though. I was reading some documentation on updating sip.conf and there is a command that you have to run to make your changes take effect.

I didn’t find anything about that with extensions.conf but I wanted to verify that there was no service that you have to restart in order for changes to extensions.conf to take effect.

Thanks again,

For changes made in extensions.conf you do:

You should read the book:
It will help you allot!

Thanks for the reference material and the reload code! I’ll read through it and see what I can pick up. Reloading the dialplan didn’t work with either sets of code:


No big deal though. Thanks again for all of your help :smile:!


For anyone who’s been following this thread, I wanted to post an update:

The code to apply the changes to extensions

didn’t work but

does work. This may be deprecated code and the messages even say “Dialplan reloaded” but oh well.

Anyway, I didn’t try the suggested way to change the language by channel because it’s documented in the extensions.conf that I am using to use the following format:

Once again, thanks to everyone that helped me with this!