Only send channel identifier with call proceeding

git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@96 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Mark Spencer 2004-05-19 21:01:36 +00:00
parent 2c26d98a89
commit 7aac157b7f
4 changed files with 22 additions and 19 deletions

View File

@ -395,9 +395,9 @@ extern int pri_fd(struct pri *pri);
#define PRI_PROGRESS #define PRI_PROGRESS
/* Send call proceeding */ /* Send call proceeding */
extern int pri_progress(struct pri *pri, q931_call *c, int info); extern int pri_progress(struct pri *pri, q931_call *c, int channel, int info);
#define PRI_PROCEEDING #define PRI_PROCEEDING_FULL
/* Send call proceeding */ /* Send call proceeding */
extern int pri_proceeding(struct pri *pri, q931_call *c, int info); extern int pri_proceeding(struct pri *pri, q931_call *c, int channel, int info);
#endif #endif

8
pri.c
View File

@ -191,18 +191,18 @@ int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info)
return q931_alerting(pri, call, channel, info); return q931_alerting(pri, call, channel, info);
} }
int pri_proceeding(struct pri *pri, q931_call *call, int info) int pri_proceeding(struct pri *pri, q931_call *call, int channel, int info)
{ {
if (!pri || !call) if (!pri || !call)
return -1; return -1;
return q931_call_proceeding(pri, call,info); return q931_call_proceeding(pri, call, channel, info);
} }
int pri_progress(struct pri *pri, q931_call *call, int info) int pri_progress(struct pri *pri, q931_call *call, int channel, int info)
{ {
if (!pri || !call) if (!pri || !call)
return -1; return -1;
return q931_call_progress(pri, call,info); return q931_call_progress(pri, call, channel, info);
} }
int pri_information(struct pri *pri, q931_call *call, char digit) int pri_information(struct pri *pri, q931_call *call, char digit)

View File

@ -243,9 +243,9 @@ extern int q931_receive(struct pri *pri, q931_h *h, int len);
extern int q931_alerting(struct pri *pri, q931_call *call, int channel, int info); extern int q931_alerting(struct pri *pri, q931_call *call, int channel, int info);
extern int q931_call_progress(struct pri *pri, q931_call *call, int info); extern int q931_call_progress(struct pri *pri, q931_call *call, int channel, int info);
extern int q931_call_proceeding(struct pri *pri, q931_call *call, int info); extern int q931_call_proceeding(struct pri *pri, q931_call *call, int channel, int info);
extern int q931_setup_ack(struct pri *pri, q931_call *call, int channel, int nonisdn); extern int q931_setup_ack(struct pri *pri, q931_call *call, int channel, int nonisdn);

23
q931.c
View File

@ -360,6 +360,8 @@ static int receive_channel_id(struct pri *pri, q931_call *call, int msgtype, q93
static int transmit_channel_id(struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len) static int transmit_channel_id(struct pri *pri, q931_call *call, int msgtype, q931_ie *ie, int len)
{ {
int pos=0; int pos=0;
if (!call->channelno)
return 0;
/* Start with standard stuff */ /* Start with standard stuff */
ie->data[pos] = 0xa1; ie->data[pos] = 0xa1;
/* Add exclusive flag if necessary */ /* Add exclusive flag if necessary */
@ -1569,8 +1571,11 @@ static int call_progress_ies[] = { Q931_CHANNEL_IDENT, -1 };
static int call_progress_ies[] = { Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, -1 }; static int call_progress_ies[] = { Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, -1 };
#endif #endif
int q931_call_progress(struct pri *pri, q931_call *c, int info) int q931_call_progress(struct pri *pri, q931_call *c, int channel, int info)
{ {
if (!c->proc)
q931_call_proceeding(pri, c, channel, 0);
c->channelno = 0;
c->ourcallstate = Q931_CALL_STATE_INCOMING_CALL_PROCEEDING; c->ourcallstate = Q931_CALL_STATE_INCOMING_CALL_PROCEEDING;
c->peercallstate = Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING; c->peercallstate = Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING;
if (info) { if (info) {
@ -1579,8 +1584,6 @@ int q931_call_progress(struct pri *pri, q931_call *c, int info)
c->progress = Q931_PROG_INBAND_AVAILABLE; c->progress = Q931_PROG_INBAND_AVAILABLE;
} else } else
c->progress = -1; c->progress = -1;
if (!c->proc)
q931_call_proceeding(pri, c, 0);
c->proc = 1; c->proc = 1;
c->alive = 1; c->alive = 1;
return send_message(pri, c, Q931_PROGRESS, call_progress_ies); return send_message(pri, c, Q931_PROGRESS, call_progress_ies);
@ -1592,8 +1595,12 @@ static int call_proceeding_ies[] = { Q931_CHANNEL_IDENT, -1 };
static int call_proceeding_ies[] = { Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, -1 }; static int call_proceeding_ies[] = { Q931_CHANNEL_IDENT, Q931_PROGRESS_INDICATOR, -1 };
#endif #endif
int q931_call_proceeding(struct pri *pri, q931_call *c, int info) int q931_call_proceeding(struct pri *pri, q931_call *c, int channel, int info)
{ {
if (channel)
c->channelno = channel;
c->chanflags &= ~FLAG_PREFERRED;
c->chanflags |= FLAG_EXCLUSIVE;
c->ourcallstate = Q931_CALL_STATE_INCOMING_CALL_PROCEEDING; c->ourcallstate = Q931_CALL_STATE_INCOMING_CALL_PROCEEDING;
c->peercallstate = Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING; c->peercallstate = Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING;
if (info) { if (info) {
@ -1614,18 +1621,14 @@ static int alerting_ies[] = { Q931_CHANNEL_IDENT, -1 };
int q931_alerting(struct pri *pri, q931_call *c, int channel, int info) int q931_alerting(struct pri *pri, q931_call *c, int channel, int info)
{ {
if (channel) if (!c->proc)
c->channelno = channel; q931_call_proceeding(pri, c, channel, 0);
c->chanflags &= ~FLAG_PREFERRED;
c->chanflags |= FLAG_EXCLUSIVE;
if (info) { if (info) {
c->progloc = LOC_PRIV_NET_LOCAL_USER; c->progloc = LOC_PRIV_NET_LOCAL_USER;
c->progcode = CODE_CCITT; c->progcode = CODE_CCITT;
c->progress = Q931_PROG_INBAND_AVAILABLE; c->progress = Q931_PROG_INBAND_AVAILABLE;
} else } else
c->progress = -1; c->progress = -1;
if (!c->proc)
q931_call_proceeding(pri, c, 0);
c->ourcallstate = Q931_CALL_STATE_CALL_RECEIVED; c->ourcallstate = Q931_CALL_STATE_CALL_RECEIVED;
c->peercallstate = Q931_CALL_STATE_CALL_DELIVERED; c->peercallstate = Q931_CALL_STATE_CALL_DELIVERED;
c->alive = 1; c->alive = 1;