Call Hold / Transfer Via AMI
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.
—
5 thoughts on - Call Hold / Transfer Via AMI
Hi.
Nobody has any ideas?
I have an AMI login to a proprietary PBX (ie: I can’t see or modify the dial plan). I can subscribe to all events, get channel numbers when calls are set up, etc. I can issue AMI commands, originate calls…
How can I use AMI to put a call on hold, and then either resume it, or perform a transfer?
—
“Can you keep a secret?”
“Well, I shouldn’t really tell you this, but… no.”
Please reply to the list;
please *don’t* CC me.
—
1. How would seeing the dial plan help me to put a call on hold?
2. The result is pretty much useless to me because it’s all done via AGI.
Antony.
—
“If code doesn’t receive constant love, it turns to shit.”
– Brad Fitzpatrick, Google engineer
Please reply to the list;
please *don’t* CC me.
—
Hi.
From the lack of response to my question, I’m assuming that either:
a) putting a call on hold is not possible via AMI
or b) everyone thinks it’s so obvious that I should be able to see it for myself
Can anyone confirm one way or the other?
If it simply isn’t possible, I’d like to put my efforts into exploring alternative solutions instead of spending more time on AMI.
Thanks,
Antony.
—
“this restriction will not apply in the event of the occurrence (certified by the United States Centers for Disease Control or successor body) of a widespread viral infection transmitted via bites or contact with bodily fluids that causes human corpses to reanimate and seek to consume living human flesh, blood, brain or nerve tissue and is likely to result in the fall of organized civilization.”
– https://aws.amazon.com/service-terms/ paragraph 42.10
Please reply to the list;
please *don’t* CC me.
—
From a surface level I know of no way from AMI to control putting a call on and off hold.
V2UgZm91bmQgbm8gd2F5IHRvIGRvIHRoaXMgZnJvbSBBTUkuDQoNClZlcnkgdGllZCB1cCBvbiBv dGhlciBwcm9qZWN0cywgYnV0IGlmIGFub3RoZXIgZGV2ZWxvcGVyIHdhbnRlZCB0byBsb29rIGlu dG8gYWRkaW5nIHN1cHBvcnQgZm9yIGl0LCBJIGJlbGlldmUgaXQgd291bGQgYmUgc29tZXRoaW5n IGFsb25nIHRoZXNlIGxpbmVz4oCmLg0KDQoNCmludCBhY3Rpb25faG9sZChzdHJ1Y3QgbWFuc2Vz c2lvbiAqcywgY29uc3Qgc3RydWN0IG1lc3NhZ2UgKm0pDQp7DQogICAgY29uc3QgY2hhciAqY2hh bm5lbGFyZyA9IGFzdG1hbl9nZXRfaGVhZGVyKG0sICJDaGFubmVsIik7DQogICAgc3RydWN0IGFz dF9jaGFubmVsICpjaGFuID0gTlVMTDsNCiAgICBpbnQgcmVzID0gLTE7DQoNCiAgICBpZiAoYXN0
X3N0cmxlbl96ZXJvKGNoYW5uZWxhcmcpKQ0KICAgIHsNCi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