custom script - script should run after hangup

Discussion in 'General' started by lev1987, Jul 22, 2010.

  1. lev1987

    Joined:
    Jan 8, 2010
    Messages:
    25
    Likes Received:
    0
    Hello guys,
    I have the following script,
    Code:
    [correctnumber]
    exten => s,1,Macro(record-enable,${extension},IN,)
    exten => s,n,Set(filename=http://192.168.100.254/ftp/${CALLFILENAME}.wav
    exten => s,n,Set(file=${CALLFILENAME})
    exten => s,n,Set(calerid=${CALLERID(num)})
    exten => s,n,System(echo "|${number}|${extension}|${filename}|${calerid}|${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}|" > /usr/src/temp/${extension}.txt)
    exten => s,n,Dial(SIP/${extension},60,tTre)
    exten => h,1,wait(5)
    exten => h,n,System(cp /astrec/${file}.*  /usr/src/temp/)
    exten => h,n,Hangup
    I'll describe in short what is supposed to do and what's not working correctly.

    This script follows an IVR, the caller chooses which extension the call saved into "${extension}" and what number to save into "${number}"
    after that it echo's a txt file with some information
    and when the call is disconnected, the recording file copied into the same dir as the txt file.

    script runs fine when the called extension (by the dial command) hangs up, but when the caller hangs up no recording file is copied.

    Any idea how I fix this?

    Thanks alot!
     
  2. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    Re: custom script - script run after hangup

    Paste the CLI output
     
  3. lev1987

    Joined:
    Jan 8, 2010
    Messages:
    25
    Likes Received:
    0
    Re: custom script - script run after hangup

    Code:
        -- Goto (correctnumber,s,1)
        -- Executing [s@correctnumber:1] Macro("DAHDI/13-1", "record-enable|144|IN|") in new stack
        -- Executing [s@macro-record-enable:1] GotoIf("DAHDI/13-1", "1?check") in new stack
        -- Goto (macro-record-enable,s,4)
        -- Executing [s@macro-record-enable:4] AGI("DAHDI/13-1", "recordingcheck|20100723-142413|1279884231.3549") in new stack
        -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
      recordingcheck|20100723-142413|1279884231.3549: Inbound recording enabled.
      recordingcheck|20100723-142413|1279884231.3549: CALLFILENAME=20100723-142413-1279884231.3549
        -- AGI Script recordingcheck completed, returning 0
        -- Executing [s@macro-record-enable:999] MixMonitor("DAHDI/13-1", "/astrec/20100723-142413-1279884231.3549.wav||") in new stack
        -- Executing [s@correctnumber:2] Set("DAHDI/13-1", "filename=X:20100723-142413-1279884231.3549.wav") in new stack
        -- Executing [s@correctnumber:3] Set("DAHDI/13-1", "file=20100723-142413-1279884231.3549") in new stack
        -- Executing [s@correctnumber:4] Set("DAHDI/13-1", "calerid=") in new stack
        -- Executing [s@correctnumber:5] System("DAHDI/13-1", "echo "|305547772|144|X:20100723-142413-1279884231.3549.wav||20100723-142413|" > /usr/src/temp/144.txt") in new stack
      == Begin MixMonitor Recording DAHDI/13-1
        -- Executing [s@correctnumber:6] Dial("DAHDI/13-1", "SIP/144|60|tTre") in new stack
        -- Called 144
        -- SIP/144-08ea0ba8 is ringing
        -- SIP/144-08ea0ba8 is ringing
        -- SIP/144-08ea0ba8 answered DAHDI/13-1
        -- Executing [h@correctnumber:1] Wait("DAHDI/13-1", "5") in new stack
        -- Executing [h@correctnumber:2] System("DAHDI/13-1", [b]"cp /astrec/20100723-142413-1279884231.3549.*  /usr/src/temp/")[/b] in new stack
        -- Executing [h@correctnumber:3] Hangup("DAHDI/13-1", "") in new stack
      == Spawn h extension (correctnumber, h, 3) exited non-zero on 'DAHDI/13-1'
      == Spawn extension (correctnumber, s, 6) exited non-zero on 'DAHDI/13-1'
    
    when called ext hangs up the file is copied, here the same when the caller hangs up
    Code:
     -- Goto (correctnumber,s,1)
        -- Executing [s@correctnumber:1] Macro("DAHDI/13-1", "record-enable|144|IN|") in new stack
        -- Executing [s@macro-record-enable:1] GotoIf("DAHDI/13-1", "1?check") in new stack
        -- Goto (macro-record-enable,s,4)
        -- Executing [s@macro-record-enable:4] AGI("DAHDI/13-1", "recordingcheck|20100723-142957|1279884577.3555") in new stack
        -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
      recordingcheck|20100723-142957|1279884577.3555: Inbound recording enabled.
      recordingcheck|20100723-142957|1279884577.3555: CALLFILENAME=20100723-142957-1279884577.3555
        -- AGI Script recordingcheck completed, returning 0
        -- Executing [s@macro-record-enable:999] MixMonitor("DAHDI/13-1", "/astrec/20100723-142957-1279884577.3555.wav||") in new stack
        -- Executing [s@correctnumber:2] Set("DAHDI/13-1", "filename=X:20100723-142957-1279884577.3555.wav") in new stack
        -- Executing [s@correctnumber:3] Set("DAHDI/13-1", "file=20100723-142957-1279884577.3555") in new stack
        -- Executing [s@correctnumber:4] Set("DAHDI/13-1", "calerid=") in new stack
        -- Executing [s@correctnumber:5] System("DAHDI/13-1", "echo "|305547785|144|X:20100723-142957-1279884577.3555.wav||20100723-142957|" > /usr/src/temp/144.txt") in new stack
      == Begin MixMonitor Recording DAHDI/13-1
        -- Executing [s@correctnumber:6] Dial("DAHDI/13-1", "SIP/144|60|tTre") in new stack
        -- Called 144
        -- SIP/144-08ea0ba8 is ringing
        -- SIP/144-08ea0ba8 is ringing
        -- Remote UNIX connection
        -- Remote UNIX connection disconnected
        -- SIP/144-08ea0ba8 answered DAHDI/13-1
        -- Channel 0/1, span 2 got hangup request, cause 16
        -- Executing [h@correctnumber:1] Wait("DAHDI/13-1", "5") in new stack
      == Spawn h extension (correctnumber, h, 1) exited non-zero on 'DAHDI/13-1'
      == Spawn extension (correctnumber, s, 6) exited non-zero on 'DAHDI/13-1'
        -- Hungup 'DAHDI/13-1'
      == End MixMonitor Recording DAHDI/13-1
    
     
  4. lev1987

    Joined:
    Jan 8, 2010
    Messages:
    25
    Likes Received:
    0
    somebody?
     
  5. lev1987

    Joined:
    Jan 8, 2010
    Messages:
    25
    Likes Received:
    0
    bump.
    anyone? please it's very urgent..
    BTW elastix version is 1.5.2
     
  6. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    Edit /etc/asterisk/logger.conf
    add the following line at the end of the file:
    console => notice,warning,error,debug,verbose
    Then execute from the shell:
    asterisk -rx "module reload"
    Then execute again the scenario that causes the issue.
     

Share This Page