[Asterisk-Users] dial an IP address

Skuse, Phil Phil.Skuse at vicorp.com
Fri May 21 06:26:17 MST 2004


Hi Chris,
FWIW I have a very crude version of what you are looking for. I've been
using it since last July for testing purposes.

It plays a beep, you enter the sip extension number aaa, then it plays
another beep, you enter the ip address bbbcccdddeee, then it plays another
beep, you enter the port number ffff. Then it dials
sip://aaa@bbb.ccc.ddd.eee:ffff 
You have to dial fast though because the time between beeps is quite short.
I'd welcome a copy of an improvements you make to it.

This is my extensions.conf
; extn 650 - allows SIP call from ordinary phones
exten => 650,1,Answer
exten => 650,2,AGI,phil3.sh
exten => 650,3,Dial,sip/${DESTN}@${DESTI}:${DESTP}
exten => 650,4,HangUp

This is /var/lib/asterisk/agi-bin/phil3.sh
#!/bin/sh

echo "Starting phil3.sh" 1>&2

#---------------------------------#
# Read and discard AGI Parameters #
#---------------------------------# 

PARAM=""
read PARAM
while [ "x$PARAM" != "x" ]; do
    echo $PARAM 1>&2
    read PARAM
done

#------------------------------------------#
# Play a beep and get the SIP phone number #
#------------------------------------------#

echo "GET DATA beep | 2000 | 5"
read DATA
NUM=`echo $DATA | tr "=" " " | awk '{print $3}'`
echo "NUM=$NUM" 1>&2

#-------------------------------------------#
# Play a beep and get the IP address number #
#-------------------------------------------#

echo "GET DATA beep | 2000 | 12"
read DATA
NIP=`echo $DATA | tr "=" " " | awk '{print $3}'`
let IP1=10#`echo $NIP | cut -c 1-3`
let IP2=10#`echo $NIP | cut -c 4-6`
let IP3=10#`echo $NIP | cut -c 7-9`
let IP4=10#`echo $NIP | cut -c 10-12`
IP=$IP1.$IP2.$IP3.$IP4
echo "IP=$IP" 1>&2

#-------------------------------------------#
# Play another beep and get the port number #
#-------------------------------------------#

echo "GET DATA beep | 2000 | 5"
read DATA
PORT=`echo $DATA | tr "=" " " | awk '{print $3}'`
echo "PORT=$PORT" 1>&2

#-----------------------------------------------#
# Store the captured data in asterisk variables #
#-----------------------------------------------#

echo "SET VARIABLE DESTN $NUM"
read DATA
echo "SET VARIABLE DESTI $IP"
read DATA
echo "SET VARIABLE DESTP $PORT"
read DATA

#------------------#
# That's all folks #
#------------------#

echo "Ending phil3.sh" 1>&2


-----Original Message-----
From: Chris Stenton [mailto:jacs at gnome.co.uk]
Sent: 21 May 2004 12:46
To: asterisk-users at lists.digium.com
Subject: [Asterisk-Users] dial an IP address


Anyone written an extension that will take a 12 digit number, convert it to
an IP address so that you can make a sip call to it.

Chris



_______________________________________________
Asterisk-Users mailing list
Asterisk-Users at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users



More information about the asterisk-users mailing list