text stringlengths 0 152 |
|---|
This information can then be used in the dialplan for call-flow decisions (for exam‐ |
ple, a local channel ringing an agent might use this information to determine that an |
agent phone is on a call on another line, and thus reject the call so it passes back into |
the queue). |
Extension States Using the hint Directive |
Extension state is a dialplan mechanism Asterisk uses to allow SIP devices to sub‐ |
scribe to presence information. As an example, a reception phone might have a Busy |
Lamp Field (BLF) module, containing buttons to be used to show the state of various |
phones in the office. The phone with the BLF will send subscription requests in order |
to tell Asterisk which devices it wants to receive presence information from. In the |
dialplan, we use the hint directive to define the mapping between an extension and |
one or more devices. |
Hints |
To define a hint in the dialplan, the keyword hint is used in place of a priority. |
[hints] |
;exten = <extension>,hint,<device state id>[& <more dev state id],<presence state id> |
exten => 100,hint,${UserA_DeskPhone} |
exten => 221,hint,ConfBridge:221 |
Often, you might see hints defined in the same section of the dialplan as the normal |
extension. This can get a bit visually cluttered, and it also suggests that the hint is |
somehow associated with the dialable extension, which is not the case. |
[sets] |
exten => 100,hint,${UserA_DeskPhone} |
exten => 100,1,Gosub(subDialUser,${EXTEN},1(${UserA_DeskPhone},${EXTEN},default,22)) |
exten => 101,hint,${UserA_SoftPhone} |
exten => 101,1,Gosub(subDialUser,${EXTEN},1(${UserA_SoftPhone},${EXTEN},default,23)) |
exten => 102,hint,${UserB_DeskPhone} |
exten => 102,1,Gosub(subDialUser,${EXTEN},1(${UserB_DeskPhone},${EXTEN},default,26)) |
exten => 103,hint,${UserB_SoftPhone} |
exten => 103,1,Gosub(subDialUser,${EXTEN},1(${UserB_SoftPhone},${EXTEN},default,24)) |
exten => 110,1,Dial(${UserA_DeskPhone}&${UserA_SoftPhone}&${UserB_SoftPhone}) |
Extension States Using the hint Directive |
| |
241 |
In our example we’ve made a direct correlation between the hint’s extension number |
and the extension number being dialed, although there is no requirement that this be |
the case. |
Checking Extension States |
The easiest way to check the current state of the hint extensions is through the Aster‐ |
isk CLI. The core show hints command will display all currently configured hints: |
*CLI> core show hints |
-= Registered Asterisk Dial Plan Hints =- |
100@hints : PJSIP/0000f30A0A01 State:Unavailable Presence:not_set Watchers 0 |
101@hints : PJSIP/SOFTPHONE_A State:Unavailable Presence:not_set Watchers 0 |
102@hints : PJSIP/0000f30B0B02 State:Unavailable Presence:not_set Watchers 0 |
103@hints : PJSIP/SOFTPHONE_B State:Unavailable Presence:not_set Watchers 0 |
110@hints : PJSIP/0000f30A0A01&P State:Unavailable Presence:not_set Watchers 0 |
221@hints : ConfBridge:221 State:Unavailable Presence:not_set Watchers 0 |
---------------- |
- 6 hints registered |
In addition to showing you the state of each hint, the output of core show hints also |
provides a count of watchers. A watcher is an entity that has subscribed to receive |
updates on the state of this extension. If a SIP endpoint subscribes to the state of an |
extension, the watcher count will be increased. |
Extension state can also be retrieved with a dialplan function, EXTENSION_STATE(). |
This function operates much like the DEVICE_STATE() function described in the pre‐ |
ceding section. Add the following example to your /etc/asterisk/extensions.conf file, as |
a new extension right after 235: |
exten => 234,1,NoOp() |
same => n,Set(FEATURE(parkingtime)=60) |
exten => 235,1,Noop(The state of 100@hints is ${EXTENSION_STATE(100@hints)} ) |
same => n,Hangup() |
exten => 321,1,NoOp() |
When this extension is called from the endpoint assigned to 100, this is the message |
that shows up on the Asterisk console: |
-- The state of 100@hints is INUSE |
The following list includes the possible values that may be returned from the EXTEN |
SION_STATE() function: |
• UNKNOWN |
• NOT_INUSE |
• INUSE |
• BUSY |
242 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.