-
Notifications
You must be signed in to change notification settings - Fork 806
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: handle incoming INVITE with siprec #4132
Conversation
I couldn't debug the Bitrise error and figure out where the issue in my code is. Please guide me to resolve the problem. |
Thank you for the submission. The support seems to be pretty basic, i.e. it allows incoming request with siprec to be accepted (instead of declined). There are a few concerns though:
|
I don't know what the issue with |
I have considered three modes for
I use two variables to determine the state for the three modes above.
When And in the code below, I attempt to return a "Bad Extension" error:
else if (!(*options & PJSIP_INV_SUPPORT_SIPREC) &&
pj_stricmp(&req_hdr->values[i], &STR_SIPREC)==0)
{
unsupp_tags[unsupp_cnt++] = req_hdr->values[i];
} In the code above, when the The pjsip_inv_verify_request3 function is called three times for each call. The first time, it includes the desired options, but for the next two calls, the option value is zero. Therefore, I added the following code to resolve this issue:
if (status == PJ_SUCCESS) {
unsigned options = 0;
/* Add SIPREC support to prevent the "bad extension" error */
options |= PJSIP_INV_SUPPORT_SIPREC; // add this line
/* Verify that we can handle the request. */
status = pjsip_inv_verify_request3(rdata,
call->inv->pool_prov, &options,
offer, answer, NULL,
pjsua_var.endpt, response); If there's a better solution to address the issue mentioned, please guide me. and I don't know what the issue with In my previous commit, to resolve this issue, I added
else if ((*options & PJSIP_INV_NOT_SUPPORT_SIPREC) &&
pj_stricmp(&req_hdr->values[i], &STR_SIPREC)==0)
{
unsupp_tags[unsupp_cnt++] = req_hdr->values[i];
} |
For the failed CI test, we have fixed it in #4234, so don't worry about it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the implementation is not a full functionality, I think the PR title should be changed to represent to coverage, e.g: something like "Add siprec extension: handle incoming INVITE with siprec", I can do this if you want :)
Also better if the PR desc briefly describes what to do next to implement a recording server with full functionality, unfortunately I think this needs to be done by you as I believe you've done it in real app.
Thanks for the submission & all the works!
To implement simple Session Recording Server (SRS) using the SIPREC module, you can follow the steps below.I am using ConfigurationTo configure the SIPREC module, you can proceed as in the code below. AccountConfig accountConfig;
accountConfig.callConfig.siprecUse = PJSUA_SIP_SIPREC_OPTIONAL; AudioAlso, to save audio, you can use the following code. class MyCall : public pj::Call
{
void onCallMediaState(pj::OnCallMediaStateParam& params)
{
pj::CallInfo callInfo = getInfo();
for (unsigned media_index = 0; media_index < callInfo.media.size(); media_index++)
{
if (callInfo.media[media_index].type == PJMEDIA_TYPE_AUDIO)
{
pj::AudioMedia audioMedia = getAudioMedia(media_index);
recorder.createRecorder(path);
audioMedio.startTransmit(recorder);
}
}
}
}; MetadataAnd to access metadata, you can use the following code. class MyCall : public pj::Call
{
void saveMetadata()
{
int id = getId();
pjsua_call *call = &pjsua_var.calls[id];
std::string metadata = std::string(call->siprec_metadata.ptr, call->siprec_metadata.slen);
}
}; Unsupported Features in the SIPREC ModuleA list of items that are not present in the SIPREC module:
I will try to implement some of the above items in another PR. |
I had a Session Record Client (SRC) that utilized the SIPREC module from the OpenSIPS SIP server, and I intended to develop a Session Record Server (SRS) capable of supporting SIPREC. The goal was for the SRS to handle requests effectively. However, since PJSIP does not support the SIPREC extension, I added SIPREC extension support to PJSIP.
Senario with siprec extension:
INVITE Request
420 Bad Extension Response
Senario with siprec extension:
In the SIPREC module of PJSIP, when an INVITE is received with the header
Require: siprec
and two media attribute labels in the offer SDP, it can generate an appropriate200 OK
response that includes those two media attribute labels in the SDP answer.INVITE Request
200 OK Response