Shaun Wingrin
asked on
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
Why not just plug in an analogue phone and leave it off the hook?
ASKER
I need to do this remotely.
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
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
ASKER
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
S
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
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
ASKER
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/outgoi ng 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
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/outgoi
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
ASKER
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/outgoi ng
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/outgoi
ok, then I suppouse you have a FXO card and one analog line are not working fine.. that's right?
ASKER
No.
ASKER
But close, Its an old PBX and yes one line in the hunting group is not working.
and.. you can't remove this line from the hunting group?
ASKER
Nope as I don't have remote access the the PBX.
Create repeatdial.sh with attached code
chmod +x repeatdial.sh
run it: ./repeatdial.sh
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
ASKER
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)
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)
take out the console part and just do dial
ASKER
Same error..
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.
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.
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
[modules]
autoload=yes
ASKER
Tx.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.