[asterisk-commits] kmoore: branch kmoore/pjsip_path_support r403991 - in /team/kmoore/pjsip_path...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Dec 16 15:00:09 CST 2013
Author: kmoore
Date: Mon Dec 16 15:00:05 2013
New Revision: 403991
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=403991
Log:
Resolve merge conflict
Added:
team/kmoore/pjsip_path_support/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py
- copied unchanged from r403824, trunk/contrib/ast-db-manage/config/versions/581a4264e537_adding_extensions.py
Modified:
team/kmoore/pjsip_path_support/ (props changed)
team/kmoore/pjsip_path_support/apps/app_dial.c
team/kmoore/pjsip_path_support/apps/app_queue.c
team/kmoore/pjsip_path_support/bridges/bridge_native_rtp.c
team/kmoore/pjsip_path_support/channels/Makefile
team/kmoore/pjsip_path_support/channels/chan_pjsip.c
team/kmoore/pjsip_path_support/channels/chan_sip.c
team/kmoore/pjsip_path_support/channels/pjsip/dialplan_functions.c
team/kmoore/pjsip_path_support/include/asterisk/app.h
team/kmoore/pjsip_path_support/include/asterisk/bridge.h
team/kmoore/pjsip_path_support/include/asterisk/channel.h
team/kmoore/pjsip_path_support/include/asterisk/res_pjsip.h
team/kmoore/pjsip_path_support/include/asterisk/stasis_app.h
team/kmoore/pjsip_path_support/include/asterisk/stasis_app_impl.h
team/kmoore/pjsip_path_support/include/asterisk/stasis_channels.h
team/kmoore/pjsip_path_support/main/app.c
team/kmoore/pjsip_path_support/main/bridge.c
team/kmoore/pjsip_path_support/main/bridge_basic.c
team/kmoore/pjsip_path_support/main/channel.c
team/kmoore/pjsip_path_support/main/dial.c
team/kmoore/pjsip_path_support/main/http.c
team/kmoore/pjsip_path_support/main/message.c
team/kmoore/pjsip_path_support/main/stasis_channels.c
team/kmoore/pjsip_path_support/main/test.c
team/kmoore/pjsip_path_support/res/ari/ari_model_validators.c
team/kmoore/pjsip_path_support/res/ari/ari_model_validators.h
team/kmoore/pjsip_path_support/res/ari/resource_bridges.c
team/kmoore/pjsip_path_support/res/ari/resource_channels.c
team/kmoore/pjsip_path_support/res/ari/resource_channels.h
team/kmoore/pjsip_path_support/res/parking/parking_bridge_features.c
team/kmoore/pjsip_path_support/res/parking/parking_manager.c
team/kmoore/pjsip_path_support/res/res_ari_bridges.c
team/kmoore/pjsip_path_support/res/res_ari_channels.c
team/kmoore/pjsip_path_support/res/res_pjsip.c
team/kmoore/pjsip_path_support/res/res_pjsip/location.c
team/kmoore/pjsip_path_support/res/res_pjsip/pjsip_options.c
team/kmoore/pjsip_path_support/res/res_pjsip_messaging.c
team/kmoore/pjsip_path_support/res/res_stasis_answer.c
team/kmoore/pjsip_path_support/res/res_stasis_playback.c
team/kmoore/pjsip_path_support/res/res_stasis_recording.c
team/kmoore/pjsip_path_support/res/stasis/app.c
team/kmoore/pjsip_path_support/res/stasis/command.c
team/kmoore/pjsip_path_support/res/stasis/command.h
team/kmoore/pjsip_path_support/res/stasis/control.c
team/kmoore/pjsip_path_support/rest-api/api-docs/bridges.json
team/kmoore/pjsip_path_support/rest-api/api-docs/channels.json
team/kmoore/pjsip_path_support/rest-api/api-docs/events.json
team/kmoore/pjsip_path_support/tests/test_voicemail_api.c
Propchange: team/kmoore/pjsip_path_support/
------------------------------------------------------------------------------
automerge = *
Propchange: team/kmoore/pjsip_path_support/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.
Propchange: team/kmoore/pjsip_path_support/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Dec 16 15:00:05 2013
@@ -1,1 +1,1 @@
-/trunk:1-403701
+/trunk:1-403834
Modified: team/kmoore/pjsip_path_support/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/apps/app_dial.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/apps/app_dial.c (original)
+++ team/kmoore/pjsip_path_support/apps/app_dial.c Mon Dec 16 15:00:05 2013
@@ -1007,7 +1007,7 @@
ast_channel_unlock(c);
ast_channel_lock_both(original, in);
- ast_channel_publish_dial_forward(in, original, NULL, "CANCEL",
+ ast_channel_publish_dial_forward(in, original, c, NULL, "CANCEL",
ast_channel_call_forward(c));
ast_channel_unlock(in);
ast_channel_unlock(original);
Modified: team/kmoore/pjsip_path_support/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/apps/app_queue.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/apps/app_queue.c (original)
+++ team/kmoore/pjsip_path_support/apps/app_queue.c Mon Dec 16 15:00:05 2013
@@ -4666,7 +4666,7 @@
ast_channel_unlock(qe->chan);
ast_channel_lock_both(qe->chan, original);
- ast_channel_publish_dial_forward(qe->chan, original, NULL, "CANCEL",
+ ast_channel_publish_dial_forward(qe->chan, original, o->chan, NULL, "CANCEL",
ast_channel_call_forward(original));
ast_channel_unlock(original);
ast_channel_unlock(qe->chan);
Modified: team/kmoore/pjsip_path_support/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/bridges/bridge_native_rtp.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/bridges/bridge_native_rtp.c (original)
+++ team/kmoore/pjsip_path_support/bridges/bridge_native_rtp.c Mon Dec 16 15:00:05 2013
@@ -112,7 +112,16 @@
return audio_glue0_res;
}
-static int native_rtp_bridge_start(struct ast_bridge *bridge, struct ast_channel *target)
+/*!
+ * \internal
+ * \brief Start native RTP bridging of two channels
+ *
+ * \param bridge The bridge that had native RTP bridging happening on it
+ * \param target If remote RTP bridging, the channel that is unheld.
+ *
+ * \note Bridge must be locked when calling this function.
+ */
+static void native_rtp_bridge_start(struct ast_bridge *bridge, struct ast_channel *target)
{
struct ast_bridge_channel *c0 = AST_LIST_FIRST(&bridge->channels);
struct ast_bridge_channel *c1 = AST_LIST_LAST(&bridge->channels);
@@ -128,17 +137,11 @@
RAII_VAR(struct ast_format_cap *, cap1, ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy);
if (c0 == c1) {
- return 0;
- }
-
+ return;
+ }
+
+ ast_channel_lock_both(c0->chan, c1->chan);
native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
-
- if (glue0->get_codec) {
- glue0->get_codec(c0->chan, cap0);
- }
- if (glue1->get_codec) {
- glue1->get_codec(c1->chan, cap1);
- }
switch (native_type) {
case AST_RTP_GLUE_RESULT_LOCAL:
@@ -155,6 +158,12 @@
break;
case AST_RTP_GLUE_RESULT_REMOTE:
+ if (glue0->get_codec) {
+ glue0->get_codec(c0->chan, cap0);
+ }
+ if (glue1->get_codec) {
+ glue1->get_codec(c1->chan, cap1);
+ }
/* If we have a target, it's the channel that received the UNHOLD or UPDATE_RTP_PEER frame and was told to resume */
if (!target) {
@@ -180,7 +189,8 @@
break;
}
- return 0;
+ ast_channel_unlock(c0->chan);
+ ast_channel_unlock(c1->chan);
}
static void native_rtp_bridge_stop(struct ast_bridge *bridge, struct ast_channel *target)
@@ -202,6 +212,7 @@
return;
}
+ ast_channel_lock_both(c0->chan, c1->chan);
native_type = native_rtp_bridge_get(c0->chan, c1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
switch (native_type) {
@@ -241,6 +252,9 @@
ast_debug(2, "Discontinued RTP bridging of '%s' and '%s' - media will flow through Asterisk core\n",
ast_channel_name(c0->chan), ast_channel_name(c1->chan));
+
+ ast_channel_unlock(c0->chan);
+ ast_channel_unlock(c1->chan);
}
/*! \brief Frame hook that is called to intercept hold/unhold */
@@ -252,16 +266,23 @@
return f;
}
- ast_channel_lock(chan);
bridge = ast_channel_get_bridge(chan);
- ast_channel_unlock(chan);
if (bridge) {
+ /* native_rtp_bridge_start/stop are not being called from bridging
+ core so we need to lock the bridge prior to calling these functions
+ Unfortunately that means unlocking the channel, but as it
+ should not be modified this should be okay...hopefully */
+ ast_channel_unlock(chan);
+ ast_bridge_lock(bridge);
if (f->subclass.integer == AST_CONTROL_HOLD) {
native_rtp_bridge_stop(bridge, chan);
} else if ((f->subclass.integer == AST_CONTROL_UNHOLD) || (f->subclass.integer == AST_CONTROL_UPDATE_RTP_PEER)) {
native_rtp_bridge_start(bridge, chan);
}
+ ast_bridge_unlock(bridge);
+ ast_channel_lock(chan);
+
}
return f;
@@ -412,7 +433,8 @@
return -1;
}
- return native_rtp_bridge_start(bridge, NULL);
+ native_rtp_bridge_start(bridge, NULL);
+ return 0;
}
static void native_rtp_bridge_unsuspend(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
Modified: team/kmoore/pjsip_path_support/channels/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/channels/Makefile?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/channels/Makefile (original)
+++ team/kmoore/pjsip_path_support/channels/Makefile Mon Dec 16 15:00:05 2013
@@ -66,6 +66,7 @@
rm -f dahdi/*.o dahdi/*.i
rm -f sip/*.o sip/*.i
rm -f iax2/*.o iax2/*.i
+ rm -f pjsip/*.o pjsip/*.i
rm -f h323/libchanh323.a h323/Makefile.ast h323/*.o h323/*.dep
dist-clean::
Modified: team/kmoore/pjsip_path_support/channels/chan_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/channels/chan_pjsip.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/channels/chan_pjsip.c (original)
+++ team/kmoore/pjsip_path_support/channels/chan_pjsip.c Mon Dec 16 15:00:05 2013
@@ -292,14 +292,11 @@
struct chan_pjsip_pvt *pvt = channel->pvt;
struct ast_sip_session *session = channel->session;
int changed = 0;
- struct ast_channel *bridge_peer;
/* Don't try to do any direct media shenanigans on early bridges */
- bridge_peer = ast_channel_bridge_peer(chan);
- if ((rtp || vrtp || tpeer) && !bridge_peer) {
+ if ((rtp || vrtp || tpeer) && !ast_channel_is_bridged(chan)) {
return 0;
}
- ast_channel_cleanup(bridge_peer);
if (nat_active && session->endpoint->media.direct_media.disable_on_nat) {
return 0;
@@ -630,16 +627,7 @@
struct fixup_data {
struct ast_sip_session *session;
struct ast_channel *chan;
- struct ast_channel *oldchan;
};
-
-static void fixup_data_destroy(struct fixup_data *fix_data)
-{
- ao2_cleanup(fix_data->session);
- ast_channel_cleanup(fix_data->chan);
- ast_channel_cleanup(fix_data->oldchan);
- ast_free(fix_data);
-}
static int fixup(void *data)
{
@@ -647,11 +635,6 @@
struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(fix_data->chan);
struct chan_pjsip_pvt *pvt = channel->pvt;
- if (channel->session->channel != fix_data->oldchan) {
- fixup_data_destroy(fix_data);
- return -1;
- }
-
channel->session->channel = fix_data->chan;
if (pvt->media[SIP_MEDIA_AUDIO] && pvt->media[SIP_MEDIA_AUDIO]->rtp) {
ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_AUDIO]->rtp, ast_channel_uniqueid(fix_data->chan));
@@ -660,8 +643,6 @@
ast_rtp_instance_set_channel_id(pvt->media[SIP_MEDIA_VIDEO]->rtp, ast_channel_uniqueid(fix_data->chan));
}
- fixup_data_destroy(fix_data);
-
return 0;
}
@@ -669,23 +650,16 @@
static int chan_pjsip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(newchan);
- struct fixup_data *fix_data = ast_calloc(1, sizeof(*fix_data));
-
- if (!fix_data) {
+ struct fixup_data fix_data;
+
+ fix_data.session = channel->session;
+ fix_data.chan = newchan;
+
+ if (channel->session->channel != oldchan) {
return -1;
}
- fix_data->session = channel->session;
- ao2_ref(fix_data->session, +1);
-
- fix_data->chan = newchan;
- ast_channel_ref(fix_data->chan);
-
- fix_data->oldchan = oldchan;
- ast_channel_ref(fix_data->oldchan);
-
- if (ast_sip_push_task(channel->session->serializer, fixup, fix_data)) {
- fixup_data_destroy(fix_data);
+ if (ast_sip_push_task_synchronous(channel->session->serializer, fixup, &fix_data)) {
ast_log(LOG_WARNING, "Unable to perform channel fixup\n");
return -1;
}
Modified: team/kmoore/pjsip_path_support/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/channels/chan_sip.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/channels/chan_sip.c (original)
+++ team/kmoore/pjsip_path_support/channels/chan_sip.c Mon Dec 16 15:00:05 2013
@@ -32667,11 +32667,8 @@
struct sip_pvt *p;
int changed = 0;
- /* Lock the channel and the private safely. */
- ast_channel_lock(chan);
p = ast_channel_tech_pvt(chan);
if (!p) {
- ast_channel_unlock(chan);
return -1;
}
sip_pvt_lock(p);
@@ -32679,7 +32676,6 @@
/* I suppose it could be argued that if this happens it is a bug. */
ast_debug(1, "The private is not owned by channel %s anymore.\n", ast_channel_name(chan));
sip_pvt_unlock(p);
- ast_channel_unlock(chan);
return 0;
}
@@ -32688,14 +32684,12 @@
!ast_channel_is_bridged(chan) &&
!sip_cfg.directrtpsetup) {
sip_pvt_unlock(p);
- ast_channel_unlock(chan);
return 0;
}
if (p->alreadygone) {
/* If we're destroyed, don't bother */
sip_pvt_unlock(p);
- ast_channel_unlock(chan);
return 0;
}
@@ -32704,7 +32698,6 @@
*/
if (nat_active && !ast_test_flag(&p->flags[0], SIP_DIRECT_MEDIA_NAT)) {
sip_pvt_unlock(p);
- ast_channel_unlock(chan);
return 0;
}
@@ -32770,7 +32763,6 @@
*/
ast_clear_flag(&p->flags[2], SIP_PAGE3_DIRECT_MEDIA_OUTGOING);
sip_pvt_unlock(p);
- ast_channel_unlock(chan);
return 0;
}
@@ -32791,7 +32783,6 @@
/* Reset lastrtprx timer */
p->lastrtprx = p->lastrtptx = time(NULL);
sip_pvt_unlock(p);
- ast_channel_unlock(chan);
return 0;
}
Modified: team/kmoore/pjsip_path_support/channels/pjsip/dialplan_functions.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/channels/pjsip/dialplan_functions.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/channels/pjsip/dialplan_functions.c (original)
+++ team/kmoore/pjsip_path_support/channels/pjsip/dialplan_functions.c Mon Dec 16 15:00:05 2013
@@ -582,15 +582,15 @@
if (!strcmp(type, "secure")) {
snprintf(buf, buflen, "%u", dlg->secure ? 1 : 0);
} else if (!strcmp(type, "target_uri")) {
- pjsip_uri_print(PJSIP_URI_IN_REQ_URI, dlg->target, buf, sizeof(buflen));
+ pjsip_uri_print(PJSIP_URI_IN_REQ_URI, dlg->target, buf, buflen);
buf_copy = ast_strdupa(buf);
ast_escape_quoted(buf_copy, buf, buflen);
} else if (!strcmp(type, "local_uri")) {
- pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, dlg->local.info->uri, buf, sizeof(buflen));
+ pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, dlg->local.info->uri, buf, buflen);
buf_copy = ast_strdupa(buf);
ast_escape_quoted(buf_copy, buf, buflen);
} else if (!strcmp(type, "remote_uri")) {
- pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, dlg->remote.info->uri, buf, sizeof(buflen));
+ pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, dlg->remote.info->uri, buf, buflen);
buf_copy = ast_strdupa(buf);
ast_escape_quoted(buf_copy, buf, buflen);
} else if (!strcmp(type, "t38state")) {
Modified: team/kmoore/pjsip_path_support/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/include/asterisk/app.h?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/include/asterisk/app.h (original)
+++ team/kmoore/pjsip_path_support/include/asterisk/app.h Mon Dec 16 15:00:05 2013
@@ -568,6 +568,15 @@
};
/*!
+ * \brief Determine if a voicemail provider is registered.
+ * \since 13.0.0
+ *
+ * \retval 0 if no privider registered.
+ * \retval 1 if a privider is registered.
+ */
+int ast_vm_is_registered(void);
+
+/*!
* \brief Set voicemail function callbacks
*
* \param vm_table Voicemail function table to install.
Modified: team/kmoore/pjsip_path_support/include/asterisk/bridge.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/include/asterisk/bridge.h?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/include/asterisk/bridge.h (original)
+++ team/kmoore/pjsip_path_support/include/asterisk/bridge.h Mon Dec 16 15:00:05 2013
@@ -955,6 +955,19 @@
struct ast_channel *to_transfer_target);
/*!
+ * \brief Set the relevant transfer variables for a single channel
+ *
+ * Sets either the ATTENDEDTRANSFER or BLINDTRANSFER variable for a channel while clearing
+ * the opposite.
+ *
+ * \param chan Channel the variable is being set for
+ * \param value Value the variable is being set to
+ * \param is_attended false set BLINDTRANSFER and unset ATTENDEDTRANSFER
+ * true set ATTENDEDTRANSFER and unset BLINDTRANSFER
+ */
+void ast_bridge_set_transfer_variables(struct ast_channel *chan, const char *value, int is_attended);
+
+/*!
* \brief Get a container of all channels in the bridge
* \since 12.0.0
*
Modified: team/kmoore/pjsip_path_support/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/include/asterisk/channel.h?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/include/asterisk/channel.h (original)
+++ team/kmoore/pjsip_path_support/include/asterisk/channel.h Mon Dec 16 15:00:05 2013
@@ -4214,6 +4214,8 @@
* \note The returned peer channel is the current peer in the
* bridge when called.
*
+ * \note Absolutely _NO_ channel locks should be held when calling this function.
+ *
* \retval NULL Channel not in a bridge or the bridge is not two-party.
* \retval non-NULL Reffed peer channel at time of calling.
*/
Modified: team/kmoore/pjsip_path_support/include/asterisk/res_pjsip.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/include/asterisk/res_pjsip.h?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/include/asterisk/res_pjsip.h (original)
+++ team/kmoore/pjsip_path_support/include/asterisk/res_pjsip.h Mon Dec 16 15:00:05 2013
@@ -146,6 +146,8 @@
AST_DECLARE_STRING_FIELDS(
/*! Full URI of the contact */
AST_STRING_FIELD(uri);
+ /*! Outbound proxy to use for qualify */
+ AST_STRING_FIELD(outbound_proxy);
/*! Path information to place in Route headers */
AST_STRING_FIELD(path);
);
@@ -192,6 +194,8 @@
AST_DECLARE_STRING_FIELDS(
/*! Voicemail boxes for this AOR */
AST_STRING_FIELD(mailboxes);
+ /*! Outbound proxy for OPTIONS requests */
+ AST_STRING_FIELD(outbound_proxy);
);
/*! Minimum expiration time */
unsigned int minimum_expiration;
@@ -1302,6 +1306,16 @@
struct ast_sip_endpoint *ast_sip_identify_endpoint(pjsip_rx_data *rdata);
/*!
+ * \brief Set the outbound proxy for an outbound SIP message
+ *
+ * \param tdata The message to set the outbound proxy on
+ * \param proxy SIP uri of the proxy
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_sip_set_outbound_proxy(pjsip_tx_data *tdata, const char *proxy);
+
+/*!
* \brief Add a header to an outbound SIP message
*
* \param tdata The message to add the header to
Modified: team/kmoore/pjsip_path_support/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/include/asterisk/stasis_app.h?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/include/asterisk/stasis_app.h (original)
+++ team/kmoore/pjsip_path_support/include/asterisk/stasis_app.h Mon Dec 16 15:00:05 2013
@@ -277,6 +277,60 @@
/*! \brief Handler for controlling a channel that's in a Stasis application */
struct stasis_app_control;
+/*! \brief Rule to check to see if an operation is allowed */
+struct stasis_app_control_rule {
+ /*!
+ * \brief Checks to see if an operation is allowed on the control
+ *
+ * \param control Control object to check
+ * \return 0 on success, otherwise a failure code
+ */
+ enum stasis_app_control_channel_result (*check_rule)(
+ const struct stasis_app_control *control);
+ /*! Next item in the list */
+ AST_LIST_ENTRY(stasis_app_control_rule) next;
+};
+
+/*!
+ * \brief Registers an add channel to bridge rule.
+ *
+ * \param control Control object
+ * \param rule The rule to register
+ */
+void stasis_app_control_register_add_rule(
+ struct stasis_app_control *control,
+ struct stasis_app_control_rule *rule);
+
+/*!
+ * \brief UnRegister an add channel to bridge rule.
+ *
+ * \param control Control object
+ * \param rule The rule to unregister
+ */
+void stasis_app_control_unregister_add_rule(
+ struct stasis_app_control *control,
+ struct stasis_app_control_rule *rule);
+
+/*!
+ * \brief Registers a remove channel from bridge rule.
+ *
+ * \param control Control object
+ * \param rule The rule to register
+ */
+void stasis_app_control_register_remove_rule(
+ struct stasis_app_control *control,
+ struct stasis_app_control_rule *rule);
+
+/*!
+ * \brief Unregisters a remove channel from bridge rule.
+ *
+ * \param control Control object
+ * \param rule The rule to unregister
+ */
+void stasis_app_control_unregister_remove_rule(
+ struct stasis_app_control *control,
+ struct stasis_app_control_rule *rule);
+
/*!
* \brief Returns the handler for the given channel.
* \param chan Channel to handle.
@@ -582,6 +636,16 @@
struct ast_bridge *bridge);
/*!
+ * \brief Result codes used when adding/removing channels to/from bridges.
+ */
+enum stasis_app_control_channel_result {
+ /*! The channel is okay to be added/removed */
+ STASIS_APP_CHANNEL_OKAY = 0,
+ /*! The channel is currently recording */
+ STASIS_APP_CHANNEL_RECORDING
+};
+
+/*!
* \brief Add a channel to the bridge.
*
* \param control Control whose channel should be added to the bridge
Modified: team/kmoore/pjsip_path_support/include/asterisk/stasis_app_impl.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/include/asterisk/stasis_app_impl.h?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/include/asterisk/stasis_app_impl.h (original)
+++ team/kmoore/pjsip_path_support/include/asterisk/stasis_app_impl.h Mon Dec 16 15:00:05 2013
@@ -49,7 +49,7 @@
char *argv[]);
/*! Callback type for stasis app commands */
-typedef void *(*stasis_app_command_cb)(struct stasis_app_control *control,
+typedef int (*stasis_app_command_cb)(struct stasis_app_control *control,
struct ast_channel *chan, void *data);
/*!
@@ -63,10 +63,11 @@
* \param control Control object for the channel to send the command to.
* \param command Command function to execute.
* \param data Optional data to pass along with the control function.
- * \return Return value from \a command.
- * \return \c NULL on error.
+ *
+ * \return zero on success.
+ * \return error code otherwise.
*/
-void *stasis_app_send_command(struct stasis_app_control *control,
+int stasis_app_send_command(struct stasis_app_control *control,
stasis_app_command_cb command, void *data);
/*!
Modified: team/kmoore/pjsip_path_support/include/asterisk/stasis_channels.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/include/asterisk/stasis_channels.h?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/include/asterisk/stasis_channels.h (original)
+++ team/kmoore/pjsip_path_support/include/asterisk/stasis_channels.h Mon Dec 16 15:00:05 2013
@@ -518,12 +518,14 @@
*
* \param caller The channel performing the dial operation
* \param peer The channel being dialed
+ * \param forwarded The channel created as a result of the call forwarding
* \param dialstring The information passed to the dialing application when beginning a dial
* \param dialstatus The current status of the dial operation
* \param forward The call forward string provided by the dialed channel
*/
void ast_channel_publish_dial_forward(struct ast_channel *caller,
struct ast_channel *peer,
+ struct ast_channel *forwarded,
const char *dialstring,
const char *dialstatus,
const char *forward);
Modified: team/kmoore/pjsip_path_support/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/main/app.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/main/app.c (original)
+++ team/kmoore/pjsip_path_support/main/app.c Mon Dec 16 15:00:05 2013
@@ -431,6 +431,17 @@
/*! Voicemail not registered warning */
static int vm_warnings;
+
+int ast_vm_is_registered(void)
+{
+ struct ast_vm_functions *table;
+ int is_registered;
+
+ table = ao2_global_obj_ref(vm_provider);
+ is_registered = table ? 1 : 0;
+ ao2_cleanup(table);
+ return is_registered;
+}
int __ast_vm_register(const struct ast_vm_functions *vm_table, struct ast_module *module)
{
Modified: team/kmoore/pjsip_path_support/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/main/bridge.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/main/bridge.c (original)
+++ team/kmoore/pjsip_path_support/main/bridge.c Mon Dec 16 15:00:05 2013
@@ -122,6 +122,12 @@
/* Grow rate of bridge array of channels */
#define BRIDGE_ARRAY_GROW 32
+/* Variable name - stores peer information about the most recent blind transfer */
+#define BLINDTRANSFER "BLINDTRANSFER"
+
+/* Variable name - stores peer information about the most recent attended transfer */
+#define ATTENDEDTRANSFER "ATTENDEDTRANSFER"
+
static void cleanup_video_mode(struct ast_bridge *bridge);
static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
@@ -3688,6 +3694,8 @@
return AST_BRIDGE_TRANSFER_FAIL;
}
+ pbx_builtin_setvar_helper(local, BLINDTRANSFER, ast_channel_name(transferer));
+
if (new_channel_cb) {
new_channel_cb(local, user_data, AST_BRIDGE_TRANSFER_MULTI_PARTY);
}
@@ -3850,6 +3858,8 @@
return AST_BRIDGE_TRANSFER_FAIL;
}
+ pbx_builtin_setvar_helper(local_chan, ATTENDEDTRANSFER, ast_channel_name(chan1));
+
if (bridge2) {
res = ast_local_setup_bridge(local_chan, bridge2, chan2, NULL);
} else {
@@ -3945,19 +3955,38 @@
return AST_BRIDGE_TRANSFER_SUCCESS;
}
-/*!
- * \internal
- * \brief Set the BLINDTRANSFER variable as appropriate on channels involved in the transfer
- *
- * The transferer channel will have its BLINDTRANSFER variable set the same as its BRIDGEPEER
+void ast_bridge_set_transfer_variables(struct ast_channel *chan, const char *value, int attended)
+{
+ char *writevar;
+ char *erasevar;
+
+ if (attended) {
+ writevar = ATTENDEDTRANSFER;
+ erasevar = BLINDTRANSFER;
+ } else {
+ writevar = BLINDTRANSFER;
+ erasevar = ATTENDEDTRANSFER;
+ }
+
+ pbx_builtin_setvar_helper(chan, writevar, value);
+ pbx_builtin_setvar_helper(chan, erasevar, value);
+}
+
+/*!
+ * \internal
+ * \brief Set the transfer variable as appropriate on channels involved in the transfer
+ *
+ * The transferer channel will have its variable set the same as its BRIDGEPEER
* variable. This will account for all channels that it is bridged to. The other channels
- * involved in the transfer will have their BLINDTRANSFER variable set to the transferer
+ * involved in the transfer will have their variable set to the transferer
* channel's name.
*
- * \param transferer The channel performing the blind transfer
+ * \param transferer The channel performing the transfer
* \param channels The channels belonging to the bridge
- */
-static void set_blind_transfer_variables(struct ast_channel *transferer, struct ao2_container *channels)
+ * \param is_attended false set BLINDTRANSFER and unset ATTENDEDTRANSFER
+ * true set ATTENDEDTRANSFER and unset BLINDTRANSFER
+ */
+static void set_transfer_variables_all(struct ast_channel *transferer, struct ao2_container *channels, int is_attended)
{
struct ao2_iterator iter;
struct ast_channel *chan;
@@ -3973,9 +4002,9 @@
(chan = ao2_iterator_next(&iter));
ao2_cleanup(chan)) {
if (chan == transferer) {
- pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", transferer_bridgepeer);
+ ast_bridge_set_transfer_variables(chan, transferer_bridgepeer, is_attended);
} else {
- pbx_builtin_setvar_helper(chan, "BLINDTRANSFER", transferer_name);
+ ast_bridge_set_transfer_variables(chan, transferer_name, is_attended);
}
}
@@ -4066,7 +4095,7 @@
goto publish;
}
- set_blind_transfer_variables(transferer, channels);
+ set_transfer_variables_all(transferer, channels, 0);
if (do_bridge_transfer) {
transfer_result = blind_transfer_bridge(transferer, bridge, exten, context,
@@ -4167,6 +4196,16 @@
};
enum ast_transfer_result res;
struct ast_bridge *final_bridge = NULL;
+ RAII_VAR(struct ao2_container *, channels, NULL, ao2_cleanup);
+
+ channels = ast_bridge_peers_nolock(to_transferee_bridge);
+
+ if (!channels) {
+ res = AST_BRIDGE_TRANSFER_FAIL;
+ goto end;
+ }
+
+ set_transfer_variables_all(to_transferee, channels, 1);
switch (ast_bridges_allow_optimization(to_transferee_bridge, to_target_bridge)) {
case AST_BRIDGE_OPTIMIZE_SWAP_TO_CHAN_BRIDGE:
@@ -4338,6 +4377,8 @@
goto end;
}
+ set_transfer_variables_all(to_transferee, channels, 1);
+
if (do_bridge_transfer) {
res = attended_transfer_bridge(chan_bridged, chan_unbridged, the_bridge, NULL, &publication);
goto end;
Modified: team/kmoore/pjsip_path_support/main/bridge_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/main/bridge_basic.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/main/bridge_basic.c (original)
+++ team/kmoore/pjsip_path_support/main/bridge_basic.c Mon Dec 16 15:00:05 2013
@@ -2929,8 +2929,7 @@
/* Who is transferring the call. */
pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", ast_channel_name(caller));
- /* To work as an analog to BLINDTRANSFER */
- pbx_builtin_setvar_helper(chan, "ATTENDEDTRANSFER", ast_channel_name(caller));
+ ast_bridge_set_transfer_variables(chan, ast_channel_name(caller), 1);
/* Before we actually dial out let's inherit appropriate information. */
copy_caller_data(chan, caller);
Modified: team/kmoore/pjsip_path_support/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/main/channel.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/main/channel.c (original)
+++ team/kmoore/pjsip_path_support/main/channel.c Mon Dec 16 15:00:05 2013
@@ -6869,13 +6869,11 @@
}
ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), ast_channel_state(original));
+ ast_channel_unlock(original);
if ((bridged = ast_channel_bridge_peer(original))) {
- ast_channel_unlock(original);
ast_indicate(bridged, AST_CONTROL_SRCCHANGE);
ast_channel_unref(bridged);
- } else {
- ast_channel_unlock(original);
}
ast_indicate(original, AST_CONTROL_SRCCHANGE);
Modified: team/kmoore/pjsip_path_support/main/dial.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/main/dial.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/main/dial.c (original)
+++ team/kmoore/pjsip_path_support/main/dial.c Mon Dec 16 15:00:05 2013
@@ -465,13 +465,16 @@
channel->device = ast_strdup(device);
AST_LIST_UNLOCK(&dial->channels);
-
/* Drop the original channel */
- ast_hangup(original);
channel->owner = NULL;
/* Finally give it a go... send it out into the world */
begin_dial_channel(channel, chan, chan ? 0 : 1, predial_string);
+
+ ast_channel_publish_dial_forward(chan, original, channel->owner, NULL, "CANCEL",
+ ast_channel_call_forward(original));
+
+ ast_hangup(original);
return 0;
}
Modified: team/kmoore/pjsip_path_support/main/http.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/main/http.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/main/http.c (original)
+++ team/kmoore/pjsip_path_support/main/http.c Mon Dec 16 15:00:05 2013
@@ -608,18 +608,30 @@
#define MAX_POST_CONTENT 1025
-static const char *get_content_type(struct ast_variable *headers)
+/*!
+ * \brief Retrieves the content type specified in the "Content-Type" header.
+ *
+ * This function only returns the "type/subtype" and any trailing parameter is
+ * not included.
+ *
+ * \note the return value is an allocated string that needs to be freed.
+ *
+ * \retval the content type/subtype or NULL if the header is not found.
+ */
+static char *get_content_type(struct ast_variable *headers)
{
struct ast_variable *v;
for (v = headers; v; v = v->next) {
if (strcasecmp(v->name, "Content-Type") == 0) {
- return v->value;
- }
- }
-
- /* Missing content type; assume empty string */
- return "";
+ const char *param = strchr(v->value, ';');
+ size_t size = (param ? param - v->value :
+ strlen(v->value)) + 1;
+ return ast_strndup(v->value, size);
+ }
+ }
+
+ return NULL;
}
static int get_content_length(struct ast_variable *headers)
@@ -643,11 +655,12 @@
int res;
struct ast_json *body;
RAII_VAR(char *, buf, NULL, ast_free);
+ RAII_VAR(char *, type, get_content_type(headers), ast_free);
/* Use errno to distinguish errors from no body */
errno = 0;
- if (strcasecmp(get_content_type(headers), "application/json") != 0) {
+ if (ast_strlen_zero(type) || strcasecmp(type, "application/json")) {
/* Content type is not JSON */
return NULL;
}
@@ -704,12 +717,14 @@
struct ast_variable *v, *post_vars=NULL, *prev = NULL;
char *var, *val;
RAII_VAR(char *, buf, NULL, ast_free_ptr);
+ RAII_VAR(char *, type, get_content_type(headers), ast_free);
int res;
/* Use errno to distinguish errors from no params */
errno = 0;
- if (strcasecmp(get_content_type(headers), "application/x-www-form-urlencoded") != 0) {
+ if (ast_strlen_zero(type) ||
+ strcasecmp(type, "application/x-www-form-urlencoded")) {
/* Content type is not form data */
return NULL;
}
Modified: team/kmoore/pjsip_path_support/main/message.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/main/message.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/main/message.c (original)
+++ team/kmoore/pjsip_path_support/main/message.c Mon Dec 16 15:00:05 2013
@@ -122,12 +122,14 @@
<syntax>
<parameter name="to" required="true">
<para>A To URI for the message.</para>
+ <xi:include xpointer="xpointer(/docs/info[@name='PJSIPMessageToInfo'])" />
<xi:include xpointer="xpointer(/docs/info[@name='SIPMessageToInfo'])" />
<xi:include xpointer="xpointer(/docs/info[@name='XMPPMessageToInfo'])" />
</parameter>
<parameter name="from" required="false">
<para>A From URI for the message if needed for the
message technology being used to send this message.</para>
+ <xi:include xpointer="xpointer(/docs/info[@name='PJSIPMessageFromInfo'])" />
<xi:include xpointer="xpointer(/docs/info[@name='SIPMessageFromInfo'])" />
<xi:include xpointer="xpointer(/docs/info[@name='XMPPMessageFromInfo'])" />
</parameter>
@@ -165,12 +167,14 @@
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
<parameter name="To" required="true">
<para>The URI the message is to be sent to.</para>
+ <xi:include xpointer="xpointer(/docs/info[@name='PJSIPMessageToInfo'])" />
<xi:include xpointer="xpointer(/docs/info[@name='SIPMessageToInfo'])" />
<xi:include xpointer="xpointer(/docs/info[@name='XMPPMessageToInfo'])" />
</parameter>
<parameter name="From">
<para>A From URI for the message if needed for the
message technology being used to send this message.</para>
+ <xi:include xpointer="xpointer(/docs/info[@name='PJSIPMessageFromInfo'])" />
<xi:include xpointer="xpointer(/docs/info[@name='SIPMessageFromInfo'])" />
<xi:include xpointer="xpointer(/docs/info[@name='XMPPMessageFromInfo'])" />
</parameter>
Modified: team/kmoore/pjsip_path_support/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/pjsip_path_support/main/stasis_channels.c?view=diff&rev=403991&r1=403990&r2=403991
==============================================================================
--- team/kmoore/pjsip_path_support/main/stasis_channels.c (original)
+++ team/kmoore/pjsip_path_support/main/stasis_channels.c Mon Dec 16 15:00:05 2013
@@ -287,14 +287,21 @@
ast_json_unref(event->blob);
}
+/*! \brief Dummy callback for receiving events */
+static void dummy_event_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message)
+{
+}
+
void ast_channel_publish_dial_forward(struct ast_channel *caller, struct ast_channel *peer,
- const char *dialstring, const char *dialstatus, const char *forward)
+ struct ast_channel *forwarded, const char *dialstring, const char *dialstatus,
+ const char *forward)
{
RAII_VAR(struct ast_multi_channel_blob *, payload, NULL, ao2_cleanup);
RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
RAII_VAR(struct ast_channel_snapshot *, caller_snapshot, NULL, ao2_cleanup);
RAII_VAR(struct ast_channel_snapshot *, peer_snapshot, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_channel_snapshot *, forwarded_snapshot, NULL, ao2_cleanup);
ast_assert(peer != NULL);
blob = ast_json_pack("{s: s, s: s, s: s}",
@@ -323,18 +330,33 @@
}
ast_multi_channel_blob_add_channel(payload, "peer", peer_snapshot);
+ if (forwarded) {
+ forwarded_snapshot = ast_channel_snapshot_create(forwarded);
+ if (!forwarded_snapshot) {
+ return;
+ }
+ ast_multi_channel_blob_add_channel(payload, "forwarded", forwarded_snapshot);
+ }
+
msg = stasis_message_create(ast_channel_dial_type(), payload);
if (!msg) {
return;
}
- publish_message_for_channel_topics(msg, caller);
+ if (forwarded) {
+ struct stasis_subscription *subscription = stasis_subscribe(ast_channel_topic(peer), dummy_event_cb, NULL);
+
+ stasis_publish(ast_channel_topic(peer), msg);
+ stasis_unsubscribe_and_join(subscription);
+ } else {
[... 1747 lines stripped ...]
More information about the asterisk-commits
mailing list