Ticket #2273 (closed Patches: fixed)

Opened 3 years ago

Last modified 2 years ago

[patch] Custom device state for DayNight module and Asterisk 1.4

Reported by: francesco_r Assigned to:
Priority: minor Milestone: 2.5
Component: Other Module Version: 2.5-branch
Keywords: Cc:
Confirmation: Need Feedback SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

I have attached a patch for the DayNight? module. With this you can map the features code to a BLF of your phone and the light change status. You must have asterisk 1.4 and custom device state installed: http://www.asterisk.org/node/48325 http://www.asterisk.org/node/48360

To complete the works, should be suitable a function that control the asterisk version and if is func_devstate is available (like call-limit) but i have no practice with php.

Attachments

patch_daynight (1.2 kB) - added by francesco_r on 08/11/07 10:32:04.
Apply with patch -p0 < patch_daynight in module directory

Change History

08/11/07 10:32:04 changed by francesco_r

  • attachment patch_daynight added.

Apply with patch -p0 < patch_daynight in module directory

(follow-up: ↓ 2 ) 08/11/07 10:48:47 changed by p_lindheimer

  • confirmation changed from Unreviewed to Need Feedback.
  • version changed from 2.2.3 to 2.3-branch.
  • milestone changed from 3.0 to 2.3.

francesco_r

thanks. We'd like to do more of this type of thing. The problem comes in when you require custom patches to Asterisk. It is not hard to decide whether it is Asterisk 1.4 running. However, determining whether there are custom patches installed requires a bit more (although - it may be possible through the manager to check if a module is installed - hmm, that's an idea to look into). Similarly one would want to do the same sort of thing for DND and CF, CFB and CFU so that is you are using those server side features you can have blf to them...

why don't you see if you can query, through the manager, whether dev_funcstate is there? Start at the CLI, 'show functions' shows what you have. Next, show function devstate (or how ever it shows up on your listing). If that works, you can look into using the php manager astman handle that is available, check if the function is installed and if so, conditionally generate the extra code based on setting that variable. That would be great and with that - we could probably try and role these types of functions as standard so patches are not involded.

(in reply to: ↑ 1 ) 08/11/07 12:01:49 changed by francesco_r

Replying to p_lindheimer:

why don't you see if you can query, through the manager, whether dev_funcstate is there? Start at the CLI, 'show functions' shows what you have. Next, show function devstate (or how ever it shows up on your listing). If that works, you can look into using the php manager astman handle that is available, check if the function is installed and if so, conditionally generate the extra code based on setting that variable. That would be great and with that - we could probably try and role these types of functions as standard so patches are not involded.

This the output of function devstate:

pbx*CLI> show function DEVSTATE
pbx*CLI>
  -= Info about function 'DEVSTATE' =-

[Syntax]
DEVSTATE(device)

[Synopsis]
Get or Set a device state

[Description]
  The DEVSTATE function can be used to retrieve the device state from any
device state provider.  For example:
   NoOp(SIP/mypeer has state ${DEVSTATE(SIP/mypeer)})
   NoOp(Conference number 1234 has state ${DEVSTATE(MeetMe:1234)})

  The DEVSTATE function can also be used to set custom device state from
the dialplan.  The "Custom:" prefix must be used.  For example:
  Set(DEVSTATE(Custom:lamp1)=BUSY)
  Set(DEVSTATE(Custom:lamp2)=NOT_INUSE)
You can subscribe to the status of a custom device state using a hint in
the dialplan:
  exten => 1234,hint,Custom:lamp1

  The possible values for both uses of this function are:
UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING
RINGINUSE | ONHOLD

I'll look to other things when i'll return from holidays...

Related to freepbx, i think that a big step forward, is lightweight the dialplan converting dialparties.agi entirely in extensions.conf. With devstate you can know the state of an extension more simply that call a php function that open a manager connection and ask the state of it... I know that is a huge work, considering also the ring groups and the cf/dnd/cw etc. but in this manner the dial macro would be fully optimized.

P.S.: devstate is now part of asterisk trunk

08/11/07 16:18:03 changed by p_lindheimer

francesco_r - bring up your dialpaties.agi conversion suggestion to the dev forum for discussion. There are reasons why we will keep it an AGI script but the ticket system is not a place to have such a discussion.

11/13/07 13:18:39 changed by p_lindheimer

  • milestone changed from 2.3 to 3.0.

07/01/08 23:48:03 changed by p_lindheimer

  • status changed from new to closed.
  • version changed from 2.3-branch to 2.5-branch.
  • resolution set to fixed.

r5863 2.5.0