Channel originate timeout

Hi,

I am not able to increase the default 30 second timeout of Originate (Originate - Asterisk Documentation)

CLI> channel originate Local/5007@dp_pruebas application Dial timeout?

It does not work like this:

CLI> channel originate Local/5007@dp_pruebas application Dial 60

Thanks,
Regards.

You are using the CLI command, not the dialplan application. The CLI command has no timeout configuration for calling the “Local/5007@dp_pruebas” part. It has a hardcoded 30 second amount.

Hi,

Could you help me focus on a solution?

I need a crontab in the system that every day at 18:00 generates an automatic call:

  • crontab -e
00 18 * * * /home/script/Call.sh
  • Script:
sudo asterisk -rx "channel originate Local/5007@dp_pruebas application Dial"
  • Dialplan:
exten => _5001,1,NoOP()
  same => n,Set(VOLUME(TX)=2)
  same => n,PlayBack(/etc/asterisk/Locuciones/MensajeFlotas)
  same => n,Hangup()

exten => 5007,1,NoOP()
  same => n,Set(CALLERID(name)=IT)
  same => n,Dial(PJSIP/100,30,G(dp_pruebas,5001,1))
  same => n,Dial(PJSIP/00XXXXXXXXX@itsp-endpoint,30,G(dp_pruebas,5001,1))
  same => n,System(echo Hola, > /tmp/llamadaPerdidaOPS6.txt)
  same => n,System(echo >> /tmp/llamadaPerdidaOPS6.txt)
  same => n,System(echo Llamante: IT >> /tmp/llamadaPerdidaOPS6.txt)
  same => n,System(echo Llamado: 100 >> /tmp/llamadaPerdidaOPS6.txt)
  same => n,System(echo Fecha: ${STRFTIME(${EPOCH},,%d-%m-%Y)} >> /tmp/llamadaPerdidaOPS6.txt)
  same => n,System(echo Hora: ${STRFTIME(${EPOCH},,%H:%M)} >> /tmp/llamadaPerdidaOPS6.txt)
  same => n,System(echo Motivo: Se ha llamado tanto a la extension corta como al DDI y no lo han descolgado o no esta registrado. >> /tmp/llamadaPerdidaOPS6.txt)
  same => n,System(echo >> /tmp/llamadaPerdidaOPS6.txt)
  same => n,System(echo Un saludo, >> /tmp/llamadaPerdidaOPS6.txt)
  same => n,System(cat /tmp/llamadaPerdidaOPS6.txt | mail -s "Llamada no atendida - IT" XXXX@outlook.com)
  same => n,System(rm /tmp/llamadaPerdidaOPS6.txt)
  same => n,Hangup(1)

With the first dial 30 seconds the dialplan no longer continues with PJSIP/00XXXXX and then SYSTEM if it fails.

Thanks,
Regards.

I’d suggest using a call file, although you could do an originate that ran the dialplan originate application.

Hi,

Something like that?

  • /home/Call.txt
Channel: Local/5007
MaxRetries: 1
RetryTime: 60
WaitTime: 60
Context: dp_pruebas
Extension: ¿?
Priority: 1

And excuse my ignorance :frowning: , how do I call that file from dialplan or asterisk?

Thanks,
Regards.

You don’t. You create the call file on the same file system as Asterisk’s spool directory (‘core show settings’) and then ‘mv*’ it to the spool directory. This script may yield clues:

#!/bin/bash                                                                                                                                                                  

# create a call file to call the passed number and give it to                                                                                                                
# asterisk.                                                                                                                                                                  

# define variables                                                                                                                                                           
        CALL_FILE_NAME=$(mktemp)
        NUMBER="$1"

# create the call file                                                                                                                                                       
        (
        date +"# Created on %F %T by $0"
#       printf "account:foo-account\n"                                                                                                                                       
#       printf "callerid:foo-callerid\n"                                                                                                                                     
#       printf "retry:2\n"                                                                                                                                                   
        printf '\n# Define variables\n'
        printf "set:\t\tfoo=baz\n"
        printf "set:\t\tbar=zz top\n"
# leg 1                                                                                                                                                                      
        printf '\n# Leg 1\n'
        printf "channel:\tlocal/${NUMBER}@outbound-call-step-1\n"
# leg 2                                                                                                                                                                      
        printf '\n# Leg 2\n'
        printf "context:\toutbound-call-step-2\n"
        printf "extension:\t${NUMBER}\n"
        printf "priority:\t1\n"
        date +'%n# (End of call file)'
#       )                                                                                                                                                                    
        ) >${CALL_FILE_NAME}

# move the call file to Asterisk's outgoing spool file                                                                                                                       
        sudo mv ${CALL_FILE_NAME} /var/spool/asterisk/outgoing/

# (end of dial.sh)                                                                                                                                                           

You can schedule the script in cron.

*) Because ‘mv’ is an atomic operation unlike ‘cp’ or redirecting stdout.

mv is atomic within a file system, but becomes cp and rm when you cross file system boundaries.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.