Sip attended transfer


I’m really new to telephony and asterisk and I’ve been given the task of looking after our Mitel and Asterisk setup.

I’ve been given the task of writing a system whereby you can perform an attended transfer.

The setup is as follows:

Mitel HX controller with SIP extensions
Asterisk 13.21-cert3 connected to the Mitel as a SIP extension

I want to be able to:

  1. Take a call on the asterisk
  2. Place that call on hold
  3. Make an outgoing call to someone else e.g. an engineer
  4. If the engineer is available, I give the info and transfer the original call to the engineer

Now - It’s possible for me to do this via the AMI:


Action: Originate
Channel: SIP/6001
Context: from-internal
Exten: 1502
CallerIDName: Andy
Priority: 1
Callerid: 1234
Timeout: 30000
ActionID: 1

Action: Redirect
Channel: SIP/6001-00000070
Exten: 801234123123
Context: from-internal
Priority: 1

however it holds up the channels and my SIP extension on the Mitel will not be usable until the call is cleared. It seems that the AMI is only really concerned with calls within the scope asterisk SIP client as opposed to the Mitel SIP extension that it connects to.

What I need to do is tell the Mitel extension connected to asterisk (not my SIP client on asterisk) to hold the call and then SIP refer to the external engineer on another line so the internal channels are freed up and ready to take calls.

e.g. if I query the calls:

Action: Command
Command: core show channels concise

Response: Follows
Privilege: Command
SIP/mitel-0000001c!from-mitel!!1!Up!AppDial!(Outgoing Line)!1506!!!3!38!e2207eb2-e3cb-4e92-9705-728701709404!1541432516.49

which shows that the channels are taken up in asterisk, I don’t want the asterisk to do this - I want it to be done on the Mitel side. Anyone know how to achieve this?

I’ve done a packet capture of a standalone SIP phone doing a transfer and caught the SIP packet performing the REFER:

REFER sip:800987654321@ SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bK1299050164
From: "1309" <sip:1309@>;tag=2502563425
To: <sip:800987654321@>;tag=Mitel-5000_612337215-27353
Call-ID: 0_2113151096@
Contact: <sip:1309@>
Authorization: Digest username="big4int", realm="Mitel-5000-ICP", nonce="2e5a0816c63ff73ad2b05e5af93ccd1b", uri="sip:800987654321@", response="fd1a04f37bacdf8f05b801ca2c059ba7", algorithm=MD5, cnonce="0a4f113b", opaque="Mitel-5000-ICP", qop=auth, nc=00000003
Max-Forwards: 70
User-Agent: Yealink SIP-T21P_E2
Refer-To: <sip:1309@>
Event: refer
Referred-By: "1309" <sip:1309@>
Content-Length: 0

So - in effect I want to simulate this SIP command but within the context of using the AMI in asterisk - is this possible?

Or maybe to put it another way - how do I avoid Asterisk issuing out an INVITE and thus creating a bridge? Is there a way of forcing a REFER ?

I’ve tried to make this clear - apologies if I’ve missed out any important info, I’m totally new to this!



Asterisk does not provide the ability to have it initiate an attended transfer out over SIP. The only thing that exists is the Transfer() dialplan application which can be used to do a blind transfer or a 302 Redirect.

Thanks for the response, I think we’re going to have to get creative with an alternative solution so we’re now thinking of creating something bespoke with so we can automate as much as we can attended transfers to our engineers.