[asterisk-commits] oej: branch oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk r3695...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 2 14:34:07 CDT 2012
Author: oej
Date: Mon Jul 2 14:34:04 2012
New Revision: 369536
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369536
Log:
Trying to reset this branch
Added:
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/include/asterisk/xmpp.h
- copied unchanged from r369527, trunk/include/asterisk/xmpp.h
Modified:
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/ (props changed)
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_dial.c
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_followme.c
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_queue.c
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_local.c
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_sip.c
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/sip/include/sip.h
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/funcs/func_channel.c
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/include/asterisk/channel.h
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/include/asterisk/pbx.h
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/include/asterisk/rtp_engine.h
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/main/autoservice.c
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/main/channel.c
team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/main/features.c
Propchange: team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/
('svnmerge-integrated' removed)
Modified: team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_dial.c?view=diff&rev=369536&r1=369535&r2=369536
==============================================================================
--- team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_dial.c (original)
+++ team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_dial.c Mon Jul 2 14:34:04 2012
@@ -1881,7 +1881,8 @@
}
return 0; /* the good exit path */
} else {
- ast_hangup(peer); /* hang up on the callee -- he didn't want to talk anyway! */
+ /* hang up on the callee -- he didn't want to talk anyway! */
+ ast_autoservice_chan_hangup_peer(chan, peer);
return -1;
}
}
@@ -2774,7 +2775,7 @@
if (active_chan) {
struct ast_frame *fr = ast_read(active_chan);
if (!fr) {
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
res = -1;
goto done;
}
@@ -2790,7 +2791,7 @@
switch (fr->subclass.integer) {
case AST_CONTROL_HANGUP:
ast_frfree(fr);
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
res = -1;
goto done;
default:
@@ -2821,7 +2822,7 @@
ast_channel_exten_set(peer, ast_channel_exten(chan));
ast_channel_priority_set(peer, ast_channel_priority(chan) + 2);
if (ast_pbx_start(peer)) {
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
}
hanguptree(&out_chans, NULL, ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE) ? 1 : 0);
if (continue_exec)
@@ -3027,7 +3028,7 @@
res = ast_channel_make_compatible(chan, peer);
if (res < 0) {
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(chan), ast_channel_name(peer));
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
res = -1;
goto done;
}
@@ -3047,28 +3048,9 @@
if (ast_test_flag64(&opts, OPT_PEER_H)
&& ast_exists_extension(peer, ast_channel_context(peer), "h", 1,
S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL))) {
- int autoloopflag;
- int found;
- int res9;
-
- ast_channel_exten_set(peer, "h");
- ast_channel_priority_set(peer, 1);
- autoloopflag = ast_test_flag(ast_channel_flags(peer), AST_FLAG_IN_AUTOLOOP); /* save value to restore at the end */
- ast_set_flag(ast_channel_flags(peer), AST_FLAG_IN_AUTOLOOP);
-
- while ((res9 = ast_spawn_extension(peer, ast_channel_context(peer), ast_channel_exten(peer),
- ast_channel_priority(peer),
- S_COR(ast_channel_caller(peer)->id.number.valid, ast_channel_caller(peer)->id.number.str, NULL),
- &found, 1)) == 0) {
- ast_channel_priority_set(peer, ast_channel_priority(peer) + 1);
- }
-
- if (found && res9) {
- /* Something bad happened, or a hangup has been requested. */
- ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", ast_channel_context(peer), ast_channel_exten(peer), ast_channel_priority(peer), ast_channel_name(peer));
- ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", ast_channel_context(peer), ast_channel_exten(peer), ast_channel_priority(peer), ast_channel_name(peer));
- }
- ast_set2_flag(ast_channel_flags(peer), autoloopflag, AST_FLAG_IN_AUTOLOOP); /* set it back the way it was */
+ ast_autoservice_start(chan);
+ ast_pbx_h_exten_run(peer, ast_channel_context(peer));
+ ast_autoservice_stop(chan);
}
if (!ast_check_hangup(peer)) {
if (ast_test_flag64(&opts, OPT_CALLEE_GO_ON)) {
@@ -3089,7 +3071,7 @@
ast_channel_hangupcause_set(chan, ast_channel_hangupcause(peer));
}
}
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(chan, peer);
}
out:
if (moh) {
Modified: team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_followme.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_followme.c?view=diff&rev=369536&r1=369535&r2=369536
==============================================================================
--- team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_followme.c (original)
+++ team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_followme.c Mon Jul 2 14:34:04 2012
@@ -1490,7 +1490,7 @@
res = ast_channel_make_compatible(caller, outbound);
if (res < 0) {
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(caller), ast_channel_name(outbound));
- ast_hangup(outbound);
+ ast_autoservice_chan_hangup_peer(caller, outbound);
goto outrun;
}
@@ -1513,7 +1513,7 @@
}
res = ast_bridge_call(caller, outbound, &config);
- ast_hangup(outbound);
+ ast_autoservice_chan_hangup_peer(caller, outbound);
}
outrun:
Modified: team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_queue.c?view=diff&rev=369536&r1=369535&r2=369536
==============================================================================
--- team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_queue.c (original)
+++ team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/apps/app_queue.c Mon Jul 2 14:34:04 2012
@@ -5266,7 +5266,7 @@
"%s",
queuename, ast_channel_uniqueid(qe->chan), ast_channel_name(peer), member->interface, member->membername,
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
ao2_ref(member, -1);
goto out;
} else if (ast_check_hangup(qe->chan)) {
@@ -5274,7 +5274,7 @@
ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", ast_channel_name(peer));
ast_queue_log(queuename, ast_channel_uniqueid(qe->chan), member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
record_abandoned(qe);
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
ao2_ref(member, -1);
return -1;
}
@@ -5296,7 +5296,7 @@
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", ast_channel_name(qe->chan), ast_channel_name(peer));
record_abandoned(qe);
ast_cdr_failed(ast_channel_cdr(qe->chan));
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
ao2_ref(member, -1);
return -1;
}
@@ -5673,10 +5673,10 @@
caller_priority + 1);
}
if (goto_res || ast_pbx_start(peer)) {
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
}
} else {
- ast_hangup(peer);
+ ast_autoservice_chan_hangup_peer(qe->chan, peer);
}
res = bridge ? bridge : 1;
Modified: team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_local.c?view=diff&rev=369536&r1=369535&r2=369536
==============================================================================
--- team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_local.c (original)
+++ team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_local.c Mon Jul 2 14:34:04 2012
@@ -238,6 +238,12 @@
return -1;
}
+ if (!strcmp(write_info->function, "CHANNEL")
+ && !strncasecmp(write_info->data, "hangup_handler_", 15)) {
+ /* Block CHANNEL(hangup_handler_xxx) writes to the other local channel. */
+ return 0;
+ }
+
/* get the tech pvt */
if (!(p = ast_channel_tech_pvt(ast))) {
return -1;
Modified: team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_sip.c?view=diff&rev=369536&r1=369535&r2=369536
==============================================================================
--- team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_sip.c (original)
+++ team/oej/appleraisin-being-able-to-store-astdb-in-realtime-trunk/channels/chan_sip.c Mon Jul 2 14:34:04 2012
@@ -158,11 +158,11 @@
* channel variable in the dialplan.
* get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoing_req)
* - As above, if we have a SIPS: uri in the refer-to header
- * - Does not check transport in refer_to uri.
+ * - Does not check transport in refer_to uri.
*/
/*** MODULEINFO
- <use type="module">res_crypto</use>
+ <use>res_crypto</use>
<depend>chan_local</depend>
<support_level>core</support_level>
***/
@@ -230,7 +230,6 @@
affect the speed of the program at all. They can be considered to be documentation.
*/
/* #define REF_DEBUG 1 */
-
#include "asterisk/lock.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
@@ -265,7 +264,6 @@
#include "asterisk/cel.h"
#include "asterisk/data.h"
#include "asterisk/aoc.h"
-#include "asterisk/message.h"
#include "sip/include/sip.h"
#include "sip/include/globals.h"
#include "sip/include/config_parser.h"
@@ -277,8 +275,7 @@
#include "asterisk/xml.h"
#include "sip/include/dialog.h"
#include "sip/include/dialplan_functions.h"
-#include "sip/include/security_events.h"
-#include "asterisk/sip_api.h"
+
/*** DOCUMENTATION
<application name="SIPDtmfMode" language="en_US">
@@ -340,20 +337,6 @@
<para>Always returns <literal>0</literal>.</para>
</description>
</application>
- <application name="SIPSendCustomINFO" language="en_US">
- <synopsis>
- Send a custom INFO frame on specified channels.
- </synopsis>
- <syntax>
- <parameter name="Data" required="true" />
- <parameter name="UserAgent" required="false" />
- </syntax>
- <description>
- <para>SIPSendCustomINFO() allows you to send a custom INFO message on all
- active SIP channels or on channels with the specified User Agent. This
- application is only available if TEST_FRAMEWORK is defined.</para>
- </description>
- </application>
<function name="SIP_HEADER" language="en_US">
<synopsis>
Gets the specified SIP header from an incoming INVITE message.
@@ -368,8 +351,6 @@
<para>Since there are several headers (such as Via) which can occur multiple
times, SIP_HEADER takes an optional second argument to specify which header with
that name to retrieve. Headers start at offset <literal>1</literal>.</para>
- <para>Please observe that contents of the SDP (an attachment to the
- SIP request) can't be accessed with this function.</para>
</description>
</function>
<function name="SIPPEER" language="en_US">
@@ -381,7 +362,7 @@
<parameter name="item">
<enumlist>
<enum name="ip">
- <para>(default) The IP address.</para>
+ <para>(default) The ip address.</para>
</enum>
<enum name="port">
<para>The port number.</para>
@@ -417,7 +398,7 @@
<para>Status (if qualify=yes).</para>
</enum>
<enum name="regexten">
- <para>Extension activated at registration.</para>
+ <para>Registration extension.</para>
</enum>
<enum name="limit">
<para>Call limit (call-limit).</para>
@@ -435,7 +416,7 @@
<para>Account code for this peer.</para>
</enum>
<enum name="useragent">
- <para>Current user agent header used by peer.</para>
+ <para>Current user agent id for peer.</para>
</enum>
<enum name="maxforwards">
<para>The value used for SIP loop prevention in outbound requests</para>
@@ -465,13 +446,13 @@
<para>The source IP address of the peer.</para>
</enum>
<enum name="from">
- <para>The SIP URI from the <literal>From:</literal> header.</para>
+ <para>The URI from the <literal>From:</literal> header.</para>
</enum>
<enum name="uri">
- <para>The SIP URI from the <literal>Contact:</literal> header.</para>
+ <para>The URI from the <literal>Contact:</literal> header.</para>
</enum>
<enum name="useragent">
- <para>The Useragent header used by the peer.</para>
+ <para>The useragent.</para>
</enum>
<enum name="peername">
<para>The name of the peer.</para>
@@ -508,8 +489,8 @@
</syntax>
<description>
<para>Lists SIP peers in text format with details on current status.
- <literal>Peerlist</literal> will follow as separate events, followed by a final event called
- <literal>PeerlistComplete</literal>.</para>
+ Peerlist will follow as separate events, followed by a final event called
+ PeerlistComplete.</para>
</description>
</manager>
<manager name="SIPshowpeer" language="en_US">
@@ -549,7 +530,7 @@
</syntax>
<description>
<para>Lists all registration requests and status. Registrations will follow as separate
- events followed by a final event called <literal>RegistrationsComplete</literal>.</para>
+ events. followed by a final event called RegistrationsComplete.</para>
</description>
</manager>
<manager name="SIPnotify" language="en_US">
@@ -569,7 +550,7 @@
<description>
<para>Sends a SIP Notify event.</para>
<para>All parameters for this event must be specified in the body of this request
- via multiple <literal>Variable: name=value</literal> sequences.</para>
+ via multiple Variable: name=value sequences.</para>
</description>
</manager>
***/
@@ -686,8 +667,7 @@
{ AST_REDIRECTING_REASON_FOLLOW_ME, "follow-me" },
{ AST_REDIRECTING_REASON_OUT_OF_ORDER, "out-of-service" },
{ AST_REDIRECTING_REASON_AWAY, "away" },
- { AST_REDIRECTING_REASON_CALL_FWD_DTE, "unknown"},
- { AST_REDIRECTING_REASON_SEND_TO_VM, "send_to_vm"},
+ { AST_REDIRECTING_REASON_CALL_FWD_DTE, "unknown"}
};
@@ -704,7 +684,6 @@
static char default_notifymime[AST_MAX_EXTENSION]; /*!< Default MIME media type for MWI notify messages */
static char default_vmexten[AST_MAX_EXTENSION]; /*!< Default From Username on MWI updates */
static int default_qualify; /*!< Default Qualify= setting */
-static int default_keepalive; /*!< Default keepalive= setting */
static char default_mohinterpret[MAX_MUSICCLASS]; /*!< Global setting for moh class to use when put on hold */
static char default_mohsuggest[MAX_MUSICCLASS]; /*!< Global setting for moh class to suggest when putting
* a bridged channel on hold */
@@ -712,7 +691,6 @@
static char default_engine[256]; /*!< Default RTP engine */
static int default_maxcallbitrate; /*!< Maximum bitrate for call */
static struct ast_codec_pref default_prefs; /*!< Default codec prefs */
-static char default_zone[MAX_TONEZONE_COUNTRY]; /*!< Default tone zone for channels created from the SIP driver */
static unsigned int default_transports; /*!< Default Transports (enum sip_transport) that are acceptable */
static unsigned int default_primary_transport; /*!< Default primary Transport (enum sip_transport) for outbound connections to devices */
/*@}*/
@@ -723,7 +701,7 @@
/*!< use this macro when ast_uri_decode is dependent on pedantic checking to be on. */
#define SIP_PEDANTIC_DECODE(str) \
if (sip_cfg.pedanticsipchecking && !ast_strlen_zero(str)) { \
- ast_uri_decode(str, ast_uri_sip_user); \
+ ast_uri_decode(str); \
} \
static unsigned int chan_idx; /*!< used in naming sip channel */
@@ -812,7 +790,7 @@
static int sip_reloading = FALSE; /*!< Flag for avoiding multiple reloads at the same time */
static enum channelreloadreason sip_reloadreason; /*!< Reason for last reload/load of configuration */
-struct ast_sched_context *sched; /*!< The scheduling context */
+struct sched_context *sched; /*!< The scheduling context */
static struct io_context *io; /*!< The IO context */
static int *sipsock_read_id; /*!< ID of IO entry for sipsock FD */
struct sip_pkt;
@@ -1106,31 +1084,13 @@
}
}
-struct state_notify_data {
- int state;
- int presence_state;
- const char *presence_subtype;
- const char *presence_message;
-};
-
/*!
* \details
- * Here we implement the container for dialogs which are in the
- * dialog_needdestroy state to iterate only through the dialogs
- * unlink them instead of iterate through all dialogs
+ * This container holds the dialogs that will be destroyed immediately.
*/
-struct ao2_container *dialogs_needdestroy;
-
-/*!
- * \details
- * Here we implement the container for dialogs which have rtp
- * traffic and rtptimeout, rtpholdtimeout or rtpkeepalive
- * set. We use this container instead the whole dialog list.
- */
-struct ao2_container *dialogs_rtpcheck;
-
-/*!
- * \details
+struct ao2_container *dialogs_to_destroy;
+
+/*! \brief
* Here we implement the container for dialogs (sip_pvt), defining
* generic wrapper functions to ease the transition from the current
* implementation (a single linked list) to a different container.
@@ -1220,7 +1180,7 @@
static char externhost[MAXHOSTNAMELEN]; /*!< External host name */
static time_t externexpire; /*!< Expiration counter for re-resolving external host name in dynamic DNS */
static int externrefresh = 10; /*!< Refresh timer for DNS-based external address (dyndns) */
-static uint16_t externtcpport; /*!< external tcp port */
+static uint16_t externtcpport; /*!< external tcp port */
static uint16_t externtlsport; /*!< external tls port */
/*! \brief List of local networks
@@ -1251,10 +1211,10 @@
in coming releases. */
/*--- PBX interface functions */
-static struct ast_channel *sip_request_call(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *dest, int *cause);
-static int sip_devicestate(const char *data);
+static struct ast_channel *sip_request_call(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
+static int sip_devicestate(void *data);
static int sip_sendtext(struct ast_channel *ast, const char *text);
-static int sip_call(struct ast_channel *ast, const char *dest, int timeout);
+static int sip_call(struct ast_channel *ast, char *dest, int timeout);
static int sip_sendhtml(struct ast_channel *chan, int subclass, const char *data, int datalen);
static int sip_hangup(struct ast_channel *ast);
static int sip_answer(struct ast_channel *ast);
@@ -1272,7 +1232,7 @@
static int handle_request_do(struct sip_request *req, struct ast_sockaddr *addr);
static int sip_standard_port(enum sip_transport type, int port);
static int sip_prepare_socket(struct sip_pvt *p);
-static int get_address_family_filter(const struct ast_sockaddr *addr);
+static int get_address_family_filter(unsigned int transport);
/*--- Transmitting responses and requests */
static int sipsock_read(int *id, int fd, short events, void *ignore);
@@ -1299,7 +1259,7 @@
static int transmit_info_with_aoc(struct sip_pvt *p, struct ast_aoc_decoded *decoded);
static int transmit_info_with_digit(struct sip_pvt *p, const char digit, unsigned int duration);
static int transmit_info_with_vidupdate(struct sip_pvt *p);
-static int transmit_message(struct sip_pvt *p, int init, int auth);
+static int transmit_message_with_text(struct sip_pvt *p, const char *text);
static int transmit_refer(struct sip_pvt *p, const char *dest);
static int transmit_notify_with_mwi(struct sip_pvt *p, int newmsgs, int oldmsgs, const char *vmexten);
static int transmit_notify_with_sipfrag(struct sip_pvt *p, int cseq, char *message, int terminate);
@@ -1308,7 +1268,7 @@
static int send_response(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, uint32_t seqno);
static int send_request(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, uint32_t seqno);
static void copy_request(struct sip_request *dst, const struct sip_request *src);
-static void receive_message(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e);
+static void receive_message(struct sip_pvt *p, struct sip_request *req);
static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req, char **name, char **number, int set_call_forward);
static int sip_send_mwi_to_peer(struct sip_peer *peer, int cache_only);
@@ -1347,7 +1307,7 @@
static int process_sdp_a_video(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newvideortp, int *last_rtpmap_codec);
static int process_sdp_a_text(const char *a, struct sip_pvt *p, struct ast_rtp_codecs *newtextrtp, char *red_fmtp, int *red_num_gen, int *red_data_pt, int *last_rtpmap_codec);
static int process_sdp_a_image(const char *a, struct sip_pvt *p);
-static void add_codec_to_sdp(const struct sip_pvt *p, struct ast_format *codec,
+static void add_codec_to_sdp(const struct sip_pvt *p, format_t codec,
struct ast_str **m_buf, struct ast_str **a_buf,
int debug, int *min_packet_size);
static void add_noncodec_to_sdp(const struct sip_pvt *p, int format,
@@ -1378,7 +1338,7 @@
static struct sip_auth *find_realm_authentication(struct sip_auth_container *credentials, const char *realm);
/*--- Misc functions */
-static int check_rtp_timeout(struct sip_pvt *dialog, time_t t);
+static void check_rtp_timeout(struct sip_pvt *dialog, time_t t);
static int reload_config(enum channelreloadreason reason);
static void add_diversion_header(struct sip_request *req, struct sip_pvt *pvt);
static int expire_register(const void *data);
@@ -1396,15 +1356,14 @@
static int do_magic_pickup(struct ast_channel *channel, const char *extension, const char *context);
/*--- Device monitoring and Device/extension state/event handling */
-static int extensionstate_update(char *context, char *exten, struct state_notify_data *data, struct sip_pvt *p);
-static int cb_extensionstate(char *context, char *exten, struct ast_state_cb_info *info, void *data);
+static int cb_extensionstate(char *context, char* exten, int state, void *data);
+static int sip_devicestate(void *data);
static int sip_poke_noanswer(const void *data);
static int sip_poke_peer(struct sip_peer *peer, int force);
static void sip_poke_all_peers(void);
static void sip_peer_hold(struct sip_pvt *p, int hold);
static void mwi_event_cb(const struct ast_event *, void *);
static void network_change_event_cb(const struct ast_event *, void *);
-static void sip_keepalive_all_peers(void);
/*--- Applications, functions, CLI and manager command helpers */
static const char *sip_nat_mode(const struct sip_pvt *p);
@@ -1456,6 +1415,8 @@
const char *name, int flag, int family);
static int ast_sockaddr_resolve_first(struct ast_sockaddr *addr,
const char *name, int flag);
+static int ast_sockaddr_resolve_first_transport(struct ast_sockaddr *addr,
+ const char *name, int flag, unsigned int transport);
/*--- Debugging
Functions for enabling debug per IP or fully, or enabling history logging for
@@ -1475,6 +1436,7 @@
static void set_peer_defaults(struct sip_peer *peer);
static struct sip_peer *temp_peer(const char *name);
static void register_peer_exten(struct sip_peer *peer, int onoff);
+static struct sip_peer *find_peer(const char *peer, struct ast_sockaddr *addr, int realtime, int forcenamematch, int devstate_only, int transport);
static int sip_poke_peer_s(const void *data);
static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, struct sip_peer *p, struct sip_request *req);
static void reg_source_db(struct sip_peer *peer);
@@ -1482,14 +1444,13 @@
static void set_insecure_flags(struct ast_flags *flags, const char *value, int lineno);
static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v);
static void set_socket_transport(struct sip_socket *socket, int transport);
-static int peer_ipcmp_cb_full(void *obj, void *arg, void *data, int flags);
/* Realtime device support */
static void realtime_update_peer(const char *peername, struct ast_sockaddr *addr, const char *username, const char *fullcontact, const char *useragent, int expirey, unsigned short deprecated_username, int lastms);
static void update_peer(struct sip_peer *p, int expire);
static struct ast_variable *get_insecure_variable_from_config(struct ast_config *config);
static const char *get_name_from_variable(const struct ast_variable *var);
-static struct sip_peer *realtime_peer(const char *peername, struct ast_sockaddr *sin, char *callbackexten, int devstate_only, int which_objects);
+static struct sip_peer *realtime_peer(const char *peername, struct ast_sockaddr *sin, int devstate_only, int which_objects);
static char *sip_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
/*--- Internal UA client handling (outbound registrations) */
@@ -1512,10 +1473,10 @@
static unsigned int parse_allowed_methods(struct sip_request *req);
static unsigned int set_pvt_allowed_methods(struct sip_pvt *pvt, struct sip_request *req);
static int parse_request(struct sip_request *req);
+static const char *get_header(const struct sip_request *req, const char *name);
static const char *referstatus2str(enum referstatus rstatus) attribute_pure;
static int method_match(enum sipmethod id, const char *name);
static void parse_copy(struct sip_request *dst, const struct sip_request *src);
-static void parse_oli(struct sip_request *req, struct ast_channel *chan);
static const char *find_alias(const char *name, const char *_default);
static const char *__get_header(const struct sip_request *req, const char *name, int *start);
static void lws2sws(struct ast_str *msgbuf);
@@ -1530,7 +1491,7 @@
static int get_rdnis(struct sip_pvt *p, struct sip_request *oreq, char **name, char **number, int *reason);
static enum sip_get_dest_result get_destination(struct sip_pvt *p, struct sip_request *oreq, int *cc_recall_core_id);
static int get_msg_text(char *buf, int len, struct sip_request *req);
-static int transmit_state_notify(struct sip_pvt *p, struct state_notify_data *data, int full, int timeout);
+static int transmit_state_notify(struct sip_pvt *p, int state, int full, int timeout);
static void update_connectedline(struct sip_pvt *p, const void *data, size_t datalen);
static void update_redirecting(struct sip_pvt *p, const void *data, size_t datalen);
static int get_domain(const char *str, char *domain, int len);
@@ -1562,8 +1523,7 @@
static int add_header_max_forwards(struct sip_pvt *dialog, struct sip_request *req);
static int add_content(struct sip_request *req, const char *line);
static int finalize_content(struct sip_request *req);
-static void destroy_msg_headers(struct sip_pvt *pvt);
-static int add_text(struct sip_request *req, struct sip_pvt *p);
+static int add_text(struct sip_request *req, const char *text);
static int add_digit(struct sip_request *req, char digit, unsigned int duration, int mode);
static int add_rpid(struct sip_request *req, struct sip_pvt *p);
static int add_vidupdate(struct sip_request *req);
@@ -1583,7 +1543,7 @@
static int handle_request_bye(struct sip_pvt *p, struct sip_request *req);
static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *sin, const char *e);
static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req);
-static int handle_request_message(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e);
+static int handle_request_message(struct sip_pvt *p, struct sip_request *req);
static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, uint32_t seqno, const char *e);
static void handle_request_info(struct sip_pvt *p, struct sip_request *req);
static int handle_request_options(struct sip_pvt *p, struct sip_request *req, struct ast_sockaddr *addr, const char *e);
@@ -1625,7 +1585,7 @@
static struct sip_st_dlg* sip_st_alloc(struct sip_pvt *const p);
/*------- RTP Glue functions -------- */
-static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, const struct ast_format_cap *cap, int nat_active);
+static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, format_t codecs, int nat_active);
/*!--- SIP MWI Subscription support */
static int sip_subscribe_mwi(const char *value, int lineno);
@@ -1635,9 +1595,10 @@
static int __sip_subscribe_mwi_do(struct sip_subscription_mwi *mwi);
/*! \brief Definition of this channel for PBX channel registration */
-struct ast_channel_tech sip_tech = {
+const struct ast_channel_tech sip_tech = {
.type = "SIP",
.description = "Session Initiation Protocol (SIP)",
+ .capabilities = AST_FORMAT_AUDIO_MASK, /* all audio formats */
.properties = AST_CHAN_TP_WANTSJITTER | AST_CHAN_TP_CREATESJITTER,
.requester = sip_request_call, /* called with chan unlocked */
.devicestate = sip_devicestate, /* called with chan unlocked (not chan-specific) */
@@ -1671,7 +1632,6 @@
*/
struct ast_channel_tech sip_tech_info;
-/*------- CC Support -------- */
static int sip_cc_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan);
static int sip_cc_agent_start_offer_timer(struct ast_cc_agent *agent);
static int sip_cc_agent_stop_offer_timer(struct ast_cc_agent *agent);
@@ -1741,13 +1701,13 @@
static int sip_cc_agent_init(struct ast_cc_agent *agent, struct ast_channel *chan)
{
struct sip_cc_agent_pvt *agent_pvt = ast_calloc(1, sizeof(*agent_pvt));
- struct sip_pvt *call_pvt = ast_channel_tech_pvt(chan);
+ struct sip_pvt *call_pvt = chan->tech_pvt;
if (!agent_pvt) {
return -1;
}
- ast_assert(!strcmp(ast_channel_tech(chan)->type, "SIP"));
+ ast_assert(!strcmp(chan->tech->type, "SIP"));
ast_copy_string(agent_pvt->original_callid, call_pvt->callid, sizeof(agent_pvt->original_callid));
ast_copy_string(agent_pvt->original_exten, call_pvt->exten, sizeof(agent_pvt->original_exten));
@@ -1967,7 +1927,7 @@
return -1;
}
- if (!(monitor_instance->subscription_pvt = sip_alloc(NULL, NULL, 0, SIP_SUBSCRIBE, NULL, NULL))) {
+ if (!(monitor_instance->subscription_pvt = sip_alloc(NULL, NULL, 0, SIP_SUBSCRIBE, NULL))) {
return -1;
}
@@ -2108,7 +2068,7 @@
static int sip_get_cc_information(struct sip_request *req, char *subscribe_uri, size_t size, enum ast_cc_service_type *service)
{
- char *call_info = ast_strdupa(sip_get_header(req, "Call-Info"));
+ char *call_info = ast_strdupa(get_header(req, "Call-Info"));
char *uri;
char *purpose;
char *service_str;
@@ -2260,7 +2220,7 @@
\return Always returns 0 */
#define append_history(p, event, fmt , args... ) append_history_full(p, "%-15s " fmt, event, ## args)
-struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func)
+struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
{
if (p)
#ifdef REF_DEBUG
@@ -2273,7 +2233,7 @@
return p;
}
-struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func)
+struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
{
if (p)
#ifdef REF_DEBUG
@@ -2291,11 +2251,9 @@
{
const struct _map_x_s *cur;
- for (cur = table; cur->s; cur++) {
- if (cur->x == x) {
+ for (cur = table; cur->s; cur++)
+ if (cur->x == x)
return cur->s;
- }
- }
return errorstring;
}
@@ -2306,11 +2264,9 @@
{
const struct _map_x_s *cur;
- for (cur = table; cur->s; cur++) {
- if (!strcasecmp(cur->s, s)) {
+ for (cur = table; cur->s; cur++)
+ if (!strcasecmp(cur->s, s))
return cur->x;
- }
- }
return errorvalue;
}
@@ -2352,18 +2308,18 @@
else if (!(peer->transports & tmpl->socket.type)) {\
ast_log(LOG_ERROR, \
"'%s' is not a valid transport for '%s'. we only use '%s'! ending call.\n", \
- sip_get_transport(tmpl->socket.type), peer->name, get_transport_list(peer->transports) \
+ get_transport(tmpl->socket.type), peer->name, get_transport_list(peer->transports) \
); \
ret = 1; \
} else if (peer->socket.type & SIP_TRANSPORT_TLS) { \
ast_log(LOG_WARNING, \
"peer '%s' HAS NOT USED (OR SWITCHED TO) TLS in favor of '%s' (but this was allowed in sip.conf)!\n", \
- peer->name, sip_get_transport(tmpl->socket.type) \
+ peer->name, get_transport(tmpl->socket.type) \
); \
} else { \
ast_debug(1, \
"peer '%s' has contacted us over %s even though we prefer %s.\n", \
- peer->name, sip_get_transport(tmpl->socket.type), sip_get_transport(peer->socket.type) \
+ peer->name, get_transport(tmpl->socket.type), get_transport(peer->socket.type) \
); \
}\
(ret); \
@@ -2410,7 +2366,6 @@
{
struct sip_threadinfo *th = obj;
struct tcptls_packet *packet;
-
if (th->alert_pipe[1] > -1) {
close(th->alert_pipe[0]);
}
@@ -2467,7 +2422,7 @@
return XMIT_ERROR;
}
- ao2_lock(tcptls_session);
+ ast_mutex_lock(&tcptls_session->lock);
if ((tcptls_session->fd == -1) ||
!(th = ao2_t_find(threadt, &tmp, OBJ_POINTER, "ao2_find, getting sip_threadinfo in tcp helper thread")) ||
@@ -2494,7 +2449,7 @@
}
ao2_unlock(th);
- ao2_unlock(tcptls_session);
+ ast_mutex_unlock(&tcptls_session->lock);
ao2_t_ref(th, -1, "In sip_tcptls_write, unref threadinfo object after finding it");
return res;
@@ -2505,7 +2460,7 @@
if (packet) {
ao2_t_ref(packet, -1, "could not allocate packet's data");
}
- ao2_unlock(tcptls_session);
+ ast_mutex_unlock(&tcptls_session->lock);
return XMIT_ERROR;
}
@@ -2719,9 +2674,9 @@
}
}
- ao2_lock(tcptls_session);
+ ast_mutex_lock(&tcptls_session->lock);
if (!fgets(buf, sizeof(buf), tcptls_session->f)) {
- ao2_unlock(tcptls_session);
+ ast_mutex_unlock(&tcptls_session->lock);
if (after_poll) {
goto cleanup;
} else {
@@ -2729,7 +2684,7 @@
continue;
}
}
- ao2_unlock(tcptls_session);
+ ast_mutex_unlock(&tcptls_session->lock);
after_poll = 0;
if (me->stop) {
goto cleanup;
@@ -2739,7 +2694,7 @@
copy_request(&reqcpy, &req);
parse_request(&reqcpy);
/* In order to know how much to read, we need the content-length header */
- if (sscanf(sip_get_header(&reqcpy, "Content-Length"), "%30d", &cl)) {
+ if (sscanf(get_header(&reqcpy, "Content-Length"), "%30d", &cl)) {
while (cl > 0) {
size_t bytes_read;
if (!tcptls_session->client && !authenticated ) {
@@ -2769,9 +2724,9 @@
}
}
- ao2_lock(tcptls_session);
+ ast_mutex_lock(&tcptls_session->lock);
if (!(bytes_read = fread(buf, 1, MIN(sizeof(buf) - 1, cl), tcptls_session->f))) {
- ao2_unlock(tcptls_session);
+ ast_mutex_unlock(&tcptls_session->lock);
if (after_poll) {
goto cleanup;
} else {
@@ -2780,7 +2735,7 @@
}
}
buf[bytes_read] = '\0';
- ao2_unlock(tcptls_session);
+ ast_mutex_unlock(&tcptls_session->lock);
after_poll = 0;
if (me->stop) {
goto cleanup;
@@ -2850,10 +2805,10 @@
}
if (tcptls_session) {
- ao2_lock(tcptls_session);
+ ast_mutex_lock(&tcptls_session->lock);
ast_tcptls_close_session_file(tcptls_session);
tcptls_session->parent = NULL;
- ao2_unlock(tcptls_session);
+ ast_mutex_unlock(&tcptls_session->lock);
ao2_ref(tcptls_session, -1);
tcptls_session = NULL;
@@ -2862,8 +2817,8 @@
}
#ifdef REF_DEBUG
-#define sip_ref_peer(arg1,arg2) _ref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define sip_unref_peer(arg1,arg2) _unref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define ref_peer(arg1,arg2) _ref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
+#define unref_peer(arg1,arg2) _unref_peer((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
static struct sip_peer *_ref_peer(struct sip_peer *peer, char *tag, char *file, int line, const char *func)
{
if (peer)
@@ -2885,13 +2840,13 @@
* By handling them this way, we don't have to declare the
* destructor on each call, which removes the chance of errors.
*/
-void *sip_unref_peer(struct sip_peer *peer, char *tag)
+static void *unref_peer(struct sip_peer *peer, char *tag)
{
ao2_t_ref(peer, -1, tag);
return NULL;
}
-struct sip_peer *sip_ref_peer(struct sip_peer *peer, char *tag)
+static struct sip_peer *ref_peer(struct sip_peer *peer, char *tag)
{
ao2_t_ref(peer, 1, tag);
return peer;
@@ -2902,15 +2857,11 @@
{
if (peer->pokeexpire != -1) {
AST_SCHED_DEL_UNREF(sched, peer->pokeexpire,
- sip_unref_peer(peer, "removing poke peer ref"));
+ unref_peer(peer, "removing poke peer ref"));
}
if (peer->expire != -1) {
AST_SCHED_DEL_UNREF(sched, peer->expire,
- sip_unref_peer(peer, "remove register expire ref"));
- }
- if (peer->keepalivesend != -1) {
- AST_SCHED_DEL_UNREF(sched, peer->keepalivesend,
- sip_unref_peer(peer, "remove keepalive peer ref"));
+ unref_peer(peer, "remove register expire ref"));
}
}
@@ -2931,7 +2882,7 @@
if (peer->dnsmgr) {
ast_dnsmgr_release(peer->dnsmgr);
peer->dnsmgr = NULL;
- sip_unref_peer(peer, "Release peer from dnsmgr");
+ unref_peer(peer, "Release peer from dnsmgr");
}
return CMP_MATCH;
}
@@ -3007,14 +2958,12 @@
dialog_ref(dialog, "Let's bump the count in the unlink so it doesn't accidentally become dead before we are done");
ao2_t_unlink(dialogs, dialog, "unlinking dialog via ao2_unlink");
- ao2_t_unlink(dialogs_needdestroy, dialog, "unlinking dialog_needdestroy via ao2_unlink");
- ao2_t_unlink(dialogs_rtpcheck, dialog, "unlinking dialog_rtpcheck via ao2_unlink");
/* Unlink us from the owner (channel) if we have one */
[... 11936 lines stripped ...]
More information about the asterisk-commits
mailing list