<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16342">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">chan_iax2: Add ANI2/OLI information element<br><br>Adds an information element for ANI2 so that<br>Originating Line Information can be transmitted<br>over IAX2 channels.<br><br>ASTERISK-29605 #close<br><br>Change-Id: Iaeacdf6ccde18eaff7f776a0f49fee87dcb549d2<br>---<br>M channels/chan_iax2.c<br>M channels/iax2/include/iax2.h<br>M channels/iax2/include/parser.h<br>M channels/iax2/parser.c<br>A doc/CHANGES-staging/chan_iax2_ani2.txt<br>5 files changed, 22 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c</span><br><span>index c57434b..e16577e 100644</span><br><span>--- a/channels/chan_iax2.c</span><br><span>+++ b/channels/chan_iax2.c</span><br><span>@@ -865,6 +865,7 @@</span><br><span> int calling_ton;</span><br><span> int calling_tns;</span><br><span> int calling_pres;</span><br><span style="color: hsl(120, 100%, 40%);">+ int calling_ani2;</span><br><span> int amaflags;</span><br><span> AST_LIST_HEAD_NOLOCK(, iax2_dpcache) dpentries;</span><br><span> /*! variables inherited from the user definition */</span><br><span>@@ -5181,6 +5182,7 @@</span><br><span> </span><br><span> iax_ie_append_byte(&ied, IAX_IE_CALLINGTON, ast_channel_connected(c)->id.number.plan);</span><br><span> iax_ie_append_short(&ied, IAX_IE_CALLINGTNS, ast_channel_dialed(c)->transit_network_select);</span><br><span style="color: hsl(120, 100%, 40%);">+ iax_ie_append_int(&ied, IAX_IE_CALLINGANI2, ast_channel_connected(c)->ani2);</span><br><span> </span><br><span> if (n)</span><br><span> iax_ie_append_str(&ied, IAX_IE_CALLING_NAME, n);</span><br><span>@@ -5941,6 +5943,7 @@</span><br><span> ast_channel_redirecting(tmp)->from.number.valid = 1;</span><br><span> ast_channel_redirecting(tmp)->from.number.str = ast_strdup(i->rdnis);</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_caller(tmp)->ani2 = i->calling_ani2;</span><br><span> ast_channel_caller(tmp)->id.name.presentation = i->calling_pres;</span><br><span> ast_channel_caller(tmp)->id.number.presentation = i->calling_pres;</span><br><span> ast_channel_caller(tmp)->id.number.plan = i->calling_ton;</span><br><span>@@ -7831,6 +7834,8 @@</span><br><span> iaxs[callno]->calling_tns = ies->calling_tns;</span><br><span> if (ies->calling_pres > -1)</span><br><span> iaxs[callno]->calling_pres = ies->calling_pres;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ies->calling_ani2 > -1)</span><br><span style="color: hsl(120, 100%, 40%);">+ iaxs[callno]->calling_ani2 = ies->calling_ani2;</span><br><span> if (ies->format)</span><br><span> iaxs[callno]->peerformat = ies->format;</span><br><span> if (ies->adsicpe)</span><br><span>diff --git a/channels/iax2/include/iax2.h b/channels/iax2/include/iax2.h</span><br><span>index 3deb5db..a661858 100644</span><br><span>--- a/channels/iax2/include/iax2.h</span><br><span>+++ b/channels/iax2/include/iax2.h</span><br><span>@@ -187,6 +187,8 @@</span><br><span> #define IAX_IE_CAPABILITY2 55 /*!< Actual codec capability - u8 version + integer array */</span><br><span> #define IAX_IE_FORMAT2 56 /*!< Desired codec format - u8 version + integer array */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define IAX_IE_CALLINGANI2 57 /*!< Calling Originating Line Information (ANI2) digits */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #define IAX_MAX_OSPBLOCK_SIZE 254 /*!< Max OSP token block size, 255 bytes - 1 byte OSP token block index */</span><br><span> #define IAX_MAX_OSPBLOCK_NUM 4</span><br><span> #define IAX_MAX_OSPTOKEN_SIZE (IAX_MAX_OSPBLOCK_SIZE * IAX_MAX_OSPBLOCK_NUM)</span><br><span>diff --git a/channels/iax2/include/parser.h b/channels/iax2/include/parser.h</span><br><span>index d8edc4b..cd64f35 100644</span><br><span>--- a/channels/iax2/include/parser.h</span><br><span>+++ b/channels/iax2/include/parser.h</span><br><span>@@ -32,6 +32,7 @@</span><br><span> int calling_ton;</span><br><span> int calling_tns;</span><br><span> int calling_pres;</span><br><span style="color: hsl(120, 100%, 40%);">+ int calling_ani2;</span><br><span> char *called_context;</span><br><span> char *username;</span><br><span> char *password;</span><br><span>diff --git a/channels/iax2/parser.c b/channels/iax2/parser.c</span><br><span>index 8683938..8a36f17 100644</span><br><span>--- a/channels/iax2/parser.c</span><br><span>+++ b/channels/iax2/parser.c</span><br><span>@@ -313,6 +313,7 @@</span><br><span> { IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte },</span><br><span> { IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte },</span><br><span> { IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short },</span><br><span style="color: hsl(120, 100%, 40%);">+ { IAX_IE_CALLINGANI2, "CALLING ANI2", dump_int },</span><br><span> { IAX_IE_SAMPLINGRATE, "SAMPLINGRATE", dump_samprate },</span><br><span> { IAX_IE_CAUSECODE, "CAUSE CODE", dump_byte },</span><br><span> { IAX_IE_ENCRYPTION, "ENCRYPTION", dump_short },</span><br><span>@@ -805,6 +806,7 @@</span><br><span> ies->calling_ton = -1;</span><br><span> ies->calling_tns = -1;</span><br><span> ies->calling_pres = -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ ies->calling_ani2 = -1;</span><br><span> ies->samprate = IAX_RATE_8KHZ;</span><br><span> while(datalen >= 2) {</span><br><span> ie = data[0];</span><br><span>@@ -1057,6 +1059,14 @@</span><br><span> errorf(tmp);</span><br><span> }</span><br><span> break;</span><br><span style="color: hsl(120, 100%, 40%);">+ case IAX_IE_CALLINGANI2:</span><br><span style="color: hsl(120, 100%, 40%);">+ if (len == (int)sizeof(unsigned int)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ies->calling_ani2 = ntohl(get_unaligned_uint32(data + 2));</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ snprintf(tmp, (int)sizeof(tmp), "callingani2 was %d long: %s\n", len, data + 2);</span><br><span style="color: hsl(120, 100%, 40%);">+ errorf(tmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ break;</span><br><span> case IAX_IE_CALLINGTNS:</span><br><span> if (len != (int)sizeof(unsigned short)) {</span><br><span> snprintf(tmp, (int)sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);</span><br><span>diff --git a/doc/CHANGES-staging/chan_iax2_ani2.txt b/doc/CHANGES-staging/chan_iax2_ani2.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..37c6fa6</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/chan_iax2_ani2.txt</span><br><span>@@ -0,0 +1,4 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: chan_iax2</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ANI2 (OLI) is now transmitted over IAX2 calls</span><br><span style="color: hsl(120, 100%, 40%);">+as an information element.</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16342">change 16342</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/16342"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Iaeacdf6ccde18eaff7f776a0f49fee87dcb549d2 </div>
<div style="display:none"> Gerrit-Change-Number: 16342 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>