Sample IVR to say IP address using CURL in Asterisk

5 (100%) 2 votes

Sample IVR to say IP address using CURL in Asterisk

Installing the cURL Module

Installing cURL is easy. If it was not on your system when you last compiled Asterisk, after installing it you’ll need to recompile Asterisk so that it can locate the cURL dependencies and compile the func_curl.so module.

On CentOS:

$ sudo yum -y install libcurl-devel
On Ubuntu:

$ sudo apt-get install libcurl4-openssl-dev

The Dialplan

 

The dialplan for our example IVR is very simple. The CURL() function will retrieve our IP address from http://www.whatismyip.org, and then SayAlpha() will speak the results to the caller:

 

exten => *100,1,Verbose(2, Run CURL to get IP address from whatismyip.org)
same => n,Answer()
same => n,Set(MyIPAddressIs=${CURL(http://www.whatismyip.org/)})
same => n,SayAlpha(${MyIPAddressIs})
same => n,Hangup()

 

For any query or issue, feel free to discuss on http://discuss.eduguru.in
%d bloggers like this: