Note that there are some explanatory texts on larger screens.

plurals
  1. POAsterisk Dialplan not running when answering machine picks up
    text
    copied!<p>I'm working on making a system to auto dial out tenant numbers that are late with their rent and read them how much they owe. Everything is working fine when the number dialed is answered or when they send a "busy tone" when it is dialing. Unfortunately when the phone rings long enough for the answering machine (or voice mail) to pick up on its own the dial plan context and extensions do not start at all. What do I have to do in order to get the dial plan to start when the answering machine or voice mail answers? I tested this on 2 phones and both do the same thing.</p> <p>Here is the code that starts the call. The script works and will dial my phone:</p> <pre><code>fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: $username\r\n"); fputs($socket, "Secret: $secret\r\n\r\n"); fputs($socket, "Command: sip show peers\r\n\r\n"); fputs($socket, "Action: Originate\r\n"); fputs($socket, "Channel: $number_out\r\n"); fputs($socket, "Context: $context\r\n"); fputs($socket, "Exten: $exten\r\n"); fputs($socket, "Priority: 1\r\n"); fputs($socket, "Timeout: 20000\r\n"); fputs($socket, "Variable: NAME=$name\r\n"); fputs($socket, "Variable: LOCATION=$location\r\n"); fputs($socket, "Variable: AMOUNT=$amount\r\n"); fputs($socket, "Variable: TENSE=$tense\r\n"); fputs($socket, "Variable: CALLDIR={$cd['calls_out_dir']}\r\n"); fputs($socket, "Variable: CALLFILE=$callFile\r\n"); fputs($socket, "Variable: ICOID=${cd['ico_id']}\r\n"); fputs($socket, "Variable: LIVEORDEVEL=html-devel\r\n"); fputs($socket, "Variable: TIMESTAMP=$timestamp\r\n"); fputs($socket, "Callerid: \"$cid_name\" &lt;$cid_num&gt;\r\n"); fputs($socket, "Action: Logoff\r\n\r\n"); </code></pre> <p>Here is the relevant part of the dial plan:</p> <pre><code>[out-tenant-collections] exten =&gt; s,1,Wait(1) exten =&gt; s,2,AMD() exten =&gt; s,3,Monitor(gsm,"${CALLDIR}${CALLFILE}",m) exten =&gt; s,n,NOOP(AMDSTATUS = ${AMDSTATUS} DIALSTATUS = ${DIALSTATUS}) exten =&gt; s,n,GotoIf($[${AMDSTATUS}=HUMAN]?humn:mach) exten =&gt; s,n(mach),agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},0,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) exten =&gt; s,n,Wait(10) exten =&gt; s,n(humn),agi(googletts.agi,"You ${TENSE} at ${LOCATION}. Your rent is overdue by ${AMOUNT}., If you already made a payment in full, press 1. If you already mailed payment or intend to pay within two days, press 2., If you feel$ exten =&gt; s,n,NOOP(ICOID: ${ICOID}) ; the wait exten command will let you interupt the above googletts agi app and go to the extension dialed in (1,2,3 or 4) if a digit is dialed that is not recognized it will go to the i extension exten =&gt; s,n,WaitExten() ; they entered something other than 1,2,3 or 4 exten =&gt; i,1,agi(googletts.agi,"Sorry I did not catch that.",en,,1.1) exten =&gt; i,n,Goto(s,4) ;; They hit 1, register that they said they paid their full amount exten =&gt; 1,1,agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},1,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) exten =&gt; 1,2,agi(googletts.agi,"Thank you, we will double check our records, if the payment has been recorded you will not recieve any more calls.",en,,1.1) exten =&gt; s,n,Hangup ;; They hit 2, register that they said they mailed a payment exten =&gt; 2,1,agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},2,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) exten =&gt; 2,2,agi(googletts.agi,"Thank you, we will await your payment.",en,,1.1) exten =&gt; s,n,Hangup ;; They hit 3, register that they said it was an error to get this call exten =&gt; 3,1,agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},3,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) exten =&gt; 3,2,agi(googletts.agi,"Please explain why you feel you have recieved this message in error, after the beep.",en,,1.1) exten =&gt; 3,3,Wait(1) exten =&gt; 3,4,Playback(beep) exten =&gt; 3,5,Wait(30) exten =&gt; 3,n,Hangup ;; They hit 4, they want the message repeated exten =&gt; 4,1,Goto(s,4) ;; The waitexten command timed out with no response exten =&gt; t,1,agi(/var/www/${LIVEORDEVEL}/asterisk-programs/ivr_collections_out_response.php,${ICOID},0,${CALLDIR}${CALLFILE}.gsm,${TIMESTAMP}) exten =&gt; t,2,Hangup </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload