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

SETUP or RELEASE retransmission: resend UUI in retransmitted message #8

Open
wants to merge 1 commit 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
9 changes: 9 additions & 0 deletions pri_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,15 @@ struct q931_call {
/*! Encoded RESTART channel id. */
int channel;
} restart_tx;
/*! Message retransmission cache */
struct {
/*! Cache status: set valid as soon as filled in */
int valid;
/*! Sent message type */
int msgtype;
/*! User-user information */
char useruserinfo[256];
} retrans_cache;
};

enum CC_STATES {
Expand Down
15 changes: 15 additions & 0 deletions q931.c
Original file line number Diff line number Diff line change
Expand Up @@ -4451,6 +4451,7 @@ void q931_init_call_record(struct q921_link *link, struct q931_call *call, int c
q931_party_id_init(&call->remote_id);
q931_party_number_init(&call->ani);
q931_party_redirecting_init(&call->redirecting);
call->retrans_cache.valid = 0;

/* The call is now attached to whoever called us */
ctrl = link->ctrl;
Expand Down Expand Up @@ -5312,6 +5313,20 @@ static int send_message(struct pri *ctrl, q931_call *call, int msgtype, int ies[
return -1;
}

/* Message retransmission cache */
if (msgtype == Q931_SETUP || msgtype == Q931_RELEASE) {
if (call->retrans_cache.valid && call->retrans_cache.msgtype == msgtype) {
/* Restore User-user information */
libpri_copy_string(call->useruserinfo, call->retrans_cache.useruserinfo, sizeof(call->useruserinfo));
} else {
/* Update cache with new message information */
call->retrans_cache.msgtype = msgtype;
/* Store useruserinfo: q931_call useruserinfo field is ephemeral, cleared as soon as transmitted */
libpri_copy_string(call->retrans_cache.useruserinfo, call->useruserinfo, sizeof(call->retrans_cache.useruserinfo));
call->retrans_cache.valid = 1;
}
}

memset(buf, 0, sizeof(buf));
len = sizeof(buf);
init_header(ctrl, call, buf, &h, &mh, &len, (msgtype >> 8));
Expand Down