Bob,

The following AGI script will set an asterisk channel variable to your
current IP (eth0).  The variable is destroyed at the end of the call. 
If you want it longer than that, it's up to you to put it into the
database or a global variable.

#!/bin/bash
echo SET VARIABLE IPADDR \"$(ifconfig eth0 | awk '/inet addr/{print
$2}' | cut -d: -f2)\"
exit 0

You've got to create a file (maybe called getip.agi) in
/var/lib/asterisk/agi-bin/ and make the file executable.  Then you can
test it like this:

exten => 5106,1,noop(${IPADDR})
exten => 5106,2,agi(getip.agi)
exten => 5106,3,noop(${IPADDR})
exten => 5106,4,hangup

It's not pretty but it works.  And it's my first AGI program besides.

Enjoy,
Dave


On 1/16/06, Bob Cai <[EMAIL PROTECTED]> wrote:
>
> folks,
> can I get Asterisk server IP address in externsion.conf ? thanks!
> bob


--
David Donovan
Consultant
Fulcrum Solutions

Reply via email to