text stringlengths 0 152 |
|---|
Action: Login |
Username: hello |
Secret: world |
Response: Success |
Message: Authentication accepted |
Now you’re ready to originate your call. We’re doing essentially the same thing we did |
with the call file, only this time using the AMI: |
Action: Originate |
Channel: PJSIP/SOFTPHONE_A |
Context: sets |
Exten: 103 |
Priority: 1 |
You should hear SOFTPHONE_A ringing. As soon as you answer it, a call will be placed |
to SOFTPHONE_B. |
AMI is no longer involved in what’s going on. You can disconnect and the call will |
continue (leave the call up for now, as we’re going to work with the in-progress call |
next). |
Action: Logoff |
Response: Goodbye |
Message: Thanks for all the fish. |
Connection closed by foreign host. |
Example Usage |
| |
311 |
If you’ve already hung up the call, that’s no problem. You’ll just need to re-establish |
the call, which of course you can do simply by calling one extension from the other |
(101 to 103, or whatever you want). |
Redirecting a Call |
Redirecting (or transferring) a call from the AMI is another feature worth mention‐ |
ing. The Redirect AMI action can be used to send one or two channels to any other |
extension in the Asterisk dialplan. If you need to redirect two channels that are |
bridged together, do them both at the same time. Otherwise, once one channel has |
been redirected, the other will be hung up. |
An important thing to understand about Asterisk channels is that they don’t exist |
until a call is in progress. The name we all think of as the channel name (e.g., SOFT |
PHONE_A) is not in fact the channel name, but merely a reference to data that is used to |
create a channel. The naming of a channel takes place when a call is originated (which |
is when the channel is actually created). What all this means is that you have to deter‐ |
mine the full name of the channel before you can act on it. |
Originate a call, and then review the Event: Newchannel and you will see the channel |
name under the Channel: header. |
Action: Originate |
Channel: PJSIP/SOFTPHONE_A |
Context: sets |
Exten: 103 |
Priority: 1 |
Response: Success |
Message: Originate successfully queued |
Event: Newchannel |
Privilege: call,all |
Channel: PJSIP/SOFTPHONE_A-00000013 |
ChannelState: 0 |
ChannelStateDesc: Down |
CallerIDNum: <unknown> |
CallerIDName: <unknown> |
ConnectedLineNum: <unknown> |
ConnectedLineName: <unknown> |
Language: en |
AccountCode: |
Context: sets |
Exten: s |
Priority: 1 |
Uniqueid: 1538939479.29 |
Linkedid: 1538939479.29 |
The Newchannel event will provide the name of the created channel, which in this |
example is PJSIP/SOFTPHONE_A-00000013. |
312 |
| |
Chapter 17: Asterisk Manager Interface and Call Files |
You will need to keep track of these channel names if you wish to properly perform |
actions on calls in progress. Once the call ends, the channel is destroyed. A new call |
using the same endpoint will be assigned a different channel name. One channel defi‐ |
nition can support multiple calls (for example, multiple calls to a phone are possible), |
and this is why the channel name is different from the channel definition. |
You can redirect a single channel (the other channel will be disconnected): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.