Processing after a sucessful call


#1

OK - a little confused here. I want to do some processing after a sucessful call hangs up. Here’s what I have:

[custom-bartcop-interview]
exten => s,1,Answer( )
exten => s,n,Wait,1
exten => s,n(startover),Playback(bartcop-interview)
exten => s,n,Monitor(wav,/tmp/bartcop, mb)
exten => s,n,Dial(IAX2/exgn/4159870000)
exten => s,n,Hangup
exten => s,n,System(/bin/echo “Here is your attached recording.”|/usr/bin/mutt -s “Recorded Interview” -a /tmp/bartcop.wav marc@perkel.com)
exten => s,n,System(rm /tmp/bartcop.wav)

But - nothing executes after the call is completed. Dial apparently exits with a “non-zero” and it doesn’t complete the rest of the script.

Help!


#2

Take a look at:

voip-info.org/wiki-Asterisk+cmd+dial

looks like ‘g’ option might do what you want?


#3

[quote=“dswartz”]Take a look at:

voip-info.org/wiki-Asterisk+cmd+dial

looks like ‘g’ option might do what you want?[/quote]

Thanks for your help. I tried the “g” option and that didn’t work.

exten => s,n,Dial(IAX2/exgn/4159870000,g)

Maybe I’m doing it wrong?


#4

What shows up in /var/log/asterisk/full ? Also, why are you doing a Hangup? Isn’t that redundant?


#5

Here’s my logs. Yes the hangup was redundant. I removed it. Thanks for your help.

Feb 11 13:12:36 VERBOSE[16461] logger.c: – Goto (custom-bartcop-interview,s,1)
Feb 11 13:12:36 VERBOSE[16461] logger.c: – Executing Answer(“IAX2/exgn-in-1”, " ") in new stack
Feb 11 13:12:36 DEBUG[1804] channel.c: Avoiding initial deadlock for ‘IAX2/exgn-in-1’
Feb 11 13:12:36 VERBOSE[16461] logger.c: – Executing Wait(“IAX2/exgn-in-1”, “1”) in new stack
Feb 11 13:12:36 DEBUG[2112] chan_iax2.c: Ooh, voice format changed to 4
Feb 11 13:12:37 VERBOSE[16461] logger.c: – Executing Playback(“IAX2/exgn-in-1”, “bartcop-interview”) in new stack
Feb 11 13:12:37 WARNING[16461] file.c: File bartcop-interview does not exist in any format
Feb 11 13:12:37 WARNING[16461] file.c: Unable to open bartcop-interview (format ulaw): No such file or directory
Feb 11 13:12:37 WARNING[16461] app_playback.c: ast_streamfile failed on IAX2/exgn-in-1 for bartcop-interview
Feb 11 13:12:37 VERBOSE[16461] logger.c: – Executing Monitor(“IAX2/exgn-in-1”, “wav|/tmp/bartcop| mb”) in new stack
Feb 11 13:12:37 VERBOSE[16461] logger.c: – Executing Dial(“IAX2/exgn-in-1”, “IAX2/exgn/4159876272|9999999|g”) in new stack
Feb 11 13:12:37 VERBOSE[16461] logger.c: – Called exgn/4159876272
Feb 11 13:12:37 VERBOSE[2112] logger.c: – Call accepted by 70.87.18.51 (format ulaw)
Feb 11 13:12:37 VERBOSE[2112] logger.c: – Format for call is ulaw
Feb 11 13:12:40 VERBOSE[16461] logger.c: – IAX2/exgn-3 is making progress passing it to IAX2/exgn-in-1
Feb 11 13:12:40 DEBUG[2112] chan_iax2.c: Ooh, voice format changed to 4
Feb 11 13:12:45 VERBOSE[16461] logger.c: – IAX2/exgn-3 answered IAX2/exgn-in-1
Feb 11 13:12:53 DEBUG[2112] chan_iax2.c: Immediately destroying 1, having received hangup
Feb 11 13:12:53 DEBUG[16461] channel.c: Didn’t get a frame from channel: IAX2/exgn-in-1
Feb 11 13:12:53 DEBUG[16461] channel.c: Bridge stops bridging channels IAX2/exgn-in-1 and IAX2/exgn-3
Feb 11 13:12:53 DEBUG[16461] chan_iax2.c: We’re hanging up IAX2/exgn-3 now…
Feb 11 13:12:53 VERBOSE[16461] logger.c: – Hungup ‘IAX2/exgn-3’
Feb 11 13:12:53 DEBUG[16461] app_dial.c: Exiting with DIALSTATUS=ANSWER.
Feb 11 13:12:53 VERBOSE[16461] logger.c: == Spawn extension (custom-bartcop-interview, s, 5) exited non-zero on ‘IAX2/exgn-in-1’
Feb 11 13:12:53 DEBUG[1804] channel.c: Avoiding initial deadlock for ‘IAX2/exgn-in-1’
Feb 11 13:12:53 DEBUG[16461] cdr_addon_mysql.c: cdr_mysql: inserting a CDR record.
Feb 11 13:12:53 DEBUG[16461] cdr_addon_mysql.c: cdr_mysql: SQL command as follows: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid) VALUES (‘2006-02-11 13:12:36’,’“6508733064” <6508733064>’,‘6508733064’,‘s’,‘custom-bartcop-interview’, ‘IAX2/exgn-in-1’,‘IAX2/exgn-3’,‘Monitor’,‘wav|/tmp/bartcop| mX’,17,17,‘ANSWERED’,3,’’,‘1139692356.276’)
Feb 11 13:12:53 DEBUG[16461] chan_iax2.c: We’re hanging up IAX2/exgn-in-1 now…
Feb 11 13:12:53 DEBUG[16461] chan_iax2.c: Really destroying IAX2/exgn-in-1 now…
Feb 11 13:12:53 VERBOSE[16461] logger.c: – Hungup 'IAX2/exgn-in-1’
Feb 11 13:12:53 DEBUG[16461] res_monitor.c: monitor executing ( nice -n 19 soxmix “//tmp/bartcop-in.wav” “//tmp/bartcop-out.wav” “//tmp/bartcop.wav” && rm -f “//tmp/bartcop-”* ) &
Feb 11 13:12:53 DEBUG[2033] chan_sip.c: Stopping retransmission on ‘6262f13d77f0dc3d46cace70263663ca@69.50.231.8’ of Request 102: Match Found
Feb 11 13:12:55 DEBUG[2033] chan_sip.c: Stopping retransmission on ‘79d91d610060c0db491bb6341906a39b@69.50.231.8’ of Request 102: Match Found
Feb 11 13:12:59 DEBUG[2033] chan_sip.c: Auto destroying call ‘49773e9f-56da6d78@192.168.2.100’


#6

can you do ‘reload’ and post the output relevant to the custom-bartcop-interview? e.g. while you’re in ‘asterisk -r’?


#7

ok - here it is:

-- Registered extension context 'custom-bartcop-interview'
-- Added extension 's' priority 1 to custom-bartcop-interview
-- Added extension 's' priority 2 to custom-bartcop-interview
-- Added extension 's' priority 3 to custom-bartcop-interview
-- Added extension 's' priority 4 to custom-bartcop-interview
-- Added extension 's' priority 5 to custom-bartcop-interview
-- Added extension 's' priority 6 to custom-bartcop-interview
-- Added extension 's' priority 7 to custom-bartcop-interview
-- Added extension 's' priority 8 to custom-bartcop-interview

[custom-bartcop-interview]
exten => s,1,Answer( )
exten => s,n,Wait,1
exten => s,n(startover),Playback(bartcop-interview)
exten => s,n,Monitor(wav,/tmp/bartcop, mb)
exten => s,n,Dial(IAX2/exgn/4159876272,9999999,g)
exten => s,n,NoOp,Hello
exten => s,n,System(/bin/echo “Here is your attached recording.”|/usr/bin/mutt -s “Recorded Interview” -a /tmp/bartcop.wav marc@perkel.com)
exten => s,n,System(rm /tmp/bartcop.wav)


#8

I noticed the log was complaining about not being able to find the bartcopy inteview file? Also, I’m wondering if your System() call collided with the Monitor application, which wasn’t done until the very end. Try putting a Wait of 3 seconds or something in after Dial() returns?


#9

The wait didn’t change anything. I’m not sure the “g” option works. It still dies after the call hangs up:

Spawn extension (custom-bartcop-interview, s, 5) exited non-zero on ‘IAX2/exgn-in-3’

   > priority = mine
-- Executing SetVar("IAX2/exgn-in-3", "FROM_DID=8882138879") in new stack
-- Executing SetVar("IAX2/exgn-in-3", "FAX_RX=system") in new stack
-- Executing Goto("IAX2/exgn-in-3", "custom-bartcop-interview|s|1") in new stack
-- Goto (custom-bartcop-interview,s,1)
-- Executing Answer("IAX2/exgn-in-3", " ") in new stack
-- Executing Wait("IAX2/exgn-in-3", "1") in new stack
-- Executing Playback("IAX2/exgn-in-3", "bartcop-interview") in new stack
-- Executing Monitor("IAX2/exgn-in-3", "wav|/tmp/bartcop| mb") in new stack
-- Executing Dial("IAX2/exgn-in-3", "IAX2/exgn/4159876272|9999999|g") in new stack
-- Called exgn/4159876272
-- Call accepted by 70.87.18.51 (format ulaw)
-- Format for call is ulaw
-- IAX2/exgn-4 is making progress passing it to IAX2/exgn-in-3
-- IAX2/exgn-4 answered IAX2/exgn-in-3
-- Hungup 'IAX2/exgn-4'

== Spawn extension (custom-bartcop-interview, s, 5) exited non-zero on ‘IAX2/exgn-in-3’
– Hungup ‘IAX2/exgn-in-3’


#10

Wait - it’s working now. I added a Wait,5 but had forgot the , so I think adding the wait fixed it.


#11

Well, I’m kinda stumped. Looking at the source code, it says it does the ‘go’ (go on) if the hangup was not a soft hangup (whatever that is…)


#12

It seems to work if I allow the * key to be used to hangup and I use it. If I just hang up it dies. I think the * is for soft hangup.


#13

bletch. i wonder why?