[Asterisk-Users] Command line

Joe Pukepail pukepail at gmail.com
Fri Nov 25 15:59:38 MST 2005


For an example here is what I setup to call out, we have a job that runs on
our mainframe, when the job completes it ftps flag1.txt to our asterisk
server, the .bash program is run from the crontab at a certain time and
notifiy staff if the job is not complete at that time.  It will keep calling
(using phoneme[1-3].call until someone acknowleges the alert by pressing
"1".


There might be a better way of doing this using AGI (or another way), but
this is what I came up with.

--- extensions.conf ---

[phonehome]

exten => t,1,Playback(connection-timed-out)
exten => t,2,Playback(goodbye)
exten => t,3,Hangup()

exten => 9999,1,Playback(something-terribly-wrong)
exten => 9999,2,Playback(to-confirm-wakeup)
exten => 9999,3,Playback(press)
exten => 9999,4,SayDigits(1)
exten => 9999,5,Read(ACCEPTCALL|1-yes-2-no|1) ; (repeatoptions)
exten => 9999,6,GotoIf($["${ACCEPTCALL}" = ""] ?9999,9)
exten => 9999,7,GotoIf($[${ACCEPTCALL} = 2] ?9999,9)
exten => 9999,8,GotoIf($[${ACCEPTCALL} = 1] ?9999,96:9999,1)
exten => 9999,9,Playback(auth-thankyou)
exten => 9999,10,Playback(goodbye)
exten => 9999,11,Hangup()

exten => 9999,96,System(/bin/touch /phonehome/ack.flag)
exten => 9999,97,Playback(auth-thankyou)
exten => 9999,98,Playback(goodbye)
exten => 9999,99,Hangup()



--- phoneme1.call ---

Channel: Zap/g2/5551212
MaxRetries: 0
RetryTime: 60
WaitTime: 30
Context: phonehome
Extension: 9999
Priority: 1


--- phonehome.bash ---

if [ -e /home/mainframe/flag1.txt ]
  then echo "job completed"
       exit;
fi
rm -f /phonehome/ack.flag
while true
do
  cp -f /phonehome/phoneme1.call /var/spool/asterisk/outgoing
  while [ -e /var/spool/asterisk/outgoing/phoneme1.call  ]
  do
    sleep 5
  done
  if [ -e /phonehome/ack.flag ]
    then   echo "ack!!"
           exit;
    else   echo "no ack"
  fi

  cp -f /phonehome/phoneme2.call /var/spool/asterisk/outgoing
  while [ -e /var/spool/asterisk/outgoing/phoneme2.call  ]
  do
    sleep 5
  done
  if [ -e /phonehome/ack.flag ]
    then   echo "ack!!"
           exit;
    else   echo "no ack"
  fi

  cp -f /phonehome/phoneme3.call /var/spool/asterisk/outgoing
  while [ -e /var/spool/asterisk/outgoing/phoneme3.call  ]
  do
    sleep 5
  done
  if [ -e /phonehome/ack.flag ]
    then   echo "ack!!"
           exit;
    else   echo "no ack"
  fi
done




On 11/25/05, Tom Rymes <trymes at cascadelinksystems.com> wrote:
>
> On Nov 25, 2005, at 7:33 AM, Tony Spencer wrote:
> > Hi
> >
> > I'm pretty new to using Asterisk and have searched to find an
> > answer to my question but have failed to.
> >
> > I was wondering if you can use Asterisk from the command line to
> > make it make an outgoing call and issue other commands whilst it's
> > in the call?
> >
> > Sort of like when you use Minicom with a modem connected to a
> > serial port and send it AT commands.
> >
> >  Thanks
> >
> > Tony
>
> Tony,
>
> If you have a sound card installed and properly configured in your
> Asterisk server, then you can plug in a microphone and headset and
> make calls from the CLI using the dial command.
>
> If you want to automate having the system make phone calls, google
> and search voip-info.org for info on .call files. Basically, you
> create a file that specifies to asterisk where to call, using which
> channel, and what to do once the call is connnected. You then copy
> the file to /var/spool/asterisk/outgoing and the call is executed as
> defined.
>
> Tom
>
> --------------------
> Tom Rymes
> Cascade Link Systems
> www.cascadelinksystems.com
> (603) 375-1414
>
> "Intelligent technology solutions for small businesses."
>
>
> _______________________________________________
> --Bandwidth and Colocation sponsored by Easynews.com --
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20051125/56e4905d/attachment.htm


More information about the asterisk-users mailing list