[asterisk-users] Question

Steve Edwards asterisk.org at sedwards.com
Tue May 19 14:24:07 CDT 2009


Subject : Re: [asterisk-users] Question
-------------------------------^^^^^^^^
You may have better luck with a better Subject.

On Tue, 19 May 2009, Venefax wrote:

> I need to obtain one variable in the dialplan containing the IP address 
> that Asterisk is using, I mean, the originating IP for any calls coming 
> out of Asterisk via SIP. Is this possible?

Your question is a bit vague. If you only have a single IP address, you 
could pass it in as an environment variable when you start Asterisk. Like:

                 ADDRESS=$(ifconfig eth0\
                         | tr ":" " "\
                         | awk '/inet addr/ {print $3}')
                 nice --adjustment=-20\
                         env --ignore-environment\
                                 ADDRESS=${ADDRESS}\
                                         $ASTERISK $START_OPTIONS

(I just hacked this out as an example.)

If you have multiple IP addresses on the box, good luck :)

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list