-
Olle Johansson authored
(Testing SIPP thanks to JerJer and Greg) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Olle Johansson authored(Testing SIPP thanks to JerJer and Greg) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47541 65c4cc65-6c06-0410-ace0-fbb531ad65f3
chan_sip.c 610.92 KiB
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*!
* \file
* \brief Implementation of Session Initiation Protocol
*
* \author Mark Spencer <markster@digium.com>
*
* See Also:
* \arg \ref AstCREDITS
*
* Implementation of RFC 3261 - without S/MIME, TCP and TLS support
* Configuration file \link Config_sip sip.conf \endlink
*
*
* \todo SIP over TCP
* \todo SIP over TLS
* \todo Better support of forking
* \todo VIA branch tag transaction checking
* \todo Transaction support
*
* \ingroup channel_drivers
*
* \par Overview of the handling of SIP sessions
* The SIP channel handles several types of SIP sessions, or dialogs,
* not all of them being "telephone calls".
* - Incoming calls that will be sent to the PBX core
* - Outgoing calls, generated by the PBX
* - SIP subscriptions and notifications of states and voicemail messages
* - SIP registrations, both inbound and outbound
* - SIP peer management (peerpoke, OPTIONS)
* - SIP text messages
*
* In the SIP channel, there's a list of active SIP dialogs, which includes
* all of these when they are active. "sip show channels" in the CLI will
* show most of these, excluding subscriptions which are shown by
* "sip show subscriptions"
*
* \par incoming packets
* Incoming packets are received in the monitoring thread, then handled by
* sipsock_read(). This function parses the packet and matches an existing
* dialog or starts a new SIP dialog.
*
* sipsock_read sends the packet to handle_request(), that parses a bit more.
* if it's a response to an outbound request, it's sent to handle_response().
* If it is a request, handle_request sends it to one of a list of functions
* depending on the request type - INVITE, OPTIONS, REFER, BYE, CANCEL etc
* sipsock_read locks the ast_channel if it exists (an active call) and
* unlocks it after we have processed the SIP message.
*
* A new INVITE is sent to handle_request_invite(), that will end up
* starting a new channel in the PBX, the new channel after that executing
* in a separate channel thread. This is an incoming "call".
* When the call is answered, either by a bridged channel or the PBX itself