<div>Hi</div>
<div>&nbsp;</div>
<div>I'm working on a project, where I need the status of every telephone on the system. (Idle,ringing,busy)</div>
<div>If a phone is busy, I also need to know the callerid of the other end.</div>
<div>&nbsp;</div>
<div>I have made a deamon, which query Asterisk every second for active calls, this works by issuing a &quot;Status&quot; to the manager-interface, and processing the return data and then put the result into a MySQL&nbsp;table.
</div>
<div>&nbsp;</div>
<div>The clients will query the MySQL table every second for the state of their phone, if there are no records with their numbers in it, they are considered idle.</div>
<div>&nbsp;</div>
<div>This works fine for calls from one SIP-phone to the other, this is for instance what it look like when extension 310 is connected to extension 311:</div>
<div>&nbsp;</div>
<div>
<p>Event: Status<br>Privilege: Call<br>Channel: SIP/310-08697fb8<br>CallerID: 310<br>CallerIDName: &lt;unknown&gt;<br>Account: <br>State: Up<br>Link: SIP/311-0868fd98<br>Uniqueid: 1156442804.74</p>
<p><br>Event: Status<br>Privilege: Call<br>Channel: SIP/311-0868fd98<br>CallerID: 311<br>CallerIDName: Snom<br>Account: <br>State: Up<br>Context: macro-vm<br>Extension: s<br>Priority: 5<br>Seconds: 13<br>Link: SIP/310-08697fb8
<br>Uniqueid: 1156442804.73</p>
<p>That is pretty easy to decode.</p>
<p>However when an external call is made to a SIP-phone, the result is different, this is a call from another Asterisk via an IAX trunk:</p>
<p>Event: Status<br>Privilege: Call<br>Channel: SIP/311-08695698<br>CallerID: 35254390<br>CallerIDName: &lt;unknown&gt;<br>Account: <br>State: Up<br>Link: IAX2/MR-1<br>Uniqueid: 1156442974.76</p>
<p><br>Event: Status<br>Privilege: Call<br>Channel: IAX2/MR-1<br>CallerID: 35436121<br>CallerIDName: &lt;unknown&gt;<br>Account: <br>State: Up<br>Context: macro-vm<br>Extension: s<br>Priority: 5<br>Seconds: 9<br>Link: SIP/311-08695698
<br>Uniqueid: 1156442974.75</p>
<p>The actual callerid of the caller is 3536121, 35254390 is the called number.</p>
<p>How do I get the information, that 35436121 is connected to 311?</p>
<p>Am I doing it in a stupid way, I'm aware that the Manager can give me realtime events, but I'm under the impression, that it is not very stable in a high traffic environment?</p>
<p>Any help or good ideas would be appriceated.</p>
<p>Michael</p>
<p>&nbsp;</p></div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;</div>