Why did it Hangup?

I am learning how to use AMI and I am having 1 problem.. When I make a call
to my mobile phone and when I answer it – it get disconnected/hangup right
away.

Why is that? What is the solution to stop that?

For example:

ACTION: Originate
Channel: SIP/447XXXXXXX@vpsprovider
Exten: 210
Priority: 1
CallerID: 0044123456789
Timeout: 60000
Context: test

exten => 210,1,Answer
exten =>
210,n,Set(MONITOR_FILENAME=Record-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})
exten => 210,n,SendDTMF(wwww2w3w)
exten => 210,n,Monitor(wav,${MONITOR_FILENAME},ib)
exten => 210,n,Hangup()

Before I had Dial() in the dialplan and it work great and no hangup. Now I
am using AMI method.

Thanks

4 Responses to “Why did it Hangup?”

  1. "Danny Nicholas" said:

    May 08, 12 at 4:17 pm

    It is likely the 60 second timeout you are providing. Or it could be the
    hangup() command in the 210 context.

    [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Shahid H
    Sent: Tuesday, May 08, 2012 3:11 PM

    I am learning how to use AMI and I am having 1 problem.. When I make a call
    to my mobile phone and when I answer it – it get disconnected/hangup right
    away.

    Why is that? What is the solution to stop that?

    For example:

    ACTION: Originate

    Channel: SIP/447XXXXXXX@vpsprovider

    Exten: 210

    Priority: 1

    CallerID: 0044123456789

    Timeout: 60000

    Context: test

    exten => 210,1,Answer

    exten =>
    210,n,Set(MONITOR_FILENAME=Record-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})

    exten => 210,n,SendDTMF(wwww2w3w)

    exten => 210,n,Monitor(wav,${MONITOR_FILENAME},ib)

    exten => 210,n,Hangup()

    Before I had Dial() in the dialplan and it work great and no hangup. Now I
    am using AMI method.

    Thanks

  2. Shahid H said:

    May 08, 12 at 4:20 pm

    No, that ‘timeout’ option is when I don’t answer the call.

    My problem is when I DO answer the call, it get disconnected right away.

    Yes hangup() get executed right away when I answer the call.

  3. "Danny Nicholas" said:

    May 08, 12 at 4:22 pm

    Since you are Originating the call, the hangup command isn’t needed. Remove
    and reload.

    [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Shahid H
    Sent: Tuesday, May 08, 2012 3:20 PM

    No, that ‘timeout’ option is when I don’t answer the call.

    My problem is when I DO answer the call, it get disconnected right away.

    Yes hangup() get executed right away when I answer the call.

    It is likely the 60 second timeout you are providing. Or it could be the
    hangup() command in the 210 context.

    [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Shahid H
    Sent: Tuesday, May 08, 2012 3:11 PM

    I am learning how to use AMI and I am having 1 problem.. When I make a call
    to my mobile phone and when I answer it – it get disconnected/hangup right
    away.

    Why is that? What is the solution to stop that?

    For example:

    ACTION: Originate

    Channel: SIP/447XXXXXXX@vpsprovider

    Exten: 210

    Priority: 1

    CallerID: 0044123456789

    Timeout: 60000

    Context: test

    exten => 210,1,Answer

    exten =>
    210,n,Set(MONITOR_FILENAME=Record-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)})

    exten => 210,n,SendDTMF(wwww2w3w)

    exten => 210,n,Monitor(wav,${MONITOR_FILENAME},ib)

    exten => 210,n,Hangup()

    Before I had Dial() in the dialplan and it work great and no hangup. Now I
    am using AMI method.

    Thanks

  4. SamyGo said:

    May 09, 12 at 1:08 am

    Hi Shahid,

    I am in favor of asterisk for what it is doing to your call. When you send
    an AMI event like the one you wrote it sends the A party invite right away
    w/o going into any context/extension. As soon as the A-party answers the
    call Asterisk manager connects/lands A-channel to the test context
    extension 210.

    Your monitor command is recording I/O streams of b-party here. which is
    nothing except SendDTMF (silence I’d say in terms of audio) – using
    MixMonitor, as Danny said, will record both A; and B-party channel audio.

    Or the other possibility is that instead of directly making out call to
    A-party i.e SIP/447XXXXXXX@vpsprovider, SET some variables and originate
    call to Local channel i.e Local/447XXXXXXX@my-demo-context. And in that
    context use Monitor() before DIAL()

    [my-demo-context]
    exten => _447XXXXXXX,1,NOOP(— I’m going to Dial ${EXTEN} —)
    same => n,Monitor(blah-blah-blah filename)
    same => n,DIAL(SIP/${EXTEN}@vpsprovider,,gFD( wwww2w3w))
    same => n,StopMonitor()
    same => n,Hangup()

    NOTE: You should not put and ANSWER() in this context/extension as that
    will lead to immediate connection to the B-party context^exten^prio
    (test,210,1 in your case)

    The only difference this approach would make is that it’ll record the
    ringing sounds/busy tones or any other carrier error messages played on
    your desired Outbound number.Whereas in your case only successful calls
    will be recorded.

    Looking at your scripts I’m having a feeling that you are trying to make an
    Auto-IVR-tester sort of thing – pressing DTMFs on an IVR and recording
    audio to see if your desired IVR has played or not !!

    Regards,
    Sammy.