Fix ie ordering in some ie lists for send_message().

git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1018 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Richard Mudgett 2009-08-25 16:49:07 +00:00
parent 176f0bf6cd
commit 3908bf2e48

25
q931.c
View File

@ -3262,6 +3262,21 @@ static int q931_xmit(struct pri *ctrl, q931_h *h, int len, int cr)
return 0; return 0;
} }
/*!
* \internal
* \brief Build and send the requested message.
*
* \param ctrl D channel controller.
* \param call Q.931 call leg
* \param msgtype Q.931 message type to build.
* \param ies List of ie's to put in the message.
*
* \note The ie's in the ie list must be in numerical order.
* See Q.931 section 4.5.1 coding rules.
*
* \retval 0 on success.
* \retval -1 on error.
*/
static int send_message(struct pri *ctrl, q931_call *call, int msgtype, int ies[]) static int send_message(struct pri *ctrl, q931_call *call, int msgtype, int ies[])
{ {
unsigned char buf[1024]; unsigned char buf[1024];
@ -3449,7 +3464,7 @@ int q931_notify(struct pri *ctrl, q931_call *c, int channel, int info)
#ifdef ALERTING_NO_PROGRESS #ifdef ALERTING_NO_PROGRESS
static int call_progress_ies[] = { -1 }; static int call_progress_ies[] = { -1 };
#else #else
static int call_progress_with_cause_ies[] = { Q931_PROGRESS_INDICATOR, Q931_CAUSE, -1 }; static int call_progress_with_cause_ies[] = { Q931_CAUSE, Q931_PROGRESS_INDICATOR, -1 };
static int call_progress_ies[] = { Q931_PROGRESS_INDICATOR, -1 }; static int call_progress_ies[] = { Q931_PROGRESS_INDICATOR, -1 };
#endif #endif
@ -3530,7 +3545,7 @@ int q931_call_proceeding(struct pri *ctrl, q931_call *c, int channel, int info)
return send_message(ctrl, c, Q931_CALL_PROCEEDING, call_proceeding_ies); return send_message(ctrl, c, Q931_CALL_PROCEEDING, call_proceeding_ies);
} }
#ifndef ALERTING_NO_PROGRESS #ifndef ALERTING_NO_PROGRESS
static int alerting_ies[] = { Q931_PROGRESS_INDICATOR, Q931_IE_USER_USER, Q931_IE_FACILITY, -1 }; static int alerting_ies[] = { Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_IE_USER_USER, -1 };
#else #else
static int alerting_ies[] = { Q931_IE_FACILITY, -1 }; static int alerting_ies[] = { Q931_IE_FACILITY, -1 };
#endif #endif
@ -3563,7 +3578,7 @@ int q931_alerting(struct pri *ctrl, q931_call *c, int channel, int info)
return send_message(ctrl, c, Q931_ALERTING, alerting_ies); return send_message(ctrl, c, Q931_ALERTING, alerting_ies);
} }
static int connect_ies[] = { Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, Q931_IE_CONNECTED_NUM, Q931_IE_FACILITY, -1 }; static int setup_ack_ies[] = { Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_IE_CONNECTED_NUM, -1 };
int q931_setup_ack(struct pri *ctrl, q931_call *c, int channel, int nonisdn) int q931_setup_ack(struct pri *ctrl, q931_call *c, int channel, int nonisdn)
{ {
@ -3583,7 +3598,7 @@ int q931_setup_ack(struct pri *ctrl, q931_call *c, int channel, int nonisdn)
UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_OVERLAP_RECEIVING); UPDATE_OURCALLSTATE(ctrl, c, Q931_CALL_STATE_OVERLAP_RECEIVING);
c->peercallstate = Q931_CALL_STATE_OVERLAP_SENDING; c->peercallstate = Q931_CALL_STATE_OVERLAP_SENDING;
c->alive = 1; c->alive = 1;
return send_message(ctrl, c, Q931_SETUP_ACKNOWLEDGE, connect_ies); return send_message(ctrl, c, Q931_SETUP_ACKNOWLEDGE, setup_ack_ies);
} }
/* T313 expiry, first time */ /* T313 expiry, first time */
@ -3645,6 +3660,8 @@ static void pri_disconnect_timeout(void *data)
q931_release(ctrl, c, PRI_CAUSE_NORMAL_CLEARING); q931_release(ctrl, c, PRI_CAUSE_NORMAL_CLEARING);
} }
static int connect_ies[] = { Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_IE_CONNECTED_NUM, -1 };
int q931_connect(struct pri *ctrl, q931_call *c, int channel, int nonisdn) int q931_connect(struct pri *ctrl, q931_call *c, int channel, int nonisdn)
{ {
if (channel) { if (channel) {