Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add siprec extension #4132

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.symbian/pjsip_ua.mmp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ SOURCE sip_replaces.c
SOURCE sip_xfer.c
SOURCE sip_100rel.c
SOURCE sip_timer.c
SOURCE sip_siprec.c

SYSTEMINCLUDE ..\pjlib\include
SYSTEMINCLUDE ..\pjlib-util\include
Expand Down
2 changes: 1 addition & 1 deletion pjsip/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export PJSIP_LDFLAGS += $(PJLIB_UTIL_LDLIB) \
export PJSIP_UA_SRCDIR = ../src/pjsip-ua
export PJSIP_UA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
sip_inv.o sip_reg.o sip_replaces.o sip_xfer.o \
sip_100rel.o sip_timer.o
sip_100rel.o sip_timer.o sip_siprec.o
export PJSIP_UA_CFLAGS += $(_CFLAGS)
export PJSIP_UA_CXXFLAGS += $(_CXXFLAGS)
export PJSIP_UA_LDFLAGS += $(PJSIP_SIMPLE_LDLIB) \
Expand Down
8 changes: 8 additions & 0 deletions pjsip/build/pjsip_ua.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -3468,6 +3468,10 @@
RelativePath="..\src\pjsip-ua\sip_timer.c"
>
</File>
<File
RelativePath="..\src\pjsip-ua\sip_siprec.c"
>
</File>
<File
RelativePath="..\src\pjsip-ua\sip_xfer.c"
>
Expand Down Expand Up @@ -3609,6 +3613,10 @@
RelativePath="..\include\pjsip-ua\sip_timer.h"
>
</File>
<File
RelativePath="..\include\pjsip-ua\sip_siprec.h"
>
</File>
<File
RelativePath="..\include\pjsip-ua\sip_xfer.h"
>
Expand Down
2 changes: 2 additions & 0 deletions pjsip/build/pjsip_ua.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
<ClCompile Include="..\src\pjsip-ua\sip_reg.c" />
<ClCompile Include="..\src\pjsip-ua\sip_replaces.c" />
<ClCompile Include="..\src\pjsip-ua\sip_timer.c" />
<ClCompile Include="..\src\pjsip-ua\sip_siprec.c" />
<ClCompile Include="..\src\pjsip-ua\sip_xfer.c" />
</ItemGroup>
<ItemGroup>
Expand All @@ -687,6 +688,7 @@
<ClInclude Include="..\include\pjsip-ua\sip_regc.h" />
<ClInclude Include="..\include\pjsip-ua\sip_replaces.h" />
<ClInclude Include="..\include\pjsip-ua\sip_timer.h" />
<ClInclude Include="..\include\pjsip-ua\sip_siprec.h" />
<ClInclude Include="..\include\pjsip-ua\sip_xfer.h" />
<ClInclude Include="..\include\pjsip_ua.h" />
</ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions pjsip/build/pjsip_ua.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<ClCompile Include="..\src\pjsip-ua\sip_timer.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\pjsip-ua\sip_siprec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\pjsip-ua\sip_xfer.c">
<Filter>Source Files</Filter>
</ClCompile>
Expand All @@ -49,6 +52,9 @@
<ClInclude Include="..\include\pjsip-ua\sip_timer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\pjsip-ua\sip_siprec.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\include\pjsip-ua\sip_xfer.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down
9 changes: 9 additions & 0 deletions pjsip/include/pjsip-ua/sip_inv.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,16 @@ enum pjsip_inv_option
* Require trickle ICE support.
*/
PJSIP_INV_REQUIRE_TRICKLE_ICE = 512,

/**
* Indicate support for siprec
*/
PJSIP_INV_SUPPORT_SIPREC = 1024,

/**
* Require siprec support.
*/
PJSIP_INV_REQUIRE_SIPREC = 2048,
};

/* Forward declaration of Session Timers */
Expand Down
82 changes: 82 additions & 0 deletions pjsip/include/pjsip-ua/sip_siprec.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#ifndef __PJSIP_SIPREC_H__
#define __PJSIP_SIPREC_H__

/**
* @file sip_siprec.h
* @brief SIP Session Recording Protocol (siprec) support (RFC 7866 - Session Recording Protocol in SIP)
*/


#include <pjsip-ua/sip_inv.h>
#include <pjsip/sip_msg.h>

/**
* @defgroup PJSIP_SIPREC SIP Session Recording Protocol (siprec) support (RFC 7866 - Session Recording Protocol in SIP)
* @brief SIP Session Recording Protocol support (RFC 7866 - Session Recording Protocol in SIP)
* @{
*
* \section PJSIP_SIPREC_REFERENCE References
*
* References:
* - <A HREF="http://www.ietf.org/rfc/rfc7866.txt">RFC 7866: Session Recording Protocol (siprec)
* in the Session Initiation Protocol (SIP)</A>
*/
PJ_BEGIN_DECL

/**
* Initialize siprec module. This function must be called once during
* application initialization, to register siprec module to SIP endpoint.
*
* @param endpt The SIP endpoint instance.
*
* @return PJ_SUCCESS if module is successfully initialized.
*/
PJ_DECL(pj_status_t) pjsip_siprec_init_module(pjsip_endpoint *endpt);


/**
* Create a=label attribute.
*
* @param media The SDP media answer.
*
* @return SDP label attribute.
*/
PJ_DEF(pjmedia_sdp_attr*) pjmedia_sdp_attr_get_label(pjmedia_sdp_media *answer);


PJ_DEF(pj_status_t) pjsip_siprec_verify_require_hdr(pjsip_require_hdr *req_hdr);


PJ_DEF(pj_status_t) pjsip_siprec_verify_sdp_attr_label(pjmedia_sdp_session *sdp);


/**
* Verifies that the incoming request has the siprec value in the Require header.
* This function checks whether the incoming request is a siprec request or not."
*
* @param rdata The incoming request to be verified.
*
* @return The function returns the following:
* - If the request doesn't contain siprec in Require header, the
* function returns PJ_FALSE
* - If the request contains siprec in Require header, the
* function returns PJ_TRUE
*/
PJ_DEF(pj_status_t) pjsip_siprec_verify_request(pjsip_rx_data *rdata,
pjmedia_sdp_session *sdp_offer,
unsigned *options,
pjsip_dialog *dlg,
pjsip_endpoint *endpt,
pjsip_tx_data **p_tdata);



PJ_END_DECL


/**
* @}
*/


#endif /* __PJSIP_SIPREC_H__ */
1 change: 1 addition & 0 deletions pjsip/include/pjsip_ua.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <pjsip-ua/sip_xfer.h>
#include <pjsip-ua/sip_100rel.h>
#include <pjsip-ua/sip_timer.h>
#include <pjsip-ua/sip_siprec.h>


#endif /* __PJSIP_UA_H__ */
Expand Down
12 changes: 11 additions & 1 deletion pjsip/src/pjsip-ua/sip_inv.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <pjsip-ua/sip_inv.h>
#include <pjsip-ua/sip_100rel.h>
#include <pjsip-ua/sip_timer.h>
#include <pjsip-ua/sip_siprec.h>
#include <pjsip/print_util.h>
#include <pjsip/sip_module.h>
#include <pjsip/sip_endpoint.h>
Expand Down Expand Up @@ -1277,7 +1278,9 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request3(pjsip_rx_data *rdata,
*options |= PJSIP_INV_SUPPORT_ICE;
if (*options & PJSIP_INV_REQUIRE_TRICKLE_ICE)
*options |= PJSIP_INV_SUPPORT_TRICKLE_ICE;

if (*options & PJSIP_INV_REQUIRE_SIPREC)
*options |= PJSIP_INV_SUPPORT_SIPREC;

if (rdata) {
/* Get the message in rdata */
msg = rdata->msg_info.msg;
Expand Down Expand Up @@ -1529,6 +1532,7 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request3(pjsip_rx_data *rdata,
const pj_str_t STR_TIMER = { "timer", 5 };
const pj_str_t STR_ICE = { "ice", 3 };
const pj_str_t STR_TRICKLE_ICE = { "trickle-ice", 11 };
const pj_str_t STR_SIPREC = { "siprec", 6 };
unsigned unsupp_cnt = 0;
pj_str_t unsupp_tags[PJSIP_GENERIC_ARRAY_MAX_COUNT];

Expand All @@ -1538,6 +1542,11 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request3(pjsip_rx_data *rdata,
{
rem_option |= PJSIP_INV_REQUIRE_100REL;

} else if ((*options & PJSIP_INV_SUPPORT_SIPREC) &&
pj_stricmp(&req_hdr->values[i], &STR_SIPREC)==0)
{
rem_option |= PJSIP_INV_REQUIRE_SIPREC;

} else if ((*options & PJSIP_INV_SUPPORT_TIMER) &&
pj_stricmp(&req_hdr->values[i], &STR_TIMER)==0)
{
Expand All @@ -1546,6 +1555,7 @@ PJ_DEF(pj_status_t) pjsip_inv_verify_request3(pjsip_rx_data *rdata,
} else if (pj_stricmp(&req_hdr->values[i], &STR_REPLACES)==0) {
pj_bool_t supp;


supp = pjsip_endpt_has_capability(endpt, PJSIP_H_SUPPORTED,
NULL, &STR_REPLACES);
if (!supp)
Expand Down
Loading