<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2048/">https://reviewboard.asterisk.org/r/2048/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, Mark Michelson and Matt Jordan.</div>
<div>By Guenther Kelleter.</div>
<p style="color: grey;"><i>Updated July 24, 2012, 9:25 a.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I've rewritten the patch to only do the extra work of determining oldest channels for the hint devices if they are going to be used by an extended callback.
The extended callbacks now get called when the state changed or when the state includes AST_EXTENSION_RINGING.
The decision what to do with a duplicated state change callback and to determine the oldest of the ringing channels is left to the watcher. This is because chan_sip as a watcher sends notifications itself even if not called back, so pbx.c handle_statechange cannot know what the watchers consider as the last ringing channel notified to decide if there is a change and the watchers must be informed (I missed this fact completely in the first approach).
SIP does not send a notification of the current state for resubscriptions anymore because that would be a duplicated one.
Additional changes according to review comments.
The diff is against current trunk revision, not the same base as diff version 1,
and it requires diff version 2 of review https://reviewboard.asterisk.org/r/2043/.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">(For Digium: this is the implementation of the feature described in chapter 2 of the document SIP_NOTIFY_dialog_event_infos_DATUS_v1_4.odt)
This patch extends the extension state callbacks so that monitoring channels (as chan_sip) get more information of the devices which are responsible for an extension state change. The additional information is needed by chan_sip to present names/numbers of the caller and callee in an early-state SIP notification. Users of extenstion state callback not interested in the additional information are not affected by the changes.
Motivation: to present the involved party's name/number in an early-state nofification (used by the notified device as a pickup offer) one after another so that a user can see which call he will pick up in an undirected pickup.
Such a pickup offer to a user shall indicate the same call (number/name-A calls number/name-B) as the call which would be picked up when an undirected pickup is executed.
Users interested in additional state info must use the new functions ast_extension_state_add_extended() resp. ast_extension_state_add_destroy_extended() to register an extended state callback. When the callback is registered this way, an extra member device_state_info of struct ast_state_cb_info is passed to the callback in addition to the aggregated extension state. This container holds an object for every device of the monitored extension hint consisting of the device name, the device state and a channel reference to the channel which (presumably) caused the device state.
The information is used by chan_sip for early-state notifications. When the state of a device changes and the new state contains AST_EVENT_RINGING, an early-state notification is sent to the subscribed devices with the caller/callee names/numbers of the oldest ringing channel of the monitored extension.
The notified user may then invoke a direct pickup, which will pickup exactly this channel.
Users of the old non-extended callbacks will only be called when the aggregated state did change (same behavior as before). Users of the extended callback will also be called when the state is unchanged but does contain AST_EVENT_RINGING. That could be the case if two channels are ringing at one device and one of them hangs up, so the aggregated state does not change. This way the monitoring channel can create a new early-state notification with the now ringing party-ids.
This patch requires the channel creation time member of ast_channel and the changes for the direct pickup to pick up the oldest ringing channel, which are both introduced in review https://reviewboard.asterisk.org/r/2043/.
</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing (updated)</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Checked the name/number of caller/callee displayed on the notified phone.
Checked that a second call at an already ringing device does not invoke a notification as long as the first call is ringing, instead it is sent when the first ringing channel is picked up by some other party or hung up.
Checked that the picked up caller is the same as advertized in the early-state notification when more than one calls are ringing on the subscribed extension.
Ref counting for the containers and channels checked.
Checked that a notification is sent to newly subscribed watchers.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/channels/chan_sip.c <span style="color: grey">(370418)</span></li>
<li>/trunk/channels/sip/include/sip.h <span style="color: grey">(370418)</span></li>
<li>/trunk/include/asterisk/pbx.h <span style="color: grey">(370418)</span></li>
<li>/trunk/main/pbx.c <span style="color: grey">(370418)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2048/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>