[asterisk-commits] kharwell: branch kharwell/pimp_sip_video r384375 - in /team/kharwell/pimp_sip...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Mar 29 17:02:51 CDT 2013
Author: kharwell
Date: Fri Mar 29 17:02:42 2013
New Revision: 384375
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384375
Log:
rolling back due to merge issues
Added:
team/kharwell/pimp_sip_video/res/res_sip_sdp_audio.c
- copied unchanged from r383710, team/kharwell/pimp_sip_video/res/res_sip_sdp_audio.c
team/kharwell/pimp_sip_video/res/res_sip_sdp_video.c
- copied unchanged from r383710, team/kharwell/pimp_sip_video/res/res_sip_sdp_video.c
Removed:
team/kharwell/pimp_sip_video/res/res_sip/config_domain_aliases.c
team/kharwell/pimp_sip_video/res/res_sip_outbound_registration.c
team/kharwell/pimp_sip_video/res/res_sip_registrar.c
team/kharwell/pimp_sip_video/res/res_sip_sdp_media.c
Modified:
team/kharwell/pimp_sip_video/ (props changed)
team/kharwell/pimp_sip_video/CHANGES
team/kharwell/pimp_sip_video/apps/app_meetme.c
team/kharwell/pimp_sip_video/apps/app_voicemail.c
team/kharwell/pimp_sip_video/channels/chan_dahdi.c
team/kharwell/pimp_sip_video/channels/chan_gulp.c
team/kharwell/pimp_sip_video/channels/chan_iax2.c
team/kharwell/pimp_sip_video/channels/chan_mgcp.c
team/kharwell/pimp_sip_video/channels/chan_sip.c
team/kharwell/pimp_sip_video/channels/chan_skinny.c
team/kharwell/pimp_sip_video/channels/chan_unistim.c
team/kharwell/pimp_sip_video/channels/sig_pri.c
team/kharwell/pimp_sip_video/channels/sip/include/sip.h
team/kharwell/pimp_sip_video/channels/sip/security_events.c
team/kharwell/pimp_sip_video/contrib/scripts/install_prereq
team/kharwell/pimp_sip_video/include/asterisk/app.h
team/kharwell/pimp_sip_video/include/asterisk/autoconfig.h.in
team/kharwell/pimp_sip_video/include/asterisk/channel.h
team/kharwell/pimp_sip_video/include/asterisk/res_sip.h
team/kharwell/pimp_sip_video/include/asterisk/res_sip_session.h
team/kharwell/pimp_sip_video/include/asterisk/stasis.h
team/kharwell/pimp_sip_video/include/asterisk/uuid.h
team/kharwell/pimp_sip_video/main/app.c
team/kharwell/pimp_sip_video/main/cdr.c
team/kharwell/pimp_sip_video/main/channel.c
team/kharwell/pimp_sip_video/main/channel_internal_api.c
team/kharwell/pimp_sip_video/main/format_pref.c
team/kharwell/pimp_sip_video/main/http.c
team/kharwell/pimp_sip_video/main/manager.c
team/kharwell/pimp_sip_video/main/manager_channels.c
team/kharwell/pimp_sip_video/main/pbx.c
team/kharwell/pimp_sip_video/main/sorcery.c
team/kharwell/pimp_sip_video/main/stasis.c
team/kharwell/pimp_sip_video/main/stasis_cache.c
team/kharwell/pimp_sip_video/main/uuid.c
team/kharwell/pimp_sip_video/pbx/pbx_realtime.c
team/kharwell/pimp_sip_video/res/res_calendar_exchange.c
team/kharwell/pimp_sip_video/res/res_format_attr_h264.c
team/kharwell/pimp_sip_video/res/res_jabber.c
team/kharwell/pimp_sip_video/res/res_rtp_asterisk.c
team/kharwell/pimp_sip_video/res/res_sip/config_transport.c
team/kharwell/pimp_sip_video/res/res_sip/location.c
team/kharwell/pimp_sip_video/res/res_sip/sip_configuration.c
team/kharwell/pimp_sip_video/res/res_sip/sip_distributor.c
team/kharwell/pimp_sip_video/res/res_sip_endpoint_identifier_user.c
team/kharwell/pimp_sip_video/res/res_sip_session.c
team/kharwell/pimp_sip_video/res/res_sip_session.exports.in
team/kharwell/pimp_sip_video/res/res_sorcery_config.c
team/kharwell/pimp_sip_video/res/res_xmpp.c
team/kharwell/pimp_sip_video/tests/test_stasis.c
team/kharwell/pimp_sip_video/tests/test_uuid.c
Propchange: team/kharwell/pimp_sip_video/
------------------------------------------------------------------------------
automerge = *
Propchange: team/kharwell/pimp_sip_video/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Propchange: team/kharwell/pimp_sip_video/
------------------------------------------------------------------------------
--- pimp_sip_video-integrated (original)
+++ pimp_sip_video-integrated Fri Mar 29 17:02:42 2013
@@ -1,1 +1,1 @@
-/team/group/pimp_my_sip:1-383709
+/team/group/pimp_my_sip:1-383674
Propchange: team/kharwell/pimp_sip_video/
('svn:mergeinfo' removed)
Propchange: team/kharwell/pimp_sip_video/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Mar 29 17:02:42 2013
@@ -1,1 +1,1 @@
-/trunk:1-384366
+/trunk:1-383671
Modified: team/kharwell/pimp_sip_video/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/CHANGES?view=diff&rev=384375&r1=384374&r2=384375
==============================================================================
--- team/kharwell/pimp_sip_video/CHANGES (original)
+++ team/kharwell/pimp_sip_video/CHANGES Fri Mar 29 17:02:42 2013
@@ -49,9 +49,6 @@
* The AMI event 'UserEvent' from app_userevent now contains the channel state
fields. The channel state fields will come before the body fields.
-
- * The deprecated use of | (pipe) as a separator in the channelvars setting in
- manager.conf has been removed.
Channel Drivers
------------------
Modified: team/kharwell/pimp_sip_video/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/apps/app_meetme.c?view=diff&rev=384375&r1=384374&r2=384375
==============================================================================
--- team/kharwell/pimp_sip_video/apps/app_meetme.c (original)
+++ team/kharwell/pimp_sip_video/apps/app_meetme.c Fri Mar 29 17:02:42 2013
@@ -5926,16 +5926,7 @@
ringing_trunk = sla_choose_ringing_trunk(ringing_station->station, &s_trunk_ref, 1);
ast_mutex_unlock(&sla.lock);
if (!ringing_trunk) {
- /* This case happens in a bit of a race condition. If two stations answer
- * the outbound call at the same time, the first one will get connected to
- * the trunk. When the second one gets here, it will not see any trunks
- * ringing so we have no idea what to conect it to. So, we just hang up
- * on it. */
ast_debug(1, "Found no ringing trunk for station '%s' to answer!\n", ringing_station->station->name);
- ast_dial_join(ringing_station->station->dial);
- ast_dial_destroy(ringing_station->station->dial);
- ringing_station->station->dial = NULL;
- ast_free(ringing_station);
break;
}
/* Track the channel that answered this trunk */
Modified: team/kharwell/pimp_sip_video/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/apps/app_voicemail.c?view=diff&rev=384375&r1=384374&r2=384375
==============================================================================
--- team/kharwell/pimp_sip_video/apps/app_voicemail.c (original)
+++ team/kharwell/pimp_sip_video/apps/app_voicemail.c Fri Mar 29 17:02:42 2013
@@ -5944,10 +5944,7 @@
if (inboxcount2(ext_context, &urgentvoicemails, &newvoicemails, &oldvoicemails)) {
ast_log(AST_LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
} else {
- snprintf(arguments, sizeof(arguments), "%s %s %s %d %d %d &",
- externnotify, S_OR(context, "\"\""),
- extension, newvoicemails,
- oldvoicemails, urgentvoicemails);
+ snprintf(arguments, sizeof(arguments), "%s %s %s %d %d %d &", externnotify, context, extension, newvoicemails, oldvoicemails, urgentvoicemails);
ast_debug(1, "Executing %s\n", arguments);
ast_safe_system(arguments);
}
@@ -12630,7 +12627,7 @@
{
struct stasis_subscription_change *change;
/* Only looking for subscription change notices here */
- if (stasis_message_type(msg) != stasis_subscription_change_type()) {
+ if (stasis_message_type(msg) != stasis_subscription_change()) {
return;
}
@@ -12659,7 +12656,7 @@
mwi_sub_sub = stasis_subscribe(stasis_mwi_topic_all(), mwi_event_cb, NULL);
if (mwi_sub_sub) {
- struct ao2_container *cached = stasis_cache_dump(stasis_mwi_topic_cached(), stasis_subscription_change_type());
+ struct ao2_container *cached = stasis_cache_dump(stasis_mwi_topic_cached(), stasis_subscription_change());
if (cached) {
ao2_callback(cached, OBJ_MULTIPLE | OBJ_NODATA, dump_cache, NULL);
}
Modified: team/kharwell/pimp_sip_video/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_dahdi.c?view=diff&rev=384375&r1=384374&r2=384375
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_dahdi.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_dahdi.c Fri Mar 29 17:02:42 2013
@@ -5414,7 +5414,7 @@
}
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- mwi_message = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
+ mwi_message = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
if (mwi_message) {
struct stasis_mwi_state *mwi_state = stasis_message_data(mwi_message);
Modified: team/kharwell/pimp_sip_video/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_gulp.c?view=diff&rev=384375&r1=384374&r2=384375
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_gulp.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_gulp.c Fri Mar 29 17:02:42 2013
@@ -146,7 +146,6 @@
};
/*! \brief SIP session interaction functions */
-static void gulp_session_begin(struct ast_sip_session *session);
static void gulp_session_end(struct ast_sip_session *session);
static int gulp_incoming_request(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
static void gulp_incoming_response(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
@@ -154,17 +153,9 @@
/*! \brief SIP session supplement structure */
static struct ast_sip_session_supplement gulp_supplement = {
.method = "INVITE",
- .session_begin = gulp_session_begin,
.session_end = gulp_session_end,
.incoming_request = gulp_incoming_request,
.incoming_response = gulp_incoming_response,
-};
-
-static int gulp_incoming_ack(struct ast_sip_session *session, struct pjsip_rx_data *rdata);
-
-static struct ast_sip_session_supplement gulp_ack_supplement = {
- .method = "ACK",
- .incoming_request = gulp_incoming_ack,
};
/*! \brief Dialplan function for constructing a dial string for calling all contacts */
@@ -249,22 +240,14 @@
static enum ast_rtp_glue_result gulp_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
{
struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
- struct ast_sip_endpoint *endpoint;
if (!pvt || !pvt->session || !pvt->media[SIP_MEDIA_AUDIO]->rtp) {
return AST_RTP_GLUE_RESULT_FORBID;
}
- endpoint = pvt->session->endpoint;
-
*instance = pvt->media[SIP_MEDIA_AUDIO]->rtp;
ao2_ref(*instance, +1);
- ast_assert(endpoint != NULL);
- if (endpoint->direct_media) {
- return AST_RTP_GLUE_RESULT_REMOTE;
- }
-
return AST_RTP_GLUE_RESULT_LOCAL;
}
@@ -286,113 +269,12 @@
/*! \brief Function called by RTP engine to get peer capabilities */
static void gulp_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
- ast_format_cap_copy(result, pvt->session->endpoint->codecs);
-}
-
-static int send_direct_media_request(void *data)
-{
- RAII_VAR(struct ast_sip_session *, session, data, ao2_cleanup);
- return ast_sip_session_refresh(session, NULL, NULL, session->endpoint->direct_media_method, 1);
-}
-
-static struct ast_datastore_info direct_media_mitigation_info = { };
-
-static int direct_media_mitigate_glare(struct ast_sip_session *session)
-{
- RAII_VAR(struct ast_datastore *, datastore, NULL, ao2_cleanup);
-
- if (session->endpoint->direct_media_glare_mitigation ==
- AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE) {
- return 0;
- }
-
- datastore = ast_sip_session_get_datastore(session, "direct_media_mitigation");
- if (!datastore) {
- return 0;
- }
-
- /* Removing the datastore ensures we won't try to mitigate glare on subsequent reinvites */
- ast_sip_session_remove_datastore(session, "direct_media_mitigation");
-
- if ((session->endpoint->direct_media_glare_mitigation ==
- AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_OUTGOING &&
- session->inv_session->role == PJSIP_ROLE_UAC) ||
- (session->endpoint->direct_media_glare_mitigation ==
- AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_INCOMING &&
- session->inv_session->role == PJSIP_ROLE_UAS)) {
- return 1;
- }
-
- return 0;
-}
-
-static int check_for_rtp_changes(struct ast_channel *chan, struct ast_rtp_instance *rtp,
- struct ast_sip_session_media *media, int rtcp_fd)
-{
- int changed = 0;
-
- if (rtp) {
- changed = ast_rtp_instance_get_and_cmp_remote_address(rtp, &media->direct_media_addr);
- if (media->rtp) {
- ast_channel_set_fd(chan, rtcp_fd, -1);
- ast_rtp_instance_set_prop(media->rtp, AST_RTP_PROPERTY_RTCP, 0);
- }
- } else if (!ast_sockaddr_isnull(&media->direct_media_addr)){
- ast_sockaddr_setnull(&media->direct_media_addr);
- changed = 1;
- if (media->rtp) {
- ast_rtp_instance_set_prop(media->rtp, AST_RTP_PROPERTY_RTCP, 1);
- ast_channel_set_fd(chan, rtcp_fd, ast_rtp_instance_fd(media->rtp, 1));
- }
- }
-
- return changed;
}
/*! \brief Function called by RTP engine to change where the remote party should send media */
-static int gulp_set_rtp_peer(struct ast_channel *chan,
- struct ast_rtp_instance *rtp,
- struct ast_rtp_instance *vrtp,
- struct ast_rtp_instance *tpeer,
- const struct ast_format_cap *cap,
- int nat_active)
-{
- struct gulp_pvt *pvt = ast_channel_tech_pvt(chan);
- struct ast_sip_session *session = pvt->session;
- int changed = 0;
-
- /* Don't try to do any direct media shenanigans on early bridges */
- if ((rtp || vrtp || tpeer) && !ast_bridged_channel(chan)) {
- return 0;
- }
-
- if (nat_active && session->endpoint->disable_direct_media_on_nat) {
- return 0;
- }
-
- if (pvt->media[SIP_MEDIA_AUDIO]) {
- changed |= check_for_rtp_changes(chan, rtp, pvt->media[SIP_MEDIA_AUDIO], 1);
- }
- if (pvt->media[SIP_MEDIA_VIDEO]) {
- changed |= check_for_rtp_changes(chan, vrtp, pvt->media[SIP_MEDIA_VIDEO], 3);
- }
-
- if (direct_media_mitigate_glare(session)) {
- return 0;
- }
-
- if (cap && !ast_format_cap_is_empty(cap) && !ast_format_cap_identical(session->direct_media_cap, cap)) {
- ast_format_cap_copy(session->direct_media_cap, cap);
- changed = 1;
- }
-
- if (changed) {
- ao2_ref(session, +1);
- ast_sip_push_task(session->serializer, send_direct_media_request, session);
- }
-
- return 0;
+static int gulp_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, const struct ast_format_cap *cap, int nat_active)
+{
+ return -1;
}
/*! \brief Local glue for interacting with the RTP engine core */
@@ -432,13 +314,9 @@
pvt->media[SIP_MEDIA_VIDEO] = ao2_find(session->media, "video", OBJ_KEY);
ast_channel_tech_pvt_set(chan, pvt);
- if (ast_format_cap_is_empty(session->req_caps)) {
- ast_format_cap_copy(ast_channel_nativeformats(chan), session->endpoint->codecs);
- } else {
- ast_format_cap_copy(ast_channel_nativeformats(chan), session->req_caps);
- }
-
+ ast_format_cap_copy(ast_channel_nativeformats(chan), session->caps);
ast_codec_choose(&session->endpoint->prefs, session->endpoint->codecs, 1, &fmt);
+
ast_format_copy(ast_channel_writeformat(chan), &fmt);
ast_format_copy(ast_channel_rawwriteformat(chan), &fmt);
ast_format_copy(ast_channel_readformat(chan), &fmt);
@@ -497,25 +375,10 @@
{
struct gulp_pvt *pvt = ast_channel_tech_pvt(ast);
struct ast_frame *f;
- struct ast_sip_session_media *media = NULL;
+ struct ast_sip_session_media *media;
int fdno = ast_channel_fdno(ast);
- switch (fdno) {
- case 0:
- media = pvt->media[SIP_MEDIA_AUDIO];
- break;
- case 1:
- media = pvt->media[SIP_MEDIA_AUDIO];
- break;
- case 2:
- media = pvt->media[SIP_MEDIA_VIDEO];
- break;
- case 3:
- media = pvt->media[SIP_MEDIA_VIDEO];
- break;
- }
-
- if (!media || !media->rtp) {
+ if (!(media = pvt->media[fdno / 2])) {
return &ast_null_frame;
}
@@ -677,7 +540,13 @@
/*! \brief Send SIP INFO with video update request */
static int transmit_info_with_vidupdate(void *data)
{
- const char * xml =
+ struct ast_sip_session *session = data;
+ pjsip_tx_data *packet;
+
+ const pj_str_t type = pj_str("application");
+ const pj_str_t subtype = pj_str("media_control+xml");
+
+ const pj_str_t xml = pj_str(
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"
" <media_control>\r\n"
" <vc_primitive>\r\n"
@@ -685,18 +554,10 @@
" <picture_fast_update/>\r\n"
" </to_encoder>\r\n"
" </vc_primitive>\r\n"
- " </media_control>\r\n";
-
- struct ast_sip_body body = {
- .type = "application",
- .subtype = "media_control+xml",
- .body_text = xml
- };
-
- struct ast_sip_session *session = data;
- if (ast_sip_send_request("INFO", &body, session->inv_session->dlg, NULL) != PJ_SUCCESS) {
- ast_log(LOG_ERROR, "Could not send text video update INFO request\n");
- }
+ " </media_control>\r\n");
+
+ /* TODO: create and send in-dialog INFO request */
+ /* packet->msg->body = pjsip_msg_body_create(packet->pool, &type, &subtype, &xml); */
return 0;
}
@@ -1058,6 +919,7 @@
}
req_data->session = session;
+ ast_format_cap_copy(session->caps, req_data->caps);
return 0;
}
@@ -1183,25 +1045,6 @@
return 0;
}
-static void gulp_session_begin(struct ast_sip_session *session)
-{
- RAII_VAR(struct ast_datastore *, datastore, NULL, ao2_cleanup);
-
- if (session->endpoint->direct_media_glare_mitigation ==
- AST_SIP_DIRECT_MEDIA_GLARE_MITIGATION_NONE) {
- return;
- }
-
- datastore = ast_sip_session_alloc_datastore(&direct_media_mitigation_info,
- "direct_media_glare_mitigation");
-
- if (!datastore) {
- return;
- }
-
- ast_sip_session_add_datastore(session, datastore);
-}
-
/*! \brief Function called when the session ends */
static void gulp_session_end(struct ast_sip_session *session)
{
@@ -1224,6 +1067,7 @@
pjsip_tx_data *packet = NULL;
int res = AST_PBX_FAILED;
+ /* We only care about new sessions */
if (session->channel) {
return 0;
}
@@ -1286,16 +1130,6 @@
default:
break;
}
-}
-
-static int gulp_incoming_ack(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
-{
- if (rdata->msg_info.msg->line.req.method.id == PJSIP_ACK_METHOD) {
- if (session->endpoint->direct_media) {
- ast_queue_control(session->channel, AST_CONTROL_SRCCHANGE);
- }
- }
- return 0;
}
/*!
@@ -1333,12 +1167,6 @@
goto end;
}
- if (ast_sip_session_register_supplement(&gulp_ack_supplement)) {
- ast_log(LOG_ERROR, "Unable to register Gulp ACK supplement\n");
- ast_sip_session_unregister_supplement(&gulp_supplement);
- goto end;
- }
-
return 0;
end:
Modified: team/kharwell/pimp_sip_video/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_iax2.c?view=diff&rev=384375&r1=384374&r2=384375
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_iax2.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_iax2.c Fri Mar 29 17:02:42 2013
@@ -8755,7 +8755,7 @@
}
ast_str_set(&uniqueid, 0, "%s@%s", mailbox, context);
- msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
if (msg) {
struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
Modified: team/kharwell/pimp_sip_video/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_mgcp.c?view=diff&rev=384375&r1=384374&r2=384375
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_mgcp.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_mgcp.c Fri Mar 29 17:02:42 2013
@@ -507,7 +507,7 @@
ast_str_set(&uniqueid, 0, "%s@%s", mbox, cntx);
- msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
if (msg) {
struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
Modified: team/kharwell/pimp_sip_video/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_sip.c?view=diff&rev=384375&r1=384374&r2=384375
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_sip.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_sip.c Fri Mar 29 17:02:42 2013
@@ -1009,11 +1009,6 @@
static struct ao2_container *peers;
static struct ao2_container *peers_by_ip;
-/*! \brief A bogus peer, to be used when authentication should fail */
-static struct sip_peer *bogus_peer;
-/*! \brief We can recognise the bogus peer by this invalid MD5 hash */
-#define BOGUS_PEER_MD5SECRET "intentionally_invalid_md5_string"
-
/*! \brief The register list: Other SIP proxies we register with and receive calls from */
static struct ast_register_list {
ASTOBJ_CONTAINER_COMPONENTS(struct sip_registry);
@@ -1162,7 +1157,7 @@
static int transmit_response_with_auth(struct sip_pvt *p, const char *msg, const struct sip_request *req, const char *rand, enum xmittype reliable, const char *header, int stale);
static int transmit_provisional_response(struct sip_pvt *p, const char *msg, const struct sip_request *req, int with_sdp);
static int transmit_response_with_allow(struct sip_pvt *p, const char *msg, const struct sip_request *req, enum xmittype reliable);
-static void transmit_fake_auth_response(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable);
+static void transmit_fake_auth_response(struct sip_pvt *p, int sipmethod, struct sip_request *req, enum xmittype reliable);
static int transmit_request(struct sip_pvt *p, int sipmethod, uint32_t seqno, enum xmittype reliable, int newbranch);
static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, uint32_t seqno, enum xmittype reliable, int newbranch);
static int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * const explicit_uri);
@@ -16136,9 +16131,7 @@
ast_verb(3, "Registered SIP '%s' at %s\n", peer->name,
ast_sockaddr_stringify(&peer->addr));
}
- sip_pvt_unlock(pvt);
sip_poke_peer(peer, 0);
- sip_pvt_lock(pvt);
register_peer_exten(peer, 1);
/* Save User agent */
@@ -16484,7 +16477,6 @@
char a1_hash[256];
char resp_hash[256]="";
char *c;
- int is_bogus_peer = 0;
int wrongnonce = FALSE;
int good_response;
const char *usednonce = p->nonce;
@@ -16556,14 +16548,8 @@
sip_digest_parser(c, keys);
- /* We cannot rely on the bogus_peer having a bad md5 value. Someone could
- * use it to construct valid auth. */
- if (md5secret && strcmp(md5secret, BOGUS_PEER_MD5SECRET) == 0) {
- is_bogus_peer = 1;
- }
-
/* Verify that digest username matches the username we auth as */
- if (strcmp(username, keys[K_USER].s) && !is_bogus_peer) {
+ if (strcmp(username, keys[K_USER].s)) {
ast_log(LOG_WARNING, "username mismatch, have <%s>, digest has <%s>\n",
username, keys[K_USER].s);
/* Oops, we're trying something here */
@@ -16602,8 +16588,7 @@
}
good_response = keys[K_RESP].s &&
- !strncasecmp(keys[K_RESP].s, resp_hash, strlen(resp_hash)) &&
- !is_bogus_peer; /* lastly, check that the peer isn't the fake peer */
+ !strncasecmp(keys[K_RESP].s, resp_hash, strlen(resp_hash));
if (wrongnonce) {
if (good_response) {
if (sipdebug)
@@ -16668,7 +16653,7 @@
ao2_cleanup(peer);
return;
}
- if (stasis_mwi_state_type() == stasis_message_type(msg)) {
+ if (stasis_mwi_state_message() == stasis_message_type(msg)) {
sip_send_mwi_to_peer(peer, 0);
}
}
@@ -16834,13 +16819,13 @@
/*! \brief Send a fake 401 Unauthorized response when the administrator
wants to hide the names of local devices from fishers
*/
-static void transmit_fake_auth_response(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable)
+static void transmit_fake_auth_response(struct sip_pvt *p, int sipmethod, struct sip_request *req, enum xmittype reliable)
{
/* We have to emulate EXACTLY what we'd get with a good peer
* and a bad password, or else we leak information. */
- const char *response = "401 Unauthorized";
- const char *reqheader = "Authorization";
- const char *respheader = "WWW-Authenticate";
+ const char *response = "407 Proxy Authentication Required";
+ const char *reqheader = "Proxy-Authorization";
+ const char *respheader = "Proxy-Authenticate";
const char *authtoken;
struct ast_str *buf;
char *c;
@@ -16855,31 +16840,36 @@
[K_LAST] = { NULL, NULL}
};
+ if (sipmethod == SIP_REGISTER || sipmethod == SIP_SUBSCRIBE) {
+ response = "401 Unauthorized";
+ reqheader = "Authorization";
+ respheader = "WWW-Authenticate";
+ }
authtoken = sip_get_header(req, reqheader);
if (req->ignore && !ast_strlen_zero(p->nonce) && ast_strlen_zero(authtoken)) {
/* This is a retransmitted invite/register/etc, don't reconstruct authentication
* information */
- transmit_response_with_auth(p, response, req, p->nonce, reliable, respheader, 0);
+ transmit_response_with_auth(p, response, req, p->nonce, 0, respheader, 0);
/* Schedule auto destroy in 32 seconds (according to RFC 3261) */
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
return;
} else if (ast_strlen_zero(p->nonce) || ast_strlen_zero(authtoken)) {
/* We have no auth, so issue challenge and request authentication */
build_nonce(p, 1);
- transmit_response_with_auth(p, response, req, p->nonce, reliable, respheader, 0);
+ transmit_response_with_auth(p, response, req, p->nonce, 0, respheader, 0);
/* Schedule auto destroy in 32 seconds */
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
return;
}
if (!(buf = ast_str_thread_get(&check_auth_buf, CHECK_AUTH_BUF_INITLEN))) {
- __transmit_response(p, "403 Forbidden", &p->initreq, reliable);
+ transmit_response(p, "403 Forbidden (Bad auth)", &p->initreq);
return;
}
/* Make a copy of the response and parse it */
if (ast_str_set(&buf, 0, "%s", authtoken) == AST_DYNSTR_BUILD_FAILED) {
- __transmit_response(p, "403 Forbidden", &p->initreq, reliable);
+ transmit_response(p, "403 Forbidden (Bad auth)", &p->initreq);
return;
}
@@ -16917,7 +16907,7 @@
/* Schedule auto destroy in 32 seconds */
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
} else {
- __transmit_response(p, "403 Forbidden", &p->initreq, reliable);
+ transmit_response(p, "403 Forbidden (Bad auth)", &p->initreq);
}
}
@@ -17027,7 +17017,7 @@
if (!AST_LIST_EMPTY(&domain_list)) {
if (!check_sip_domain(domain, NULL, 0)) {
if (sip_cfg.alwaysauthreject) {
- transmit_fake_auth_response(p, &p->initreq, XMIT_UNRELIABLE);
+ transmit_fake_auth_response(p, SIP_REGISTER, &p->initreq, XMIT_UNRELIABLE);
} else {
transmit_response(p, "404 Not found (unknown domain)", &p->initreq);
}
@@ -17053,13 +17043,6 @@
}
}
peer = sip_find_peer(name, NULL, TRUE, FINDPEERS, FALSE, 0);
-
- /* If we don't want username disclosure, use the bogus_peer when a user
- * is not found. */
- if (!peer && sip_cfg.alwaysauthreject && sip_cfg.autocreatepeer == AUTOPEERS_DISABLED) {
- peer = bogus_peer;
- sip_ref_peer(peer, "register_verify: ref the bogus_peer");
- }
if (!(peer && ast_apply_acl(peer->acl, addr, "SIP Peer ACL: "))) {
/* Peer fails ACL check */
@@ -17152,7 +17135,7 @@
switch (parse_register_contact(p, peer, req)) {
case PARSE_REGISTER_DENIED:
ast_log(LOG_WARNING, "Registration denied because of contact ACL\n");
- transmit_response_with_date(p, "403 Forbidden", req);
+ transmit_response_with_date(p, "403 Forbidden (ACL)", req);
res = 0;
break;
case PARSE_REGISTER_FAILED:
@@ -17180,9 +17163,9 @@
}
if (!res) {
if (send_mwi) {
- sip_pvt_unlock(p);
+ ao2_unlock(p);
sip_send_mwi_to_peer(peer, 0);
- sip_pvt_lock(p);
+ ao2_lock(p);
} else {
update_peer_lastmsgssent(peer, -1, 0);
}
@@ -17192,7 +17175,7 @@
switch (res) {
case AUTH_SECRET_FAILED:
/* Wrong password in authentication. Go away, don't try again until you fixed it */
- transmit_response(p, "403 Forbidden", &p->initreq);
+ transmit_response(p, "403 Forbidden (Bad auth)", &p->initreq);
if (global_authfailureevents) {
const char *peer_addr = ast_strdupa(ast_sockaddr_stringify_addr(addr));
const char *peer_port = ast_strdupa(ast_sockaddr_stringify_port(addr));
@@ -17215,7 +17198,7 @@
case AUTH_PEER_NOT_DYNAMIC:
case AUTH_ACL_FAILED:
if (sip_cfg.alwaysauthreject) {
- transmit_fake_auth_response(p, &p->initreq, XMIT_UNRELIABLE);
+ transmit_fake_auth_response(p, SIP_REGISTER, &p->initreq, XMIT_UNRELIABLE);
if (global_authfailureevents) {
const char *peer_addr = ast_strdupa(ast_sockaddr_stringify_addr(addr));
const char *peer_port = ast_strdupa(ast_sockaddr_stringify_port(addr));
@@ -18254,19 +18237,7 @@
ast_verbose("No matching peer for '%s' from '%s'\n",
of, ast_sockaddr_stringify(&p->recv));
}
-
- /* If you don't mind, we can return 404s for devices that do
- * not exist: username disclosure. If we allow guests, there
- * is no way around that. */
- if (sip_cfg.allowguest || !sip_cfg.alwaysauthreject) {
- return AUTH_DONT_KNOW;
- }
-
- /* If you do mind, we use a peer that will never authenticate.
- * This ensures that we follow the same code path as regular
- * auth: less chance for username disclosure. */
- peer = bogus_peer;
- sip_ref_peer(peer, "sip_ref_peer: check_peer_ok: must ref bogus_peer so unreffing it does not fail");
+ return AUTH_DONT_KNOW;
}
/* build_peer, called through sip_find_peer, is not able to check the
@@ -18289,10 +18260,9 @@
sip_unref_peer(peer, "sip_unref_peer: check_peer_ok: from sip_find_peer call, early return of AUTH_ACL_FAILED");
return AUTH_ACL_FAILED;
}
- if (debug && peer != bogus_peer) {
+ if (debug)
ast_verbose("Found peer '%s' for '%s' from %s\n",
peer->name, of, ast_sockaddr_stringify(&p->recv));
- }
/* XXX what about p->prefs = peer->prefs; ? */
/* Set Frame packetization */
@@ -18575,6 +18545,8 @@
} else {
res = AUTH_RTP_FAILED;
}
+ } else if (sip_cfg.alwaysauthreject) {
+ res = AUTH_FAKE_AUTH; /* reject with fake authorization request */
} else {
res = AUTH_SECRET_FAILED; /* we don't want any guests, authentication will fail */
}
@@ -18709,8 +18681,13 @@
return;
}
if (res < 0) { /* Something failed in authentication */
- ast_log(LOG_NOTICE, "Failed to authenticate device %s\n", sip_get_header(req, "From"));
- transmit_response(p, "403 Forbidden", req);
+ if (res == AUTH_FAKE_AUTH) {
+ ast_log(LOG_NOTICE, "Sending fake auth rejection for device %s\n", sip_get_header(req, "From"));
+ transmit_fake_auth_response(p, SIP_MESSAGE, req, XMIT_UNRELIABLE);
+ } else {
+ ast_log(LOG_NOTICE, "Failed to authenticate device %s\n", sip_get_header(req, "From"));
+ transmit_response(p, "403 Forbidden", req);
+ }
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
return;
}
@@ -24868,8 +24845,13 @@
return 0;
}
if (res < 0) { /* Something failed in authentication */
- ast_log(LOG_NOTICE, "Failed to authenticate device %s\n", sip_get_header(req, "From"));
- transmit_response(p, "403 Forbidden", req);
+ if (res == AUTH_FAKE_AUTH) {
+ ast_log(LOG_NOTICE, "Sending fake auth rejection for device %s\n", sip_get_header(req, "From"));
+ transmit_fake_auth_response(p, SIP_OPTIONS, req, XMIT_UNRELIABLE);
+ } else {
+ ast_log(LOG_NOTICE, "Failed to authenticate device %s\n", sip_get_header(req, "From"));
+ transmit_response(p, "403 Forbidden", req);
+ }
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
return 0;
}
@@ -25514,8 +25496,13 @@
goto request_invite_cleanup;
}
if (res < 0) { /* Something failed in authentication */
- ast_log(LOG_NOTICE, "Failed to authenticate device %s\n", sip_get_header(req, "From"));
- transmit_response_reliable(p, "403 Forbidden", req);
+ if (res == AUTH_FAKE_AUTH) {
+ ast_log(LOG_NOTICE, "Sending fake auth rejection for device %s\n", sip_get_header(req, "From"));
+ transmit_fake_auth_response(p, SIP_INVITE, req, XMIT_RELIABLE);
+ } else {
+ ast_log(LOG_NOTICE, "Failed to authenticate device %s\n", sip_get_header(req, "From"));
+ transmit_response_reliable(p, "403 Forbidden", req);
+ }
p->invitestate = INV_COMPLETED;
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
goto request_invite_cleanup;
@@ -25683,7 +25670,7 @@
/* Session-Timers */
if ((p->sipoptions & SIP_OPT_TIMER)) {
- enum st_refresher_param st_ref_param = SESSION_TIMER_REFRESHER_PARAM_UNKNOWN;
+ enum st_refresher_param st_ref_param;
/* The UAC has requested session-timers for this session. Negotiate
the session refresh interval and who will be the refresher */
@@ -27558,13 +27545,18 @@
return -1;
}
- auth_result = check_user(p, req, SIP_PUBLISH, uri, XMIT_UNRELIABLE, addr);
+ auth_result = check_user(p, req, SIP_PUBLISH, uri, XMIT_RELIABLE, addr);
if (auth_result == AUTH_CHALLENGE_SENT) {
p->lastinvite = seqno;
return 0;
} else if (auth_result < 0) {
- ast_log(LOG_NOTICE, "Failed to authenticate device %s\n", sip_get_header(req, "From"));
- transmit_response(p, "403 Forbidden", req);
+ if (auth_result == AUTH_FAKE_AUTH) {
+ ast_log(LOG_NOTICE, "Sending fake auth rejection for device %s\n", sip_get_header(req, "From"));
+ transmit_fake_auth_response(p, SIP_INVITE, req, XMIT_RELIABLE);
+ } else {
+ ast_log(LOG_NOTICE, "Failed to authenticate device %s\n", sip_get_header(req, "From"));
+ transmit_response_reliable(p, "403 Forbidden", req);
+ }
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
ast_string_field_set(p, theirtag, NULL);
return 0;
@@ -27776,14 +27768,19 @@
* use if !req->ignore, because then we'll end up sending
* a 200 OK if someone retransmits without sending auth */
if (p->subscribed == NONE || resubscribe) {
- res = check_user_full(p, req, SIP_SUBSCRIBE, e, XMIT_UNRELIABLE, addr, &authpeer);
+ res = check_user_full(p, req, SIP_SUBSCRIBE, e, 0, addr, &authpeer);
/* if an authentication response was sent, we are done here */
if (res == AUTH_CHALLENGE_SENT) /* authpeer = NULL here */
return 0;
if (res != AUTH_SUCCESSFUL) {
- ast_log(LOG_NOTICE, "Failed to authenticate device %s for SUBSCRIBE\n", sip_get_header(req, "From"));
- transmit_response(p, "403 Forbidden", req);
+ if (res == AUTH_FAKE_AUTH) {
+ ast_log(LOG_NOTICE, "Sending fake auth rejection for device %s\n", sip_get_header(req, "From"));
+ transmit_fake_auth_response(p, SIP_SUBSCRIBE, req, XMIT_UNRELIABLE);
+ } else {
+ ast_log(LOG_NOTICE, "Failed to authenticate device %s for SUBSCRIBE\n", sip_get_header(req, "From"));
+ transmit_response_reliable(p, "403 Forbidden", req);
+ }
pvt_set_needdestroy(p, "authentication failed");
return 0;
@@ -28849,7 +28846,7 @@
ast_str_reset(uniqueid);
ast_str_set(&uniqueid, 0, "%s@%s", mailbox->mailbox, S_OR(mailbox->context, "default"));
- msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_type(), ast_str_buffer(uniqueid));
+ msg = stasis_cache_get(stasis_mwi_topic_cached(), stasis_mwi_state_message(), ast_str_buffer(uniqueid));
if (!msg) {
continue;
}
@@ -29614,9 +29611,6 @@
\note This is done with 60 seconds between each ping,
unless forced by cli or manager. If peer is unreachable,
we check every 10th second by default.
-\note Do *not* hold a pvt lock while calling this function.
- This function calls sip_alloc, which can cause a deadlock
- if another sip_pvt is held.
*/
static int sip_poke_peer(struct sip_peer *peer, int force)
{
@@ -33316,7 +33310,6 @@
/*! \brief Force reload of module from cli */
static char *sip_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- static struct sip_peer *tmp_peer, *new_peer;
switch (cmd) {
case CLI_INIT:
@@ -33338,18 +33331,6 @@
}
ast_mutex_unlock(&sip_reload_lock);
restart_monitor();
-
- tmp_peer = bogus_peer;
- /* Create new bogus peer possibly with new global settings. */
- if ((new_peer = temp_peer("(bogus_peer)"))) {
- ast_string_field_set(new_peer, md5secret, BOGUS_PEER_MD5SECRET);
- ast_clear_flag(&new_peer->flags[0], SIP_INSECURE);
- bogus_peer = new_peer;
- ao2_t_ref(tmp_peer, -1, "unref the old bogus_peer during reload");
- } else {
- ast_log(LOG_ERROR, "Could not update the fake authentication peer.\n");
- /* You probably have bigger (memory?) issues to worry about though.. */
- }
return CLI_SUCCESS;
}
@@ -34578,17 +34559,6 @@
return AST_MODULE_LOAD_DECLINE;
}
- /* Initialize bogus peer. Can be done first after reload_config() */
- if (!(bogus_peer = temp_peer("(bogus_peer)"))) {
- ast_log(LOG_ERROR, "Unable to create bogus_peer for authentication\n");
- io_context_destroy(io);
- ast_sched_context_destroy(sched);
- return AST_MODULE_LOAD_FAILURE;
- }
- /* Make sure the auth will always fail. */
- ast_string_field_set(bogus_peer, md5secret, BOGUS_PEER_MD5SECRET);
- ast_clear_flag(&bogus_peer->flags[0], SIP_INSECURE);
-
/* Prepare the version that does not require DTMF BEGIN frames.
* We need to use tricks such as memcpy and casts because the variable
* has const fields.
@@ -34604,7 +34574,6 @@
/* Make sure we can register our sip channel type */
if (ast_channel_register(&sip_tech)) {
ast_log(LOG_ERROR, "Unable to register channel type 'SIP'\n");
- ao2_t_ref(bogus_peer, -1, "unref the bogus_peer");
io_context_destroy(io);
ast_sched_context_destroy(sched);
return AST_MODULE_LOAD_FAILURE;
@@ -34867,8 +34836,6 @@
ast_debug(2, "TCP/TLS thread container did not become empty :(\n");
}
- ao2_t_ref(bogus_peer, -1, "unref the bogus_peer");
-
ao2_t_ref(peers, -1, "unref the peers table");
ao2_t_ref(peers_by_ip, -1, "unref the peers_by_ip table");
ao2_t_ref(dialogs, -1, "unref the dialogs table");
Modified: team/kharwell/pimp_sip_video/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_sip_video/channels/chan_skinny.c?view=diff&rev=384375&r1=384374&r2=384375
==============================================================================
--- team/kharwell/pimp_sip_video/channels/chan_skinny.c (original)
+++ team/kharwell/pimp_sip_video/channels/chan_skinny.c Fri Mar 29 17:02:42 2013
@@ -3518,7 +3518,7 @@
return;
}
- if (msg && stasis_mwi_state_type() == stasis_message_type(msg)) {
+ if (msg && stasis_mwi_state_message() == stasis_message_type(msg)) {
struct stasis_mwi_state *mwi_state = stasis_message_data(msg);
l->newmsgs = mwi_state->new_msgs;
}
@@ -6254,14 +6254,12 @@
struct ast_channel *c;
int event;
int instance;
-#ifdef AST_DEVMODE
int callreference;
- /* This is only used in AST_DEVMODE, as an argument to SKINNY_DEBUG */
- callreference = letohl(req->data.stimulus.callreference);
-#endif
+ /*int res = 0;*/
event = letohl(req->data.stimulus.stimulus);
instance = letohl(req->data.stimulus.stimulusInstance);
+ callreference = letohl(req->data.stimulus.callreference);
/* Note that this call should be using the passed in instance and callreference */
sub = find_subchannel_by_instance_reference(d, d->lastlineinstance, d->lastcallreference);
@@ -7113,6 +7111,13 @@
case SOFTKEY_ENDCALL:
SKINNY_DEBUG(DEBUG_PACKET, 3, "Received SOFTKEY_ENDCALL from %s, inst %d, callref %d\n",
[... 3639 lines stripped ...]
More information about the asterisk-commits
mailing list