[OpenSIPS-Devel] Patch for auth_aaa module
WhiteWind
whitearchey at gmail.com
Sun Nov 8 16:33:41 CET 2009
I needed proper auth of INVITE requests and I implemented it.
I wish to see this patch in the mainstream and I'm ready to correct this
patch if it doesn't fit some standards or contains bugs
Index: modules/auth_aaa/authaaa_mod.c
===================================================================
--- modules/auth_aaa/authaaa_mod.c (revision 6274)
+++ modules/auth_aaa/authaaa_mod.c (working copy)
@@ -119,6 +119,8 @@
memset(attrs, 0, sizeof(attrs));
memset(vals, 0, sizeof(vals));
+ attrs[A_CALLED_STATION_ID].name =
"Called-Station-Id";
+ attrs[A_CALLING_STATION_ID].name =
"Calling-Station-Id";
attrs[A_SERVICE_TYPE].name = "Service-Type";
attrs[A_SIP_URI_USER].name = "Sip-URI-User";
attrs[A_DIGEST_RESPONSE].name = "Digest-Response";
Index: modules/auth_aaa/sterman.c
===================================================================
--- modules/auth_aaa/sterman.c (revision 6274)
+++ modules/auth_aaa/sterman.c (working copy)
@@ -231,6 +231,21 @@
goto err;
}
+ if (method.len == 6 && !strncmp(method.s, "INVITE", 6)) {
+ struct sip_uri *uri = parse_to_uri(_msg);
+ if (uri && uri->user.s)
+ if (proto.avp_add(conn, send,
&attrs[A_CALLED_STATION_ID], uri->user.s,
+ uri->user.len, 0)) {
+ LM_ERR("unable to add Called-Station-Id
attribute\n");
+ goto err;
+ }
+
+ if (proto.avp_add(conn, send, &attrs[A_CALLING_STATION_ID],
user.s,user.len,0)) {
+ LM_ERR("unable to add Calling-Station-Id
attribute\n");
+ goto err;
+ }
+ }
+
/* Add CALL-ID in Acct-Session-Id Attribute */
if ( _msg->callid==NULL &&
(parse_headers(_msg, HDR_CALLID_F, 0)==-1 ||
_msg->callid==NULL) ) {
--
Написано в почтовом клиенте браузера Opera: http://www.opera.com/mail/
More information about the Devel
mailing list