Index: channel.c =================================================================== RCS file: /usr/cvsroot/asterisk/channel.c,v retrieving revision 1.7 diff -c -r1.7 channel.c *** channel.c 9 Apr 2003 04:00:43 -0000 1.7 --- channel.c 10 Apr 2003 03:09:25 -0000 *************** *** 1454,1461 **** cut = strchr(name,'-'); if (cut) *cut = 0; ! if (!strcmp(name, device)) return AST_DEVICE_INUSE; chan = ast_channel_walk(chan); } return AST_DEVICE_UNKNOWN; --- 1454,1465 ---- cut = strchr(name,'-'); if (cut) *cut = 0; ! if (!strcmp(name, device)) { ! if (chan->_state == AST_STATE_RINGING) ! return AST_DEVICE_RINGING; ! else return AST_DEVICE_INUSE; + } chan = ast_channel_walk(chan); } return AST_DEVICE_UNKNOWN; *************** *** 1888,1895 **** if (chan->_state != state) { int oldstate = chan->_state; chan->_state = state; if (oldstate == AST_STATE_DOWN) { - ast_device_state_changed(chan->name); manager_event(EVENT_FLAG_CALL, "Newchannel", "Channel: %s\r\n" "State: %s\r\n" --- 1892,1899 ---- if (chan->_state != state) { int oldstate = chan->_state; chan->_state = state; + ast_device_state_changed(chan->name); if (oldstate == AST_STATE_DOWN) { manager_event(EVENT_FLAG_CALL, "Newchannel", "Channel: %s\r\n" "State: %s\r\n" Index: pbx.c =================================================================== RCS file: /usr/cvsroot/asterisk/pbx.c,v retrieving revision 1.10 diff -c -r1.10 pbx.c *** pbx.c 6 Apr 2003 19:10:24 -0000 1.10 --- pbx.c 10 Apr 2003 03:09:26 -0000 *************** *** 1132,1137 **** --- 1132,1138 ---- int res = -1; int allunavailable = 1, allbusy = 1, allfree = 1; int busy = 0; + int inuse = 0; strncpy(hint, ast_get_extension_app(e), sizeof(hint)-1); *************** *** 1150,1156 **** allbusy = 0; break; case AST_DEVICE_INUSE: ! return AST_EXTENSION_INUSE; case AST_DEVICE_BUSY: allunavailable = 0; allfree = 0; --- 1151,1163 ---- allbusy = 0; break; case AST_DEVICE_INUSE: ! inuse = 1; ! allunavailable = 0; ! allfree = 0; ! allbusy = 0; ! break; ! case AST_DEVICE_RINGING: ! return AST_EXTENSION_RINGING; case AST_DEVICE_BUSY: allunavailable = 0; allfree = 0; *************** *** 1175,1181 **** return AST_EXTENSION_BUSY; if (allunavailable) return AST_EXTENSION_UNAVAILABLE; ! if (busy) return AST_EXTENSION_INUSE; return AST_EXTENSION_NOT_INUSE; --- 1182,1188 ---- return AST_EXTENSION_BUSY; if (allunavailable) return AST_EXTENSION_UNAVAILABLE; ! if (inuse || busy) return AST_EXTENSION_INUSE; return AST_EXTENSION_NOT_INUSE; Index: channels/chan_sip.c =================================================================== RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v retrieving revision 1.70 diff -c -r1.70 chan_sip.c *** channels/chan_sip.c 10 Apr 2003 00:06:16 -0000 1.70 --- channels/chan_sip.c 10 Apr 2003 03:09:28 -0000 *************** *** 2406,2412 **** t = tmp + strlen(tmp); sprintf(t, "\n", p->exten); t = tmp + strlen(tmp); ! sprintf(t, "%s\n", state ? "confirmed" : "terminated"); t = tmp + strlen(tmp); sprintf(t, "\n\n"); } --- 2406,2412 ---- t = tmp + strlen(tmp); sprintf(t, "\n", p->exten); t = tmp + strlen(tmp); ! sprintf(t, "%s\n", state==AST_EXTENSION_RINGING ? "early" : state ? "confirmed" : "terminated"); t = tmp + strlen(tmp); sprintf(t, "\n\n"); } Index: include/asterisk/channel.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/channel.h,v retrieving revision 1.5 diff -c -r1.5 channel.h *** include/asterisk/channel.h 9 Apr 2003 23:56:15 -0000 1.5 --- include/asterisk/channel.h 10 Apr 2003 03:09:28 -0000 *************** *** 250,255 **** --- 250,257 ---- #define AST_DEVICE_INVALID 4 /*! Device is unavailable */ #define AST_DEVICE_UNAVAILABLE 5 + /*! Device is ringing */ + #define AST_DEVICE_RINGING 6 //! Requests a channel /*! Index: include/asterisk/pbx.h =================================================================== RCS file: /usr/cvsroot/asterisk/include/asterisk/pbx.h,v retrieving revision 1.3 diff -c -r1.3 pbx.h *** include/asterisk/pbx.h 6 Apr 2003 18:19:51 -0000 1.3 --- include/asterisk/pbx.h 10 Apr 2003 03:09:28 -0000 *************** *** 41,46 **** --- 41,48 ---- #define AST_EXTENSION_BUSY 2 //! All devices UNAVAILABLE/UNREGISTERED #define AST_EXTENSION_UNAVAILABLE 3 + //! One or more devices RINGING + #define AST_EXTENSION_RINGING 4 struct ast_context; struct ast_exten;