diff --git a/libpri.h b/libpri.h index 974d0e3..abcb946 100755 --- a/libpri.h +++ b/libpri.h @@ -308,6 +308,9 @@ extern char *pri_cause2str(int cause); is in-band data available on the channel */ extern int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info); +/* Send a digit in overlap mode */ +extern int pri_information(struct pri *pri, q931_call *call, char digit); + /* Answer the incomplete(call without called number) call on the given channel. Set non-isdn to non-zero if you are not connecting to ISDN equipment */ extern int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn); diff --git a/pri.c b/pri.c index ff0fc8d..4bc7633 100755 --- a/pri.c +++ b/pri.c @@ -181,6 +181,13 @@ int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info) return q931_alerting(pri, call, channel, info); } +int pri_information(struct pri *pri, q931_call *call, char digit) +{ + if (!pri || !call) + return -1; + return q931_information(pri, call, digit); +} + int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn) { if (!pri || !call) diff --git a/pri_q931.h b/pri_q931.h index 1d551c9..b336399 100755 --- a/pri_q931.h +++ b/pri_q931.h @@ -247,6 +247,8 @@ extern int q931_call_proceeding(struct pri *pri, q931_call *call); extern int q931_setup_ack(struct pri *pri, q931_call *call, int channel, int nonisdn); +extern int q931_information(struct pri *pri, q931_call *call, char digit); + extern int q931_connect(struct pri *pri, q931_call *call, int channel, int nonisdn); extern int q931_release(struct pri *pri, q931_call *call, int cause); diff --git a/q931.c b/q931.c index ade31a1..84fb408 100755 --- a/q931.c +++ b/q931.c @@ -1487,12 +1487,20 @@ static int q931_status(struct pri *pri, q931_call *c) if (!cur) { /* something went wrong, respond with "no such call" */ c->ourcallstate = Q931_CALL_STATE_NULL; - c->cr|=0x80; cur=c; } return send_message(pri, cur, Q931_STATUS, status_ies); } +static int information_ies[] = { Q931_CALLED_PARTY_NUMBER, -1 }; + +int q931_information(struct pri *pri, q931_call *c, char digit) +{ + strncpy(c->callednum,&digit,1); + c->callednum[1]='\0'; + return send_message(pri, c, Q931_INFORMATION, information_ies); +} + static int restart_ack_ies[] = { Q931_CHANNEL_IDENT, Q931_RESTART_INDICATOR, -1 }; static int restart_ack(struct pri *pri, q931_call *c) @@ -1801,6 +1809,7 @@ int q931_receive(struct pri *pri, q931_h *h, int len) case Q931_STATUS_ENQUIRY: break; case Q931_SETUP_ACKNOWLEDGE: + break; case Q931_USER_INFORMATION: case Q931_SEGMENT: case Q931_CONGESTION_CONTROL: @@ -1848,7 +1857,6 @@ int q931_receive(struct pri *pri, q931_h *h, int len) pri->ev.e = PRI_EVENT_RESTART; pri->ev.restart.channel = c->channelno; return Q931_RES_HAVEEVENT; - break; case Q931_SETUP: c->ourcallstate = Q931_CALL_STATE_CALL_PRESENT; c->alive = 1; @@ -1970,11 +1978,9 @@ int q931_receive(struct pri *pri, q931_h *h, int len) break; pri->ev.e = PRI_EVENT_INFO_RECEIVED; pri->ev.ring.call = c; - + pri->ev.ring.channel = c->channelno; strncpy(pri->ev.ring.callednum, c->callednum, sizeof(pri->ev.ring.callednum) - 1); - return Q931_RES_HAVEEVENT; - case Q931_STATUS_ENQUIRY: q931_status(pri,c); break;