<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/1189/">https://reviewboard.asterisk.org/r/1189/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/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 and Russell Bryant.</div>
<div>By Terry Wilson.</div>
<p style="color: grey;"><i>Updated 2011-04-21 11:17:06.598771</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;">Add doc changes.</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;">This patch adds the ability to store/retrieve custom data (in the case of SIP, custom headers) on an ast_msg.
Currently the channel implementation is done only for SIP as I'm not sure it makes sense on XMPP messages or not. If it does, it should be very easy to add.
The ast_msg implementation is through an ao2_container of key/value pairs that also have a flag for whether or not the data should be sent on outbound messages. This flag is needed because MESSAGE()/MessageSend() on an inbound message carries the data over from the original message. Since we can not upon receiving a message determine which headers are custom and which are not, we must append all of them to the ast_msg. Then, from the dialplan we specify which headers we want to add, delete, or pass through to the outbound message.
To read a header:
exten => s,1,NoOp(${MESSAGE_DATA(headername)})
To add a header:
exten => s,1,Set(MESSAGE_DATA(headername)=Whatever)
To clear a custom header:
exten => s,1,Set(MESSAGE_DATA(headername)=)
To copy a header:
exten => s,1,Set(MESSAGE_DATA(newheadername)=${MESSAGE_DATA(headername)})
To pass a header through:
exten => s,1,Set(MESSAGE_DATA(headername)=${MESSAGE_DATA(headername)})
While the syntax for passing a header through looks a little oddly redundant, it is consistent. It would also be possible to create a dialplan app like MessageDataPassthrough(headername), but I'm not sure I really like that.
NOTE: I see the red. I've already fixed it on my end. :-p</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </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;">read, added, cleared, copied, and passed through SIP headers via sipp.</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>/team/russell/messaging/channels/chan_sip.c <span style="color: grey">(312991)</span></li>
<li>/team/russell/messaging/doc/asterisk-messaging.txt <span style="color: grey">(312991)</span></li>
<li>/team/russell/messaging/include/asterisk/message.h <span style="color: grey">(312991)</span></li>
<li>/team/russell/messaging/main/message.c <span style="color: grey">(312991)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1189/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>