looking through old memories

Posted: January 14, 2010 in technical
Tags: , , , ,

I’ve been searching for some old e-mails from a few years ago, trying to find a missing contact and bumped into this…

The initial instructions were something like this: ” so, it needs to call a person, play the wav and wait for dtmfs until the guy presses #.; afterwards play another wav and hang up”. I was young (and restless 😛 ), not sure I’ve covered the request completely, but I was doing this:

– picked-up good old asterisk server and abused its sip.conf extension:

[general]
context=tutorial
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; tutorial
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; my users 😛
[cristina]
type=friend
username=cristina
callerid=cristina
secret=buhuhu
host=dynamic
context=tutorial
mailbox=666@mb_tutorial
[cristina1]
type=friend
username=cristina1
callerid=cristina1
secret=buhuhu
host=dynamic
context=tutorial
mailbox=777@mb_tutorial
[cristina2]
type=friend
username=cristina2
callerid=cristina2
secret=buhuhu
host=dynamic
context=tutorial
mailbox=888@mb_tutorial
[cristina3]
type=friend
username=cristina3
callerid=cristina3
secret=buhuhu
host=dynamic
context=tutorial
mailbox=999@mb_tutorial

Once I had my users defined, I went to the extensions.conf file, in order to give my users phone numbers:
[general]
static=yes
writeprotect=no
clearglobalvars=no
[globals]
CONSOLE=Console/dsp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; tutorial context
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[macro-tutorial]
;exten => s,1,Dial(${ARG2},20,rtT) ; Ring the interface, 20 seconds maximum
;exten => s,2,Goto(s-${DIALSTATUS},1) ; Jump based on status (NOANSWER,BUSY,CHANUNAVAIL,CONGESTION,ANSWER)
;exten => s-NOANSWER,1,Voicemail(u${ARG1}@mb_tutorial) ; If unavailable, send to voicemail w/ unavail announce
;exten => s-BUSY,1,Voicemail(b${ARG1}@mb_tutorial) ; If busy, send to voicemail w/ busy announce
;exten => _s-.,1,Goto(s-NOANSWER,1) ; Treat anything else as no answer
;exten => s,1,GotoIfTime(9:00-19:30|mon-sat|*|*?open,1)
;exten => s,2,Voicemail(u${ARG2}@default)
;exten => s,3,Hangup
;exten => open,1,Dial(${ARG1}|25|m)
;exten => open,n,Goto(${DIALSTATUS},1)
exten => s,1,Dial(SIP/${MACRO_EXTEN},25)
exten => s,n,Goto(${DIALSTATUS},1)
exten => ANSWER,1,Hangup
exten => CANCEL,1,Hangup
exten => NOANSWER,1,Voicemail(${MACRO_EXTEN}@default,u)
exten => BUSY,1,Voicemail(${MACRO_EXTEN}@default,b)
exten => CONGESTION,1,Voicemail(${MACRO_EXTEN}@default,b)
exten => CHANUNAVAIL,1,Voicemail(${MACRO_EXTEN}@default,u)
exten => a,1,VoicemailMain(${MACRO_EXTEN}@default)

[tutorial]
include => echotest
;exten => 1234,1,Macro(tutorial,SIP/${EXTEN},10)
exten => 1234,1,Dial(SIP/cristina,10)
exten => 1234,2,VoiceMail(666@mb_tutorial)
exten => 1234,3,PlayBack(vm-goodbye)
exten => 1234,4,Wait(2)
exten => 1234,5,HangUp()
exten => 1235,1,Dial(SIP/cristina1,10)
exten => 1235,2,VoiceMail(777@mb_tutorial)
exten => 1235,3,PlayBack(vm-goodbye)
exten => 1235,4,Wait(2)
exten => 1235,5,HangUp()

exten => 1236,1,Dial(SIP/cristina2,10)
exten => 1236,2,VoiceMail(888@mb_tutorial)
;exten => 1236,3,PlayBack(vm-goodbye)
;exten => 1236,4,Wait(2)
;exten => 1236,5,HangUp()

;exten => 1237,1,Dial(SIP,cristina3,10)
;exten => 1237,2,VoiceMail(999@mb_tutorial)
;exten => 1237,3,PlayBack(vm-goodbye)
;exten => 1237,4,Wait(2)
;exten => 1237,5,HangUp()

;exten => s,1,Macro(tutorial,${EXTEN},SIP/${EXTEN})
;exten => s,1,Voicemail(@mb_tutorial)

[echotest]
exten => echo,1,Answer()
exten => echo,n,Set(TIMEOUT(absolute)=50)
exten => echo,n,Playback(tt-monkeys)
exten => echo,n,Echo()
exten => echo,n,System(echo “blabla” ${CUR})
exten => echo,n,Playback(tt-weasels)
exten => echo,n,HangUp()
Configured voicemail for my users, in voicemail.conf file:
[general]
format=wav49|gsm|wav
serveremail=asterisk
attach=yes
skipms=3000
maxsilence=10
silencethreshold=128
maxlogins=3
userscontext=mb_tutorial
emaildateformat=%A, %B %d, %Y at %r
sendvoicemail=yes
[zonemessages]
eastern=America/New_York|’vm-received’ Q ‘digits/at’ IMp
central=America/Chicago|’vm-received’ Q ‘digits/at’ IMp
central24=America/Chicago|’vm-received’ q ‘digits/at’ H N ‘hours’
military=Zulu|’vm-received’ q ‘digits/at’ H N ‘hours’ ‘phonetic/z_p’
european=Europe/Copenhagen|’vm-received’ a d b ‘digits/at’ HM
[mb_tutorial]
666 => abc,cristina,cristina@ipsec01.org
777 => abc,cristina1,cristina1@ipsec01.org
888 => abc,cristina2,cristina2@ipsec01.org
999 => abc,cristina3,cristina3@ipsec01.org
The script that’s going to do the mighty calling looks like this:
#! /bin/bash

cd /var/spool/asterisk;

for i in  cristina ; do
#echo “Channel: $1/$i” >> echotest-$i.call;
#cat echotest.org.call >> echotest-$i.call;
#echo “SetVar: CUR=$1/$i” >> echotest-$i.call;
echo ” — Makeing echo test with $1/$i”;
cp call-files/echotest-$i.call outgoing/;chown -R asterisk:asterisk outgoing/
sleep 10;
done;
And a “call file” looks like this:
Channel: sip/cristina
Context:echotest
Extension:echo
Priority:1
Callerid:Automated Test System <>
SetVar: CUR=sip/cristina
The tutorial I’ve used back then was: http://www.asteriskguru.com/tutorials/autotest_peers.html
Enjoy!
Advertisements
Comments
  1. Dany says:

    …In case you do not have the knowledge (my case) / available time (my case again, but I’ll never say no to some genuine blog culture), the post above translates into this: ‘Phone pranks for dummies. Don’t have inspired texts to trick your buddies?! Learn to write many “one-line” commands in a file!’
    P.S. Is this an isolated case of server abuse…or is this common practice?! There should be laws against it…they have soul, too, u know?! (only it’s called core)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s