[asterisk-dev] Problem with SRTP on aastra with version 3 of Firmxare Issue: 18919
Bernard Merindol(F)
Bernard.Merindol at free.fr
Fri Mar 25 15:55:16 CDT 2011
Hi,
I works to patch this problem:
https://issues.asterisk.org/view.php?id=18919
My patch works when the crypto is changed in OK answer. But the new version of AAstra phone (version 3) also change the crypto in RE-INVITE.
Example:
Phone A :Aastra with version 3 of firmware
Phone B : Aastra phone
A call B , B answer
A push hold button, wait and push unhold . When push unhold the phone A send INVITE with new crypto. In this case is not works.
The audio stream sended by A is not decoded by asterisk.
Analyse:
First problem is in chan_sip.c
Actual code:
if ((*srtp)->crypto && !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
ast_debug(3, "We've already processed a crypto attribute, skipping '%s'\n", a);
return FALSE;
}
I change to
if ((*srtp)->crypto && !ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
ast_debug(3, "We've already processed a crypto attribute, skipping '%s'\n", a);
/* BUG dans le cas d'un changement de crypto lors d'un re-invite */
// return FALSE;
}
But in this case the new crypto is not set in libSRTPP
I have changer in res_srtp.c the function (ast_srtp_add_stream) this change works for the crypto change in OK but not in INVITE.
static int ast_srtp_add_stream(struct ast_srtp *srtp, struct ast_srtp_policy *policy)
{
struct ast_srtp_policy *match;
err_status_t status;
if ((match = find_policy(srtp, &policy->sp, OBJ_POINTER))) {
ast_debug(3, "Policy already exists with ssrc %x, updating.\n", policy->sp.ssrc.value);
if ( policy->sp.ssrc.value == 0 )
{
struct ast_rtp_instance_stats stats;
ast_rtp_instance_get_stats(srtp->rtp, &stats, AST_RTP_INSTANCE_STAT_REMOTE_SSRC);
policy->sp.ssrc.type = ssrc_specific;
policy->sp.ssrc.value = stats.remote_ssrc;
}
else
{
return 0;
}
}
status = srtp_add_stream(srtp->session, &policy->sp);
if (status != err_status_ok) {
ast_log(LOG_ERROR, "Failed to add SRTP policy. Err=%d.\n", status);
return -1;
}
ao2_t_link(srtp->policies, policy, "Added additional stream");
return 0;
}
I need help.
Best regards
Bernard
More information about the asterisk-dev
mailing list