[asterisk-commits] mmichelson: branch mmichelson/outbound_auth r383321 - in /team/mmichelson/out...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Mar 18 12:28:45 CDT 2013
Author: mmichelson
Date: Mon Mar 18 12:28:43 2013
New Revision: 383321
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383321
Log:
Changed the session code to use the new API.
Since there is no outbound authenticator created yet, Authentication
does not work. That's the next step: extract code from sip_outbound_auth.c
into an outbound authenticator module.
Modified:
team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c
team/mmichelson/outbound_auth/res/res_sip_session.c
Modified: team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c?view=diff&rev=383321&r1=383320&r2=383321
==============================================================================
--- team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c (original)
+++ team/mmichelson/outbound_auth/res/res_sip/sip_outbound_auth.c Mon Mar 18 12:28:43 2013
@@ -132,7 +132,7 @@
{
if (!registered_authenticator) {
ast_log(LOG_WARNING, "No SIP outbound authenticator registered. Cannot respond to authentication challenge\n");
- return 0;
+ return -1;
}
return registered_authenticator->challenge_response(endpoint, challenge, original_request, new_request);
}
Modified: team/mmichelson/outbound_auth/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/outbound_auth/res/res_sip_session.c?view=diff&rev=383321&r1=383320&r2=383321
==============================================================================
--- team/mmichelson/outbound_auth/res/res_sip_session.c (original)
+++ team/mmichelson/outbound_auth/res/res_sip_session.c Mon Mar 18 12:28:43 2013
@@ -779,6 +779,7 @@
return CMP_MATCH | CMP_STOP;
}
+#if 0
static int session_outbound_auth(pjsip_dialog *dlg, pjsip_tx_data *tdata, void *user_data)
{
pjsip_inv_session *inv = pjsip_dlg_get_inv_session(dlg);
@@ -787,6 +788,7 @@
pjsip_inv_send_msg(inv, tdata);
return 0;
}
+#endif
struct ast_sip_session *ast_sip_session_create_outgoing(struct ast_sip_endpoint *endpoint, const char *location, const char *request_user)
{
@@ -835,11 +837,6 @@
}
if (!(dlg = ast_sip_create_dialog(endpoint, uri, request_user))) {
- return NULL;
- }
-
- if (ast_sip_setup_outbound_authentication(dlg, endpoint, session_outbound_auth, NULL)) {
- pjsip_dlg_terminate(dlg);
return NULL;
}
@@ -1239,7 +1236,25 @@
static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
{
- /* XXX STUB */
+ struct ast_sip_session *session = inv->mod_data[session_module.id];
+
+ if (inv->state == PJSIP_INV_STATE_DISCONNECTED) {
+ return;
+ }
+
+ if (e->body.tsx_state.type == PJSIP_EVENT_RX_MSG &&
+ (tsx->status_code == 401 || tsx->status_code == 407)) {
+ pjsip_tx_data *tdata;
+ if (ast_sip_create_auth_challenge_response(session->endpoint,
+ e->body.tsx_state.src.rdata, tsx->last_tx, &tdata)) {
+ return;
+ }
+ if (inv->state < PJSIP_INV_STATE_CONFIRMED && tsx->method.id == PJSIP_INVITE_METHOD) {
+ pjsip_inv_uac_restart(inv, PJ_TRUE);
+ }
+ ast_sip_session_send_request(session, tdata);
+ return;
+ }
}
static int add_sdp_streams(void *obj, void *arg, void *data, int flags)
More information about the asterisk-commits
mailing list