1

I am wondering if there is an easy way to hangup a channel created with Originate?

What I do is following:

  • Call in dialplan triggers Agi;

  • Agi starts AMI: Originate with Channel "SIP/201".

  • Now the extension rings. At answer I can bridge the channels. But, if the calling party leaves the call before the call is answered, I would like to stop the outgoing call. When I send AMI Hangup with Channel "SIP/201", It can't hangup originated call.

  • I can stop that call using 'hangup request channelname' using CLI

  • but how to hangup call using program.

please help me. how to hangup originated call

user3497518
  • 11
  • 1
  • 3

2 Answers2

0

If calling party leave call,it will be auto-hanguped with CANCEL cause.

You also can use AMI action Hangup

http://www.voip-info.org/wiki/view/Asterisk+Manager+API+Action+Hangup

BTW, very likly you just doing it wrong way.

arheops
  • 15,544
  • 1
  • 21
  • 27
  • Thank you for reply, my condition is that I want to record each and every incoming call in asterisk without passing to any extension. for some special numbers i need to only listen them with recording that's why i am originating call. the incoming call in asterisk will be like 3 way call. i dont need to speak there... – user3497518 Apr 05 '14 at 04:58
  • There are no 3way here. You have use Dial application. But better read books or hire expert. – arheops Apr 05 '14 at 05:07
0

Wanted to share my solution for cancelling issued Originate actions via AMI, since I haven't found clear solution anywhere else.

  1. Start a call (must be async)
Action: Originate
Timeout: 20000
Channel: SIP/007
Callerid: TEST
Context: default
Exten: 12345678900
Priority: 1
Async: yes
ActionID: 001
  1. Wait for Newchannel event which will be generated in few milliseconds
Event: Newchannel
Privilege: call,all
Channel: SIP/007-0000001c
ChannelState: 0
ChannelStateDesc: Down
CallerIDNum: 007
CallerIDName: Test
ConnectedLineNum: <unknown>
ConnectedLineName: <unknown>
Language: en
AccountCode:
Context: default
Exten: s
Priority: 1
Uniqueid: 1681218827.44
Linkedid: 1681218827.44
  1. Now it is possible to cancel this request using actual channel id
Action: Hangup
Channel: SIP/007-0000001c
ActionID: 002
Nik
  • 630
  • 1
  • 6
  • 17