[Home]

Summary:ASTERISK-10226: new function EXTSTATE() returns state of an extension
Reporter:Adam Gundy (adamgundy)Labels:
Date Opened:2007-09-03 19:37:32Date Closed:2007-09-08 09:14:35
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Functions/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) func_extstate.c
Description:the attached patch is based on the DEVSTATE() function, modified to return the state of an extension, rather than a device. this means you can write dialplan logic based on the state of an extension (in use, ringing, on hold etc). the extension just needs to have a hint so we can determine which devices to check.

any chance we can get this in 1.6 to go with DEVSTATE()?
Comments:By: Tilghman Lesher (tilghman) 2007-09-04 06:50:45

I'd prefer to see you implement this as component pieces, i.e. implement a HINT lookup of ${HINT(context,extension)} and then use that in DEVSTATE, i.e.
${DEVSTATE(${HINT(context,extension)})}.  This allows for more versatile uses of the device string in the hint.

By: Adam Gundy (adamgundy) 2007-09-05 10:04:32

I had thought of that, but I didn't really like the idea of propagating the concept of 'hints' around the dialplan, with EXTSTATE() you are solely asking for the state of an extension, currently that uses hints, but it could use some other mechanism too... DEVSTATE() is already a bit weird because you suddenly have to start dealing with devices, not extensions.

if there's really no way this is going to be accepted then I guess I can write a HINT() function, but I think it's a bad idea, or at least not the correct way to do this (HINT() is probably a useful function for other stuff of course).

By: Russell Bryant (russell) 2007-09-05 22:59:04

I actually like both.  :)  I propose we add this, and also add a HINT() function, as I can see how both would be useful.  I don't mind coding it if you guys agree.

By: Tilghman Lesher (tilghman) 2007-09-06 00:10:41

While I'm not adamantly opposed to EXTSTATE(), I want to point out that its implementation in the dialplan conflicts with the design philosophy behind much of how the dialplan language was created.  That is, the pieces in the dialplan should always reflect the most basic building blocks of proposed needs, without crippling possible functionality.

We certainly could create many possible combinations using the basic building blocks that we have created, but those prebuilt combinations would only serve to clutter the dialplan and confuse new users as to which tools they should use in constructing their dialplans.  I would invite a comparison to the CISC versus RISC processors, whereby it was found that a reduced set of instructions reduced clutter, simplified tasks, and made for an all-around better processor.  The design philosphy seeks a similar end for the dialplan language.

There are some notable exceptions to this philosophy in the dialplan, such as Voicemail, but Voicemail is a legacy application which will get broken down, both with the existing minivm implementation, as well as the forthcoming ast_storage branch.  Directory is not quite as complicated as Voicemail, but it, too, is being considered for replacement with smaller, more fundamental building blocks.

So, as I pointed out earlier, the fundamental building blocks as I see them are first, a HINT lookup, which finds the device hint for a particular extension, and DEVSTATE, which determines a status for that found device.  That is why I suggested the creation of the HINT() dialplan function.  I hope this explanation makes it clearer as to why I gave you this suggestion.

By: Russell Bryant (russell) 2007-09-06 08:33:05

Yes, that makes it more clear.  Thank you.

However, I have another problem that is worth mentioning for this discussion in regards to using HINT() + DEVSTATE().

The hint handling code in pbx.c allows you to specify multiple devices for a hint.

exten => s,hint,SIP/123&SIP/456&SIP/789

To determine the state of the extension, the code retrieves the device state for all devices, and performs some logic to decide on a single state of the extension based on all of these states.

DEVSTATE() only provides the first part of that.  It takes a single device and provides the device state.

So, DEVSTATE(HINT()) will be broken if the hint is mapped to multiple devices.  You would have to instead loop over each device in HINT() to get its DEVSTATE(), and then determine the aggregate extension state yourself.

I think this is sufficiently complicated that it may justify also having EXTSTATE(), which just lets you get the final extension state that the core has already calculated.

By: Digium Subversion (svnbot) 2007-09-06 09:09:22

Repository: asterisk
Revision: 81652

------------------------------------------------------------------------
r81652 | russell | 2007-09-06 09:09:22 -0500 (Thu, 06 Sep 2007) | 2 lines

Add HINT() dialplan function, inspired by issue ASTERISK-10226

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

By: Russell Bryant (russell) 2007-09-06 09:09:45

Note that I just added HINT() to my sandbox branch, not trunk.

By: Tilghman Lesher (tilghman) 2007-09-06 10:34:28

Okay, then I would recommend a name change, to call it "EXTENSION_STATE", again for design reasons.

By: Digium Subversion (svnbot) 2007-09-06 15:05:51

Repository: asterisk
Revision: 81783

------------------------------------------------------------------------
r81783 | russell | 2007-09-06 15:05:51 -0500 (Thu, 06 Sep 2007) | 4 lines

Merge HINT() dialplan function from my sandbox branch into trunk.  This function
will let you retrieve the list of devices or name associated with a hint.
(inspired by issue ASTERISK-10226)

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

By: Digium Subversion (svnbot) 2007-09-06 15:08:59

Repository: asterisk
Revision: 81784

------------------------------------------------------------------------
r81784 | russell | 2007-09-06 15:08:58 -0500 (Thu, 06 Sep 2007) | 4 lines

Rename the DEVSTATE() function to DEVICE_STATE() to better conform to how other
functions are named.
(inspired by issue ASTERISK-10226)

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

By: Digium Subversion (svnbot) 2007-09-06 15:37:17

Repository: asterisk
Revision: 81813

------------------------------------------------------------------------
r81813 | russell | 2007-09-06 15:37:16 -0500 (Thu, 06 Sep 2007) | 5 lines

Add EXTENSION_STATE() function that can retrieve the state of an extension that
has a hint.

(closes issue ASTERISK-10226, adamgundy)

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

By: Digium Subversion (svnbot) 2007-09-08 09:14:35

Repository: asterisk
Revision: 81970

------------------------------------------------------------------------
r81970 | murf | 2007-09-08 09:14:33 -0500 (Sat, 08 Sep 2007) | 260 lines

Merged revisions 81683,81712,81730,81742,81744-81745,81777,81779,81781-81785,81813-81814,81827,81839,81849,81858,81873,81891,81910,81924,81953 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r81683 | mmichelson | 2007-09-06 09:21:45 -0600 (Thu, 06 Sep 2007) | 13 lines

Merged revisions 81682 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81682 | mmichelson | 2007-09-06 10:20:36 -0500 (Thu, 06 Sep 2007) | 5 lines

Fixes a memory leak

(closes issue ASTERISK-10247, reported and patched by Ivan)


........

................
r81712 | rizzo | 2007-09-06 09:43:49 -0600 (Thu, 06 Sep 2007) | 8 lines

various changes to the documentation, and redefinition of
ao2_hash_fn and ao2_callback_fn typedefs, in preparation
to more cleanup of the _search_flags

Please do not merge this change to 1.4 yet - there are no
functional changes anyways.


................
r81730 | mmichelson | 2007-09-06 10:31:30 -0600 (Thu, 06 Sep 2007) | 14 lines

Merged revisions 81713 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81713 | mmichelson | 2007-09-06 11:25:40 -0500 (Thu, 06 Sep 2007) | 6 lines

Fixes an issue where valid DTMF had to be pressed twice to exit a queue if a member's phone
was ringing.

(closes issue ASTERISK-10245, reported by strider2k, patched by me)


........

................
r81742 | mattf | 2007-09-06 10:38:54 -0600 (Thu, 06 Sep 2007) | 1 line

Patch on 10575.  Add support for unequipped CIC (UCIC) message as well as improve some of our CIC flags in chan_zap
................
r81744 | tilghman | 2007-09-06 10:57:20 -0600 (Thu, 06 Sep 2007) | 2 lines

Incorporate the ability to log output of safe_asterisk to syslog (closes issue ASTERISK-9588)

................
r81745 | phsultan | 2007-09-06 11:00:58 -0600 (Thu, 06 Sep 2007) | 9 lines

Merged revisions 81743 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81743 | phsultan | 2007-09-06 18:56:29 +0200 (Thu, 06 Sep 2007) | 1 line

Various string length fixes. Removed an unused variable in aji_client structure (context)
........

................
r81777 | file | 2007-09-06 13:43:20 -0600 (Thu, 06 Sep 2007) | 15 lines

Merged revisions 81776 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81776 | file | 2007-09-06 16:40:37 -0300 (Thu, 06 Sep 2007) | 7 lines

(closes issue ASTERISK-9809)
Reported by: stevefeinstein
Patches:
     meetme-unmute-manager.diff uploaded by qwell (license 4)
Tested by: stevefeinstein
After looking over the code I agree with Qwell. Setting the file descriptor to conference each time just causes a fight back and forth.

........

................
r81779 | qwell | 2007-09-06 14:00:08 -0600 (Thu, 06 Sep 2007) | 10 lines

Merged revisions 81778 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81778 | qwell | 2007-09-06 14:59:07 -0500 (Thu, 06 Sep 2007) | 2 lines

This should fix a build issue that people building against uClibc were seeing with the addition of astobj2

........

................
r81781 | russell | 2007-09-06 14:05:50 -0600 (Thu, 06 Sep 2007) | 2 lines

Fix the syntax of declaring a hint with a name to be compatible with trunk

................
r81782 | file | 2007-09-06 14:16:02 -0600 (Thu, 06 Sep 2007) | 6 lines

(closes issue ASTERISK-10019)
Reported by: mvanbaak
Patches:
     chan_skinny_info.diff uploaded by mvanbaak (license 7)
Add skinny show device, skinny show line, and skinny show settings CLI commands.

................
r81783 | russell | 2007-09-06 14:24:18 -0600 (Thu, 06 Sep 2007) | 4 lines

Merge HINT() dialplan function from my sandbox branch into trunk.  This function
will let you retrieve the list of devices or name associated with a hint.
(inspired by issue ASTERISK-10226)

................
r81784 | russell | 2007-09-06 14:27:26 -0600 (Thu, 06 Sep 2007) | 4 lines

Rename the DEVSTATE() function to DEVICE_STATE() to better conform to how other
functions are named.
(inspired by issue ASTERISK-10226)

................
r81785 | russell | 2007-09-06 14:27:53 -0600 (Thu, 06 Sep 2007) | 2 lines

s/DEVSTATE/DEVICE_STATE/

................
r81813 | russell | 2007-09-06 14:54:07 -0600 (Thu, 06 Sep 2007) | 5 lines

Add EXTENSION_STATE() function that can retrieve the state of an extension that
has a hint.

(closes issue ASTERISK-10226, adamgundy)

................
r81814 | file | 2007-09-06 15:01:10 -0600 (Thu, 06 Sep 2007) | 2 lines

Initialize iax_frames variable to NULL, keeps valgrind happy.

................
r81827 | qwell | 2007-09-06 16:06:17 -0600 (Thu, 06 Sep 2007) | 9 lines

Merged revisions 81826 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81826 | qwell | 2007-09-06 17:05:02 -0500 (Thu, 06 Sep 2007) | 1 line

We added COPTS for ASTCFLAGS additions, but not LDOPTS for ASTLDFLAGS.  This adds LDOPTS
........

................
r81839 | russell | 2007-09-06 16:30:15 -0600 (Thu, 06 Sep 2007) | 24 lines

Merged revisions 81832 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81832 | russell | 2007-09-06 17:28:57 -0500 (Thu, 06 Sep 2007) | 16 lines

(closes issue ASTERISK-9438, closes issue ASTERISK-10017)
Reported by: kenw
Patches:
     9724.txt uploaded by russell (license 2)
Tested by: kenw, russell

Resolve a deadlock that occurs when doing a SIP transfer to parking.  

I come across this type of deadlock fairly often it seems.  It is very important
to mind the boundary between the channel driver and the core in respect to the
channel lock and the channel-pvt lock.  Channel drivers lock to lock the
pvt and then the channel once it calls into the core, while the core will do
it in the opposite order.  The way this is avoided is by having channel drivers
either release their pvt lock while calling into the core, or such as in this
case, unlocking the pvt just long enough to acquire the channel lock.

........

................
r81849 | russell | 2007-09-06 16:32:03 -0600 (Thu, 06 Sep 2007) | 1 line

fix the build ... oops
................
r81858 | file | 2007-09-06 16:34:44 -0600 (Thu, 06 Sep 2007) | 2 lines

Fix memory issue that crept up with Russell's testing. It is *not* proper to free the frame we get in ast_write.

................
r81873 | file | 2007-09-07 06:32:04 -0600 (Fri, 07 Sep 2007) | 2 lines

Don't check for epoll support when cross compiling.

................
r81891 | mmichelson | 2007-09-07 09:29:23 -0600 (Fri, 07 Sep 2007) | 11 lines

Merged revisions 81886 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81886 | mmichelson | 2007-09-07 10:25:19 -0500 (Fri, 07 Sep 2007) | 3 lines

Moving the explanation for joinempty to a more appropriate place


........

................
r81910 | qwell | 2007-09-07 10:13:57 -0600 (Fri, 07 Sep 2007) | 4 lines

Add an optional reason parameter to PauseQueueMember/UnpauseQueueMember applications and manager events.

Issue 8738, patch by rgollent

................
r81924 | qwell | 2007-09-07 13:53:30 -0600 (Fri, 07 Sep 2007) | 14 lines

Merged revisions 81923 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

(closes issue ASTERISK-10255)
........
r81923 | qwell | 2007-09-07 14:48:00 -0500 (Fri, 07 Sep 2007) | 5 lines

Allow the MEMBERINTERFACE variable to be used as the mixmonitor filename.
This moves the setting of the MEMBERINTERFACE variable to before mixmonitor.

Issue 10671, patch by sim.

........

................
r81953 | russell | 2007-09-08 07:45:40 -0600 (Sat, 08 Sep 2007) | 19 lines

Merged revisions 81952 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r81952 | russell | 2007-09-08 08:42:26 -0500 (Sat, 08 Sep 2007) | 11 lines

(closes issue ASTERISK-10256)
Bump the cleancount so that a "make clean" will be forced.  This is needed
because my fix in revision 81599 made a change to a data structure in file.h,
and since file dependency tracking is only on with dev-mode enabled, file
format modules that don't get rebuilt may crash, as is the case with this issue.

This makes me wonder - how much faster does the code build without the file
dependency tracking enabled?  If it doesn't make much of a difference, then it
may be worth just keeping it on all of the time, or perhaps just not in release
tarballs, so that this type of issue is avoided.

........

................

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