Module: sip-router
Branch: master
Commit: 0db2ee84ae1c24fae6196f42034c68e5d16ea189
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0db2ee8…
Author: Richard Good <richard.good(a)smilecoms.com>
Committer: Richard Good <richard.good(a)smilecoms.com>
Date: Tue Sep 9 18:26:02 2014 +0200
modules/ims_qos: new mod_param: authorize_video_flow
authorize_video_flows is a flag that specifies whether or not to authorize video flows.
---
modules/ims_qos/doc/ims_qos_admin.xml | 20 +++++++++++
modules/ims_qos/mod.c | 3 ++
modules/ims_qos/rx_aar.c | 61 ++++++++++++++++++++++-----------
3 files changed, 64 insertions(+), 20 deletions(-)
diff --git a/modules/ims_qos/doc/ims_qos_admin.xml
b/modules/ims_qos/doc/ims_qos_admin.xml
index 43223c3..726e441 100644
--- a/modules/ims_qos/doc/ims_qos_admin.xml
+++ b/modules/ims_qos/doc/ims_qos_admin.xml
@@ -181,6 +181,26 @@ modparam("ims_qos", "cdp_event_latency_log", 1)
</programlisting>
</example>
</section>
+ <section>
+ <title><varname>authorize_video_flow</varname>
(integer)</title>
+
+ <para>This is a flag that specifies whether or not to authorize video flows.
+ 1 means video flows will be authorized over Rx and
+ 0 means video flows will not be authorized over Rx</para>
+
+ <para><emphasis> Default value is 1. </emphasis></para>
+
+ <example>
+ <title><varname>authorize_video_flow</varname> parameter
+ usage</title>
+
+ <programlisting format="linespecific">
+...
+modparam("ims_qos", "authorize_video_flow", 0)
+...
+ </programlisting>
+ </example>
+ </section>
</section>
<section>
diff --git a/modules/ims_qos/mod.c b/modules/ims_qos/mod.c
index b164136..3dc9496 100644
--- a/modules/ims_qos/mod.c
+++ b/modules/ims_qos/mod.c
@@ -85,6 +85,8 @@ int rx_auth_expiry = 7200;
int must_send_str = 1;
+int authorize_video_flow = 1; //by default we authorize resources for video flow
descriptions
+
struct tm_binds tmb;
struct cdp_binds cdpb;
struct dlg_binds dlgb;
@@ -128,6 +130,7 @@ static param_export_t params[] = {
{ "cdp_event_latency", INT_PARAM, &cdp_event_latency}, /*flag: report
slow processing of CDP callback events or not */
{ "cdp_event_threshold", INT_PARAM, &cdp_event_threshold}, /*time in ms
above which we should report slow processing of CDP callback event*/
{ "cdp_event_latency_log", INT_PARAM, &cdp_event_latency_loglevel},
/*log-level to use to report slow processing of CDP callback event*/
+ { "authorize_video_flow", INT_PARAM, &authorize_video_flow}, /*whether
or not we authorize resources for video flows*/
{ 0, 0, 0}
};
diff --git a/modules/ims_qos/rx_aar.c b/modules/ims_qos/rx_aar.c
index 89e5323..028d6cd 100644
--- a/modules/ims_qos/rx_aar.c
+++ b/modules/ims_qos/rx_aar.c
@@ -71,6 +71,8 @@
//extern struct tm_binds tmb;
usrloc_api_t ul;
+extern int authorize_video_flow;
+
str IMS_Serv_AVP_val = {"IMS Services", 12};
str IMS_Em_Serv_AVP_val = {"Emergency IMS Call", 18};
str IMS_Reg_AVP_val = {"IMS Registration", 16};
@@ -323,20 +325,31 @@ int rx_process_aaa(AAAMessage *aaa, unsigned int * rc) {
int add_media_components_using_current_flow_description(AAAMessage* aar,
rx_authsessiondata_t *p_session_data) {
flow_description_t *flow_description;
+ int add_flow = 1;
flow_description = p_session_data->first_current_flow_description;
if(!flow_description) {
return -1;
}
while (flow_description) {
- rx_add_media_component_description_avp(aar, flow_description->stream_num,
- &flow_description->media, &flow_description->req_sdp_ip_addr,
- &flow_description->req_sdp_port, &flow_description->rpl_sdp_ip_addr,
- &flow_description->rpl_sdp_port,
&flow_description->rpl_sdp_transport,
- &flow_description->req_sdp_raw_stream,
- &flow_description->rpl_sdp_raw_stream, flow_description->direction);
+
+ if(!authorize_video_flow) {
+ if (strncmp(flow_description->media.s, "video", 5) == 0) {
+ add_flow = 0;
+ }
+ }
+
+ if(add_flow) {
+ rx_add_media_component_description_avp(aar, flow_description->stream_num,
+ &flow_description->media, &flow_description->req_sdp_ip_addr,
+ &flow_description->req_sdp_port, &flow_description->rpl_sdp_ip_addr,
+ &flow_description->rpl_sdp_port, &flow_description->rpl_sdp_transport,
+ &flow_description->req_sdp_raw_stream,
+ &flow_description->rpl_sdp_raw_stream, flow_description->direction);
+ }
flow_description = flow_description->next;
+ add_flow = 1;
}
return 0;
}
@@ -350,6 +363,7 @@ int add_media_components(AAAMessage* aar, struct sip_msg *req,
int sdp_stream_num;
sdp_session_cell_t* req_sdp_session, *rpl_sdp_session;
sdp_stream_cell_t* req_sdp_stream, *rpl_sdp_stream;
+ int add_flow = 1;
if (!req || !rpl) {
return CSCF_RETURN_FALSE;
@@ -402,22 +416,29 @@ int add_media_components(AAAMessage* aar, struct sip_msg *req,
int intportA = atoi(req_sdp_stream->port.s);
int intportB = atoi(rpl_sdp_stream->port.s);
if(intportA != 0 && intportB != 0){
+ if(!authorize_video_flow) {
+ if (strncmp(req_sdp_stream->media.s, "video", 5) == 0) {
+ add_flow = 0;
+ }
+ }
+ if(add_flow) {
//add this to auth session data
-
- add_flow_description((rx_authsessiondata_t*) auth->u.auth.generic_data,
sdp_stream_num + 1,
- &req_sdp_stream->media,
&req_sdp_session->ip_addr,
- &req_sdp_stream->port, &rpl_sdp_session->ip_addr,
- &rpl_sdp_stream->port,
&rpl_sdp_stream->transport,
- &req_sdp_stream->raw_stream,
- &rpl_sdp_stream->raw_stream, direction, 0 /*This is a new
mcd, we are not setting it as active*/);
-
- rx_add_media_component_description_avp(aar, sdp_stream_num + 1,
- &req_sdp_stream->media,
&req_sdp_session->ip_addr,
- &req_sdp_stream->port, &rpl_sdp_session->ip_addr,
- &rpl_sdp_stream->port,
&rpl_sdp_stream->transport,
- &req_sdp_stream->raw_stream,
- &rpl_sdp_stream->raw_stream, direction);
+ add_flow_description((rx_authsessiondata_t*) auth->u.auth.generic_data,
sdp_stream_num + 1,
+ &req_sdp_stream->media, &req_sdp_session->ip_addr,
+ &req_sdp_stream->port, &rpl_sdp_session->ip_addr,
+ &rpl_sdp_stream->port, &rpl_sdp_stream->transport,
+ &req_sdp_stream->raw_stream,
+ &rpl_sdp_stream->raw_stream, direction, 0 /*This is a new mcd, we are not
setting it as active*/);
+
+ rx_add_media_component_description_avp(aar, sdp_stream_num + 1,
+ &req_sdp_stream->media, &req_sdp_session->ip_addr,
+ &req_sdp_stream->port, &rpl_sdp_session->ip_addr,
+ &rpl_sdp_stream->port, &rpl_sdp_stream->transport,
+ &req_sdp_stream->raw_stream,
+ &rpl_sdp_stream->raw_stream, direction);
+ }
+ add_flow = 1;
}
}
sdp_stream_num++;