[asterisk-users] Call Hold / Transfer via AMI

Antony Stone Antony.Stone at asterisk.open.source.it
Thu Jul 15 08:01:41 CDT 2021


Hi.

I have the following situation:

An Asterisk 16 server on which I have complete control of the dialplan, and 
which has (a) a SIP trunk to a PSTN gateway provider, and (b) several SIP 
credentials for accounts (extensions) on another Asterisk server.  For this 
example I have SIP username and password for extension 234 on that server.

That "other Asterisk server" is also Asterisk 16, but is a proprietary PBX 
which I cannot even see the dialplan of, let alone modify it.  I do, however, 
have full access to the AMI interface on that PBX, and I can write scripts 
(eg: in Perl) on my own server and connect to the PBX's AMI.

I get an inbound call on my SIP trunk, and I need to dial it on to extension 
456 on the PBX, from extension 234.  So far, so good, I can do all this.  The 
incoming call arrives, I use the SIP credentials for extension 234 to dial 
456, and the call gets answered by 456, who sees Caller ID 234.

Then I need to put 456 on hold, so that they get the hold music which is 
configured on the (proprietary) PBX, and perhaps I then need to dial to a 
different number from extension 234, and maybe ultimately transfer the call.  
Alternatively, I might simply want to resume the call that was put on hold.

Putting a call on hold and then having the option to transfer it to another 
number is easy with a SIP phone, but I need to do it for the call which my 
Asterisk server (acting as a SIP client to the PBX) has initiated.

I can't do the hold function on my own Asterisk server because that would not 
generate the correct hold music for the person on 456.

Also, if I transfer the call (so that 456 is now speaking to some other number 
which I dialled whilst on hold) using my own Asterisk server, I would end up 
with two calls in progress between my server and the PBX, whereas I want the 
PBX to completely handle the transferred call, and mine (which took the 
original incoming call on the SIP trunk) to have nothing further to do with 
it.

I can find AMI commands such as Atxfer, BlindTransfer, and Redirect.  All of 
these are fine if I want to actually transfer a call, but how do I simply tell 
the proprietary PBX to put a call on hold and play the configured music?

I hope this is clear - feel free to ask any questions if not.

Thanks,


Antony.

-- 
I have an excellent memory.
I can't think of a single thing I've forgotten.

                                                   Please reply to the list;
                                                         please *don't* CC me.



More information about the asterisk-users mailing list