Hi all,<div><br></div><div>i have done the following quick patch to libpri...</div><div><br></div><div><br></div><div><div>root@wolfgang-desktop:/usr/local/src/asterisk-1.8/libpri# diff q931.c ../../libpri/q931.c</div><div>
36a37</div><div>&gt; #include &lt;time.h&gt;</div><div>2825a2827,2844</div><div>&gt; static int receive_time_date(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len)</div><div>&gt; {</div><div>
&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>return 0;</div><div>&gt; }</div><div>&gt; </div><div>&gt; static int transmit_time_date(int full_ie, struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, int len, int order) {</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>time_t now;</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>struct tm *timedate;</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>time(&amp;now);</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>timedate = localtime(&amp;now);</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>ie-&gt;data[0] = timedate-&gt;tm_year - 100; // 1900+</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>ie-&gt;data[1] = timedate-&gt;tm_mon + 1;</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>ie-&gt;data[2] = timedate-&gt;tm_mday;</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>ie-&gt;data[3] = timedate-&gt;tm_hour;</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>ie-&gt;data[4] = timedate-&gt;tm_min;</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>return 7;</div><div>&gt; }</div><div>&gt; </div><div>3474c3493</div><div>&lt; <span class="Apple-tab-span" style="white-space:pre">        </span>{ 1, Q931_IE_TIME_DATE, &quot;Date/Time&quot;, dump_time_date },</div>
<div>---</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>{ 1, Q931_IE_TIME_DATE, &quot;Date/Time&quot;, dump_time_date, receive_time_date, transmit_time_date },</div><div>4955a4975,4985</div><div>
&gt; static int connect_NET_ies[] = {</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>Q931_CHANNEL_IDENT,</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>Q931_IE_FACILITY,</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>Q931_PROGRESS_INDICATOR,</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>Q931_DISPLAY,</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>Q931_IE_CONNECTED_NUM,</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>Q931_IE_CONNECTED_SUBADDR,</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>Q931_IE_TIME_DATE,</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>-1</div>
<div>&gt; };</div><div>&gt; </div><div>5009c5039,5045</div><div>&lt; <span class="Apple-tab-span" style="white-space:pre">        </span>return send_message(ctrl, c, Q931_CONNECT, connect_ies);</div><div>---</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>int network = ctrl-&gt;localtype == PRI_NETWORK;</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>if (network) {</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>    /* networks may send datetime */</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>    return send_message(ctrl, c, Q931_CONNECT, connect_NET_ies);</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>} else {</div><div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>    return send_message(ctrl, c, Q931_CONNECT, connect_ies);</div>
<div>&gt; <span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div><br></div><div>Does compile fine - but i was not able to try it out until yet....</div><div><br></div><div>Maybe someone takes a look on it - to acknowledge if it could work as i&#39;d like it to work.</div>
<div><br></div><div><br></div><div>What i have done - i have ported the bristuff datetime handling to the current libpri svn</div><div><br></div><div>On the receive side - the IE does get ignored.</div><div><br></div><div>
On CONNECT messages - when pri localtype == NETWORK it will include the DATETIME IE in the CONNECT message with the current time.</div><div><br></div><div>I think it should work as i expect it to work.</div><div><br></div>
<div>Can anyone see a possible problem within the code ?</div><div><br></div><div>I will open a bug report for it</div><div><br></div><div>best regards,</div><div>Wolfgang</div><div><br></div><br><div class="gmail_quote">
2010/9/24 Wolfgang Pichler <span dir="ltr">&lt;<a href="mailto:wpichler@yosd.at">wpichler@yosd.at</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi all,<div>
<br></div><div>i have a box in the middle setup - where asterisk is accting as a gateway. Box is using asterisk 1.8 - and latest libpri. Protocol is q.931</div><div><br></div><div>I now got a complaint that the time on the isdn phones is going to be wrong - so i have taken a look into the q.931 protocol - and found out that there is the Q931_IE_TIME_DATE element which does carry out the current time from the network to the user.</div>

<div><br></div><div>I have taken a look into q931.c - and as far as i can see - it does only dump the received IE.</div><div><br></div><div>I have searched <a href="http://bugs.digium.com" target="_blank">bugs.digium.com</a> - but can&#39;t find anything related to this.</div>

<div><br></div><div>I have seen that the bristuff patches have implemented something related to this.</div><div><br></div><div>Does anyone know if there are current patches out there for the current libpri to be able to forward such IE&#39;s when received - or to instruct asterisk to generate such an IE for a call ?</div>

<div><br></div><div>I will look at the bristuff code - maybe this functions can get ported to the current libpri...</div><div><br></div><div>best regards,</div><div>Wolfgang</div><font color="#888888"><div><br></div>
</font></blockquote></div><br></div>