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
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@gnome.co.uk] Sent: 21 May 2004 12:46 To: asterisk-users@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@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
Hi Chris, Here is a copy of the extensions.conf logic I use to accomplish this. exten => 300,1,Playback,sipextn exten => 300,2,Read(DSTNE||8) exten => 300,3,Playback,sipip exten => 300,4,Read(DSTNI||15) exten => 300,5,Playback,sipport exten => 300,6,Read(DSTNP||4) exten => 300,7,Cut(DSTNI1=DSTNI,*,1) exten => 300,8,Cut(DSTNI2=DSTNI,*,2) exten => 300,9,Cut(DSTNI3=DSTNI,*,3) exten => 300,10,Cut(DSTNI4=DSTNI,*,4) exten => 300,11,Dial,SIP/${DSTNE}@${DSTNI1}.${DSTNI2}.${DSTNI3}.${DSTNI4}:${DSTNP} sipextn.gsm says "Please enter the SIP extension you wish to dial" sipip.gsm says "Enter the SIP IP seperated by stars" sipport.gsm says "Enter the SIP Port Number" User dials in and types 102# 192*168*0*6# 5060 and is connected with SIP/102@192.168.0.6:5060 Far from perfect, but it works for me. Doesn't support non-numerical extensions, however. Best Regards, Ben --------- Original Message --------- From: Chris Stenton To: <asterisk-users@lists.digium.com> Subject: [Asterisk-Users] dial an IP address Sent: 5/21/2004 7:48:18 AM 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@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 This message was checked by MailScan for WorkgroupMail. www.workgroupmail.com