<html>
<head>
    <base href="https://wiki.asterisk.org/wiki">
            <link rel="stylesheet" href="/wiki/s/2042/1/7/_/styles/combined.css?spaceKey=AST&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://wiki.asterisk.org/wiki/display/AST/Device+State+information+for+the+CCSS+generic+agent.">Device State information for the CCSS generic agent.</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://wiki.asterisk.org/wiki/display/~rmudgett@digium.com">Richard Mudgett</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <p>There are currently not many devices that have native support for CCSS.  Even as the devices become available there may be other reasons why one may choose to not take advantage of the native abilities and stick with the generic implementation.  The generic implementation is quite capable and could be greatly enhanced by adding device state capabilities.  A phone could then subscribe to the device state with a BLF key in conjunction with Asterisk hints.</p>

<p>The advantages of the device state information would allow a single button to: request CCSS, cancel a CCSS request, and display the current state of a CCSS request.</p>

<p>For example, you may have a single button that when not lit, there is no active CCSS request.  When you press that button, the dialplan can query the DEVICE_STATE() associated with that caller to determine whether they should be calling CallCompletionRequest() or CallCompletionCancel().  If there is currently a pending request, then the dialplan would cancel it.  This also has the advantage of showing the true state of a request, which is an asynchronous call, even when CallCompletionRequest() thinks it was successful.  The actual request could ultimately fail.  Once lit, further feedback can be provided to the caller about the current state of their request since it will be updated by the CCSS State Machine as appropriate.</p>

<p>The DEVICE_STATE mapping is configurable since the BLF being used on a given phone type may vary.  The idea is to allow some level of customization as to the phone's behavior.</p>

<p>As an example, you may want the BLF key to go solid once you have requested a callback.  You may then want the LED to blink (typically ringing) when either the callback is in process, which is a visual indication that the incoming call is the desired callback.  You may want it to blink when the callee is ready but you are busy, giving you a visual indication that the target is available as you may want to get off the line so that the callback can be successful.</p>

<p>Device state information is sent back via the ast_devstate_prov_add() callback for any generic CCSS device as it traverses through the state machine.  You simply provide a map between CC_STATE values and the corresponding AST_DEVICE state values.</p>

<p>You could then generate hints against these states similar to what is possible today with Custom Devstates or MeetMe states.  For example, you may have an extension 3000 that is currently associated with device SIP/3000.  You could then create a feature code for that extension that may look something like:</p>

<p>exten =&gt; *823000,hint,ccss:sip/3000</p>

<p>You would then subscribe a BLF button to *823000 which would point to the dialplan that handled CCSS requests/cancels using the available DEVICE_STATE() information about ccss:sip/3000 to make the decision about what to do.</p>
    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://wiki.asterisk.org/wiki/users/viewnotifications.action" class="grey">Change Notification Preferences</a>
       </div>
       <a href="https://wiki.asterisk.org/wiki/display/AST/Device+State+information+for+the+CCSS+generic+agent.">View Online</a>
              |
       <a href="https://wiki.asterisk.org/wiki/display/AST/Device+State+information+for+the+CCSS+generic+agent.?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>