Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import groovy.sql.Sql
- import org.asteriskjava.fastagi.BaseAgiScript
- import org.asteriskjava.fastagi.AgiRequest
- import org.asteriskjava.fastagi.AgiChannel
- import org.asteriskjava.fastagi.AgiException
- public class getserver_ip extends BaseAgiScript
- {
- public void service(AgiRequest request, AgiChannel channel,Sql sql)
- throws AgiException
- {
- def command = ["sh", "-c", "ifconfig eth0|grep 'inet addr'|cut -d: -f2|awk '{print \$1}'"]
- def new1 = command.toArray()
- def cmm = Runtime.getRuntime().exec((String[]) new1)
- def jf = cmm.in.text
- if (jf.length() == 0)
- {
- println "not found"
- }
- else
- {
- channel.setVariable("SERVER_IP","${jf}")
- println jf
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement