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 at 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.
-- Alex
Ishfaq Malik wrote:
> Hi
>
> All my incoming dial plans start of with an Answer which I now know
> starts the billing time. Some of the dialplans then get forwarded out to
> POTS via a carrier and so the actual amount of time that should be
> billed is being distorted.
>
> I've done a few tests this morning and found that if I don't start
with
> an answer then the billsec of my forwarded call is actually the length
> of time that the call was answered in reality and not the length of the
> call plus connection and answering time.
>
> My question is, does Answer have any major function that I am
> overlooking before I remove it from all my dial plans? Because it
> doesn't seem to to me.
>
> Thanks
>
> Ish
--
Alex Balashov - Principal
Evariste Systems
Web : http://www.evaristesys.com/
Tel : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671