[prev in list] [next in list] [prev in thread] [next in thread] 

List:       asterisk-dev
Subject:    Re: [Asterisk-Dev] Snom Programmable button Mini Howto and ring
From:       "Andre Bierwirth" <asterisk () kmb ! de>
Date:       2004-08-31 22:24:57
Message-ID: 00d601c48fa9$5aa00ce0$2b69a8c0 () bierwirth ! local
[Download RAW message or body]

The Ringstate patch is very old(2003), i have written the Subscribe
Subsystem and the hints for Asterisk, Mark has applied the Source to CVS,
but three days later, i send the Ringstate Patch to Mark. I didn't know why
the Ringstate Patch was never be applied to CVS?? Digium has a disclaimer
for the Source !!

Regards
  Andre

My old Mail to Mark
----SNIP----
If One or more Devices from a extension in Ringing state, the extension is
handeled as Ringing. The "Ringing" state has
priority before the "inuse" state. So a extension that is "inuse" and gets a
second call the new state is "ringing" for the time between the call is
taken or gone.
----SNIP----



----- Original Message ----- 
From: "David Hinkle" <hinkle@derbyworks.com>
To: <asterisk-dev@lists.digium.com>; "Morten Kuehl" <mck@mck.li>;
<asterisk-users@lists.digium.com>
Sent: Monday, August 30, 2004 8:23 PM
Subject: [Asterisk-Dev] Snom Programmable button Mini Howto and ring
statepatch


> The snom 200 and 220 have five programmable buttons.  Each button has a
> led that can be used to indecate if an extension is idle, in use, or
> ringing.  A button pannel for the 220 is also comming out soon that will
> have 20'ish programmable buttons on board.
>
> This is a killer app for any company that has receptionists handle
> calls, and pretty usefull for everyone else.
>
> As a matter of fact, Asterisk already supports phone idle/in use states
> for the buttons, and at the bottom of this message you will find a patch
> to enable the ring state.
>
> Howto:
>
> 1. Configure the programable buttons as "destination" and enter the
> extension in the field.  After saving the page the phone will convert
> the extension to a sip url, which is fine.
>
> 2. Modify your asterisk dialplan to provide "hints" that map a given
> extension to a channel.  (In asterisk, a channel can be busy or ringing,
> but an extension is just a string of numbers that activate one or more
> applications).  Asterisk seems to provide syntax for allowing more than
> one channel to be mapped to any particular extension with the hint
> system, but I did not investigate that.
>
> Example:
>
> exten => 200,hint,SIP/RonC
> exten => 200,1,Macro(stdexten,SIP/RonC)
>
exten => 201,hint,SIP/JeanK
> exten => 201,1,Macro(stdexten,SIP/JeanK)
>
exten => 202,hint,SIP/JeffT
> exten => 202,1,Macro(stdexten,SIP/JeffT)
>
> 3.  You must reload the dialplan and then reboot the phone for it's
> subscriptions to take effect.  After that, you should have working
> lights.
>
> 4.  If you want the lights to blink on ringing, apply the following
> patch to the asterisk code.
>
> You can not pick up a call by hitting the blinking button,  I was going
> to do this work but I decided to just train the receptionists to hit *8
> instead.   I have not studied this extensivly, but to implement it, i
> think it would just require asterisk to have support for sip "replaces"
> (I don't know if asterisk supports this or not) and the ringing notify
> needs to go out with a few more fields.  (It seems that the snom phone
> contacts the sip device listed in one of the ring notify message fields
> with an invite including a "replaces" header to pick up a call)
>
> I have also included a sip trace of a snom phone picking up a call
> placed to another phone using the blinking button in case anybody out
> there wants to tackle this problem themselves (Sample trace was
> collected when using snom phones with snom's sip proxy software).
> Please note that it seems like we must include the extra fields in the
> ring notify before the snom phone will procude the proper "replaces"
> invite in order to do a standards compliant call pickup.
>
> Notes on patch:
> If this patch is not in the proper format for submissions please provide
> me a link to the asterisk submission policies.  It has been tested here
> at DerbyTech for about a week on our live phone system.
>
> I submit this patch to the asterisk project under the GPL with hope that
> it will be resubmited to CVS.
>
> Thankyou,
> David Hinkle
> Sr. Linux Engineer
> DerbyTech
>
>
>
>


----------------------------------------------------------------------------
----


> _______________________________________________
> Asterisk-Dev mailing list
> Asterisk-Dev@lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-dev
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev

["asterisk-ringingstate.patch" (application/octet-stream)]

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, "<dialog id=\"%s\">\n", p->exten);
  	    t = tmp + strlen(tmp);
! 	    sprintf(t, "<state>%s</state>\n", state ? "confirmed" : "terminated");
  	    t = tmp + strlen(tmp);
  	    sprintf(t, "</dialog>\n</dialog-info>\n");	
  	}
--- 2406,2412 ----
  	    t = tmp + strlen(tmp);
  	    sprintf(t, "<dialog id=\"%s\">\n", p->exten);
  	    t = tmp + strlen(tmp);
! 	    sprintf(t, "<state>%s</state>\n", state==AST_EXTENSION_RINGING ? "early" : \
state ? "confirmed" : "terminated");  t = tmp + strlen(tmp);
  	    sprintf(t, "</dialog>\n</dialog-info>\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;     



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic