Asterisk script to repeat dial of a number

Say, I'm looking for a simple way to dial a number repeatedly for two minutes at a time. The purpose is to busy up a faulty analogue line in an incoming hunt group. Tx
shaunwinginAsked:
Who is Participating?
 
shaunwinginConnect With a Mentor Author Commented:
This is the solution I've implemented but yours is simple enough too:
nano ringline
Channel: SIP/SIPTrunk/xxxxxxxxxxx
Callerid: 999
Application: Playback
Data: hello-world
MaxRetries: 999
RetryTime: 15
WaitTime: 240

cp ringline rl

chown asterisk:asterisk rl
mv rl /var/spool/asterisk/outgoing
0
 
grbladesCommented:
Why not just plug in an analogue phone and leave it off the hook?
0
 
shaunwinginAuthor Commented:
I need to do this remotely.
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
edattoliCommented:
To set an extension as busy, you can execute this on the linux CLI:

asterisk -rx "database put DND 877 YES"

This lines put the 877 extension on DND mode.
And to remove the DND mode:

asterisk -rx "database del DND 877"

ED
0
 
shaunwinginAuthor Commented:
Dear ED, tx for the info, but this won't solve my problem as the extensions don't have anything to do with the Asterisk server but are remote.

S
0
 
edattoliCommented:
ok S., then let me understand your problem.
About the extensions: do you have a remote sip FXS gateway registered on the central Asterisk server?
I don't understand what's the problem
0
 
shaunwinginAuthor Commented:
A guy Bruce Bruce helped me solve problem tx. See solution:

LOL....this is just what I was facing 4 days ago. Unfortunately, Asterisk doesn't provide a software feature in Zaptel to do a BUSY. But people on the list suggest that one should call the telephone company and ask them to busy it.


If you have the resource and don't mind the bill of calling the bad line with another line (which is still not full proof because someone else could be calling during that time) then check into spool files and do a little bashscript to run in put files in /var/spool/asterisk/outgoing for calls every two minutes.


Oh, if you have access to the box, short-circuit the telco line at the telco demarc.


http://www.voip-info.org/wiki/view/Asterisk+auto-dial+out


-Bruce
0
 
shaunwinginAuthor Commented:
My code used:
nano ringline
Channel: SIP/siptrunkname/number to ring
Callerid: 999
Application: Playback
Data: hello-world
MaxRetries: 30
RetryTime: 1
WaitTime: 120

cp ringline rl

chown asterisk:asterisk rl
mv rl /var/spool/asterisk/outgoing
0
 
edattoliCommented:
ok, then I suppouse you have a FXO card and one analog line are not working fine.. that's right?
0
 
shaunwinginAuthor Commented:
No.
0
 
shaunwinginAuthor Commented:
But close, Its an old PBX and yes one line in the hunting group is not working.
0
 
edattoliCommented:
and.. you can't remove this line from the hunting group?
0
 
shaunwinginAuthor Commented:
Nope as I don't have remote access the the PBX.
0
 
cwhallCommented:
Create repeatdial.sh with attached code
chmod +x repeatdial.sh
run it: ./repeatdial.sh



#!/bin/bash
while [ 1 ]
do
        asterisk -rx "console dial 5555555555@internal"
        sleep 120
        asterisk -rx "console hangup"
done

Open in new window

0
 
shaunwinginAuthor Commented:
Tx 4 the code but its not compatible with 1.4:

Connected to Asterisk 1.4.22-4 RPM by vc-rpms@voipconsulting.nl currently running on trixbox1 (pid = 10684)
Verbosity is at least 3
trixbox1*CLI> console dial 5555555555@internal
No such command 'console dial 5555555555@internal' (type 'help console dial' for other possible commands)
0
 
cwhallCommented:
take out the console part and just do dial
0
 
shaunwinginAuthor Commented:
Same error..
0
 
cwhallCommented:
From the asterisk "CLI> console dial" works for me on 1.6 and "CLI> dial" works on 1.4. See below for possible reason.

From: http://www.voip-info.org/wiki/view/Asterisk+CLI+dial

Note: The dial command is only available at the Asterisk CLI if a console driver has been successfully loaded. If you type "dial 123" and receive the error:

No such command 'dial' (type 'help' for help)

then either the channel driver (chan_alsa.so or chan_oss.so) isn't loaded or it wasn't properly initialized. If this happens, check the settings in modules.conf and alsa.conf or oss.conf.
0
 
cwhallCommented:
You may have to add this to your modules.conf. Also, in the bash script you will need to ensure you sent the "@internal" to whatever context allows you to make outbound calls (i.e. from-internal, etc.)

[modules]
autoload=yes

0
 
shaunwinginAuthor Commented:
Tx.
0
All Courses

From novice to tech pro — start learning today.