Hangup code executing at wrong place

Right after agent answers call, the hangup code is executed but call is not disconnected.Rather Hangup should be executed after call disconnect.

You’ll need to provide console output and further information. For example: Are you using Local channels? They can optimize themselves out so they hang up but the call remains going between both parties.

Yes using local channel. How would then we get the talktime of call which we get on hangup?
[menu]
exten => 201,n,set(phone=${phno})
exten => 201,n,Dial(SIP/10.0.8.19/${phone})

exten => s,1,Answer()
exten => s,n,Goto(submenu,s,1)
exten => s,n,Hangup()

exten => h,n,Set(agent=${CDR(dstchannel):4:7})
exten => h,n,Set(ttime=${CDR(billsec)})
exten => h,n,Set(CURLOPT(httptimeout)=1)
exten => h,n,Set(CURLOPT(conntimeout)=1)
exten => h,n,set(foo=${CURL(API CALL)})

[submenu]
exten => s,1,NoOp(${campaign})
exten => s,n,Queue(QueueName,60,)
exten => s,n,Hangup()
exten => h,n,Set(agent=${CDR(dstchannel):4:7})
exten => h,n,Set(ttime=${CDR(billsec)})
exten => h,n,Set(CURLOPT(httptimeout)=1)
exten => h,n,Set(CURLOPT(conntimeout)=1)
exten => h,n,set(foo=${CURL(API CALL)})

And the complete console output?

If you do not want the Local channel going away you can add “/n” to the end of its dial string and it will stay around.

2 Likes