Upgrade 3CX to v18 and get it hosted free!

Asterisk cmd Answer

Author image

Synopsis

Answer a channel if ringing

Description

Answer([delay])

If the channel is ringing, answer it, otherwise do nothing. If a delay is specified, Asterisk will wait this number of milliseconds AFTER answering the call. If you want to add a delay prior answering, use Wait.

Details

Recall that in regards to SIP implementation, Asterisk is a back-to-back user agent (B2BUA). This means that one logical call leg comes in, and another logical call leg is generated out, and the two are cross-connected. If SIP is not the signaling technology used on one or both channels, the effect is analogical where applicable. However, I will use SIP to illustrate the point; you can extrapolate from there similar effects on other channel types.

The function that Answer() has on a signaling level is to effect an “pickup” on the incoming call leg. In SIP, this is a 200 OK message. If you then proceed to Dial() out on another channel, any ringback generated out the first channel will be in-band; that is to say, it will be inside the acoustic bearer. A far-end pickup (200 OK) is necessary to exchange audio bidirectionally.

Some dial plan functions – mostly those that conceivably entail a two-way communication path – imply Answer() and will execute it for you if you have not already done so. Others do not. For example, it is possible to generate in-band ringback via “early media,” e.g. by sending a 183 Session in Progress message with an SDP payload to the sender. So, for example, if you were to do this:

exten => s,1,MusicOnHold

Without doing an Answer() first, the MOH would be played via early media without pickup.

By the same token, if you Dial() out before Answer()ing, the ringback generated will also be via early media (or, if applicable, out-of-band, depending on other settings):

exten => s,1,Dial(SIP/otherplace@other_peer)

This will not result in a 200 OK received on the far end of the incoming channel until there is a 200 OK received on the near end of the outgoing channel.

That is the function that Answer() serves. The option to remove it is contingent upon refraining from use of dial plan applications that implicitly invoke it.

See also


Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ


Article Reviews

Write a Review

Your email address will not be published. Required fields are marked *

Required Field. Minimum 5 characters.

Required Field. Minimum 5 characters, maximum 50.

Required field.There is an error with this field.

Required Field.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

There are no reviews for this article. Be the first one to write a review.

Related Posts:

Get 3CX - Absolutely Free!
Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.