0

I'm kinda new at asterisk and i have to do a process after hangup, i have a code that is something like this:

exten => 12345,1,wait(1)
 same => n,agi(myagi.php)
 same => n,hangup()

exten => h,1,noop("hangup")
 same => n,System(sleep 1m)
 same => n,agi(sendemail.php)

so, the call wont hangup when it goes to the h extension because of the sleep, but i need the delay before sending the email, how do i disconnect the caller but still continue the process in the h extension? or is there another way to do this?

Thank You

2 Answers2

0

You'll need to change your setup to send the email asynchronously. Basically in your dialplan you will call a shell script that only executes the email script in the background and returns immediately. You'll add the delay into the email script using PHP's sleep() function. I've not done this before so don't have any sample code to offer, but this looks like a good place to start.

Community
  • 1
  • 1
miken32
  • 42,008
  • 16
  • 111
  • 154
0

Best way is mark cdr,for example CDR(userfield)=EMAILTO:address.

After that check all cdrs every few seconds/minutes and do action you needed.

Please never use h-extension for task that can take more then 0.5 sec, that can cause issues.

arheops
  • 15,544
  • 1
  • 21
  • 27