diff --git a/libpri.h b/libpri.h index 6cbd70a..2b785f1 100755 --- a/libpri.h +++ b/libpri.h @@ -395,9 +395,9 @@ extern int pri_fd(struct pri *pri); #define PRI_PROGRESS /* 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 */ -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 diff --git a/pri.c b/pri.c index 4bfae0b..c4839df 100755 --- a/pri.c +++ b/pri.c @@ -191,18 +191,18 @@ int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int 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) 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) 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) diff --git a/pri_q931.h b/pri_q931.h index 25571f7..f0f32d5 100755 --- a/pri_q931.h +++ b/pri_q931.h @@ -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_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); diff --git a/q931.c b/q931.c index a52ac54..6e27718 100755 --- a/q931.c +++ b/q931.c @@ -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) { int pos=0; + if (!call->channelno) + return 0; /* Start with standard stuff */ ie->data[pos] = 0xa1; /* 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 }; #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->peercallstate = Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING; if (info) { @@ -1579,8 +1584,6 @@ int q931_call_progress(struct pri *pri, q931_call *c, int info) c->progress = Q931_PROG_INBAND_AVAILABLE; } else c->progress = -1; - if (!c->proc) - q931_call_proceeding(pri, c, 0); c->proc = 1; c->alive = 1; 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 }; #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->peercallstate = Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING; 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) { - if (channel) - c->channelno = channel; - c->chanflags &= ~FLAG_PREFERRED; - c->chanflags |= FLAG_EXCLUSIVE; + if (!c->proc) + q931_call_proceeding(pri, c, channel, 0); if (info) { c->progloc = LOC_PRIV_NET_LOCAL_USER; c->progcode = CODE_CCITT; c->progress = Q931_PROG_INBAND_AVAILABLE; } else c->progress = -1; - if (!c->proc) - q931_call_proceeding(pri, c, 0); c->ourcallstate = Q931_CALL_STATE_CALL_RECEIVED; c->peercallstate = Q931_CALL_STATE_CALL_DELIVERED; c->alive = 1;